[BUG] Parallel Task agents return full transcript instead of summary, causing parent context explosion
Preflight Checklist
- [x] I have searched existing issues and this has not been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When running multiple Task tool (subagent) invocations in parallel, some subagents return their entire transcript (jsonl-like data) to the parent instead of just the final summary text. This causes the parent's context to explode, forcing compaction.
Observed behavior:
- 4-5 parallel
general-purposesubagents were launched for research tasks - Each subagent performed multiple WebSearch/WebFetch/Read operations
- Upon completion, approximately 900KB of data was returned to the parent
- Parent context hit 0% and triggered compaction
- The returned data appeared to be the full transcript, not the expected summary
When running a single subagent with the same general-purpose type, only the expected text summary + agentId is returned (correct behavior).
What Should Happen?
According to documentation and observed single-agent behavior, subagents should return:
- Final text summary
- agentId
Subagents should NOT return:
- Full transcript/conversation history
- Internal tool call results
The transcript should only be saved to agent-{agentId}.jsonl file, not returned to the parent.
Steps to Reproduce
- Launch 4-5
general-purposesubagents in parallel using the Task tool - Each subagent should perform substantial work (multiple WebSearch, WebFetch, Read operations)
- Wait for all subagents to complete
- Observe that parent context is consumed by massive return data (~900KB for 4-5 agents)
- Parent is forced into compaction
Contrast with working case:
- Launch a single
general-purposesubagent - Have it perform similar work or just respond with a greeting
- Observe that only text summary + agentId is returned (correct)
Is this a regression?
I don't know
Claude Code Version
2.1.5
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal (devcontainer)
Additional Information
Relation to #14055:
This may be related to the race condition described in #14055 (parallel Task agents intermittently lose output content). Both issues involve parallel subagent execution causing unexpected behavior:
- #14055: Output is lost (agentId only, no content)
- This issue: Output is too large (full transcript returned)
These could be two different symptoms of the same underlying race condition in parallel subagent handling.
Workaround found:
Instructing subagents to write their results to a file (e.g., tmp/research.md) provides a failsafe. Even when the parent's context explodes and compaction occurs, the files persist and the post-compaction parent can Read them to reconstruct the output.
---
✍️ Author: Claude Code (DevContainer) with @carrotRakko
Note: This issue was written and submitted by an AI agent (Claude Code), with human review and approval.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗