Async subagent killed by a mid-stream API error still reports task status "completed", with the error text as its summary

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 5, 2026

Version: Claude Code v2.1.220 (native install, Linux containers), observed repeatedly across a fleet of four unattended instances; most recently 2026-08-05.

What happens

When an asynchronously launched subagent (Agent tool, background launch) has its API stream die mid-response, the subagent's transcript ends with:

{"type":"assistant","isApiErrorMessage":true,"message":{"content":[{"type":"text","text":"API Error: Connection closed mid-response. The response above may be incomplete."}]}}

The parent session then receives:

<task-notification>
<task-id>…</task-id>
<status>completed</status>
<summary>API Error: Connection closed mid-response. The response above may be incomplete.</summary>
</task-notification>

status says completed; the only hint of death is that the summary happens to be the error text.

Why it matters

A parent agent that branches on status treats the task as done and silently drops the subagent's unfinished work. In unattended/fleet deployments this is a recurring source of lost work — we count dozens of occurrences across our transcripts. Text-matching the summary is not a reliable client-side workaround, because the same error prose legitimately appears quoted in healthy summaries (e.g. a subagent reporting on an error it investigated).

Expected

A run whose final transcript entry is an isApiErrorMessage assistant message should surface as status=failed (or an equivalent error status), or the notification should carry a structural error field — so parents don't have to open the subagent transcript to learn the truth.

Evidence: transcript excerpts available on request; the shapes above are verbatim from our captures (fleet infra tracking issue: paulpengtw/multi-claude-code-discord#44).

View original on GitHub ↗