[BUGdeep-research workflow spawned 111 agents for a single query and consumed entire 5-hour session quota — zero output produced
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
A single /deep-research call on a brand-new session spawned 111 background agents, consumed 1,197,060 tokens, and exhausted the entire 5-hour Max plan quota in 26 minutes. The workflow was killed by the runtime before reaching the synthesis phase. Output: zero.
Session ID: b062add3-f252-42de-966b-132b7559ebea
Workflow ID: wf_1a93512e-e51
Support ticket: 215474553000671
What Should Happen?
Workflow respects MAX_FETCH=15 unconditionally, monitors token budget, and returns partial synthesis before quota is exhausted. Pre-launch estimate should reflect actual resource usage.
Error Messages/Logs
Workflow status: killed
Agents spawned: 111 (completed: 55, incomplete: 56)
Tokens: 1,197,060
Tool calls: 320
Duration: 26.2 min
Phase 5 (Synthesize): never reached
Log: subagent completed without calling StructuredOutput (after 2 in-conversation nudges) — repeated across verify phase
Steps to Reproduce
- Start a fresh Claude Code session (Max plan)
- Ask a terminology question: "how is the LLM behavior called when it knows the rules but doesn't apply them?"
- Claude answers correctly, then offers /deep-research on the topic
- User confirms: yes
- Claude says: "5 parallel search directions, usually 3–5 minutes"
- Observe: workflow spawns 111 agents, quota exhausted, session killed, no report generated
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
2.1.156
Claude Code Version
2.1.156
Platform
Other
Operating System
macOS
Terminal/Shell
Other
Additional Information
b062add3-f252-42de-966b-132b7559ebea.zip
Root Cause Analysis
Source file: deep-research-wf_1a93512e-e51.js (350 lines)
Bug 1 — Fetch budget leak (lines 188–194)
MAX_FETCH=15, but high-relevance URLs (relRank=0) bypass the limit entirely.
Result: 29 sources fetched instead of 15, inflating all downstream phases.
Fix: if (fetchSlots <= 0) — unconditional, no relevance exception.
Bug 2 — No token budget guard
No phase checks remaining token budget before spawning agents.
No graceful degradation, no partial results on quota exhaustion.
Bug 3 — Verify agents retry loop
Logs filled with: "subagent completed without calling StructuredOutput (after 2 in-conversation nudges)"
On failure, workflow spawns replacement instead of aborting. Creates infinite retry loop.
Bug 4 — Verify agents perform independent WebSearch
Each of 75 verify agents runs its own web search — exponential token multiplier not accounted for in design.
Phase breakdown
| Phase | Agents | Status |
|---|---|---|
| 1. Scope | 1 | ✓ |
| 2. Search | 6 | ✓ 29 URLs |
| 3. Fetch | 29 | ✓ 140 claims |
| 4. Verify | 75 | 72/75 done → killed |
| 5. Synthesize | 0 | ❌ never reached |
Agent count formula (line 348): 1 + 6 + 29 + (25×3) + 1 = 111
Support ticket: 215474553000671
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗