P2 Token Incinerator — delegate_task Endless Recursive Loop (#52484)
Executive Summary
delegate_task has no max_depth parameter. When given an open-ended research prompt, the main agent spawns sub-agents, which spawn grandchild-agents, cascading into an endless sequential chain. A single travel search query triggered 44 sub-agent sessions over 53 minutes, consuming tokens exponentially. This is the 3rd distinct delegation subsystem bug we've tracked — joining #50199 (base_url ignored + results silently dropped) and #46303 (concurrent session cross-contamination). The delegation layer shows recurring containment failures.
Root Cause Analysis
1. No Recursion Depth Limit
Sub-agents have full capability to call delegate_task — no max_depth or allow_recursive: false toggle exists. Each spawned sub-agent is a fully capable agent that can itself spawn more agents, creating an unbounded tree.
2. Fallback Flaw When Pool Is at Capacity
When max_async_children (e.g., 3) is full, the fallback logic reverts to synchronous/sequential execution — but still spawns a brand new independent session for every single task, with no throttling or emergency abort mechanism.
Evidence from SQLite & Logs
| Metric | Value |
|---|---|
| Sub-agent sessions | 44 |
| Duration | 53 minutes (16:31–17:24 CST) |
| Peak spawn rate | 8 sessions within a single minute (16:51) |
| Log flood | delegate_task: async pool at capacity (3 running) |
| Session evolution | Ctrip → Xiaohongshu → Zhihu → Baidu (contextual, not duplicates) |
Impact Assessment
| Dimension | Severity | Detail |
|---|---|---|
| Token Cost | HIGH | Exponential token consumption — 44 sessions cascading from a single query |
| System Stability | HIGH | 8 sessions/minute peak; pool saturation, no abort mechanism |
| User Experience | HIGH | 53-minute meltdown with no output; user receives nothing useful |
| Containment | CRITICAL | 3rd delegation containment failure — systemic, not isolated |
Proposed Fixes
- Add
max_depthconfig — default to 3, hard-cap at a configurable limit - Add
allow_recursive: falsetoggle — sub-agents denied delegate_task by default - Hard-block sub-agents from calling delegate_task when pool is saturated — no fallback spawning
PR: #52557 already open | Reporter willing to submit PR.
Delegation Subsystem Bug History
| Issue | Severity | Description |
|---|---|---|
| #50199 | P2 | base_url ignored + results silently dropped |
| #46303 | P2 | Concurrent session cross-contamination |
| #52484 | P2 | Token Incinerator — endless recursive loop, no max depth |
⚠️ Pattern: The delegation layer shows recurring containment failures across three distinct vectors. Each bug is a different failure mode — URL handling, session isolation, recursion depth — suggesting the delegation subsystem needs a fundamental redesign rather than point fixes.
Source Evidence
- GitHub Issue: #52484 — delegate_task Endless Recursive Loop
- Opened: June 25, 2026
- Reporter: @jiks999
- Labels: P2, comp/agent, tool/delegate, type/bug
- OS: macOS
📋 https://hermes-agent.reviews/hermes-delegate-task-token-incinerator-52484.html
Tracked by hermes-agent.reviews — June 25, 2026