Background subagent that dies on a terminal API error returns a truncated result with no error signal
Type: bug
Area: Agent tool / background subagents
Environment: Claude Code CLI, Agent tool used to launch a subagent in the background on a long multi-step task.
Summary
When a backgrounded subagent dies on a terminal API error (for example after retry exhaustion) partway through its task, the parent receives the subagent's partial output as the completion result. There is no status that distinguishes "finished the task" from "terminated mid-task," so the parent cannot tell a truncated result from a complete one. In orchestration code, a .filter(Boolean) / null-guard pattern then silently swallows the failed agent, and a result that is shorter than requested reads as success.
Steps to reproduce
- Launch a subagent in the background on a task that produces a sizable, well-specified result.
- Induce a terminal API error mid-run (or have one occur naturally after retries).
- Observe the parent's completion notification.
Expected
A distinct terminal-error / truncated status on the task notification, so the parent can retry or escalate instead of consuming a partial result as final.
Actual
The partial result is delivered as a normal completion with no error marker. Downstream handling treats it as a complete answer.
Impact
Multi-agent pipelines build on incomplete results; silent data loss that is hard to detect because "short" and "done" look identical.
Suggested direction
Emit a distinct error/terminated status (separate from normal completion) on the task notification when a subagent dies before finishing, and flag partial results explicitly.
Filed from real usage; sanitized. Happy to provide more detail.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗