Three socket-close API errors in one session, each at sub-agent-return boundary (claude 2.1.144)
Symptom
Three API Error: The socket connection was closed unexpectedly events in a single
local session of claude 2.1.144, each terminating the parent assistant turn before
tool dispatch. First event fired immediately on return of a long-running sub-agent
launched via the Agent tool; second and third on subsequent recovery turns of the
same parent thread.
Timing
| # | UTC timestamp | Context |
|---|----------------------|------------------------------------------------------|
| 1 | 2026-06-12T06:11:30Z | Sub-agent return (~19m33s, 54 tool uses, 107k tokens) |
| 2 | 2026-06-12T07:54:23Z | Parent recovery turn |
| 3 | 2026-06-12T08:15:14Z | Second parent recovery turn |
A second occurrence in the same session (later in the day) hit on a different
sub-agent return: 50 minutes / 98 tool uses, where the sub-agent had completed its
disk writes successfully but the parent's view showed total_tokens: 0 after the
disconnect. The sub-agent's work survived; the parent's ability to receive and
react to it did not.
Effect
Planned 4-way parallel sub-agent fan-out reduced to effective parallelism = 1.
Subsequent fan-out attempts also disconnected. Operator-side mitigation in the
session: drop to cohorts of 2, then to inline (no sub-agent) work for synthesis
steps, to dodge the trigger profile.
Question
Is there a known harness/CLI limit (sub-agent runtime, returned-token volume, or
time-since-last-parent-tool-call) that triggers socket close on sub-agent return?
Is the recovery-turn re-disconnect a separate event or the harness staying in a
degraded transport state?
Attached
JSONL excerpt (PII-masked, structural events only — no customer content) available
on request.
Local CLI version
claude 2.1.144
Repro shape
Single parent thread launches one Agent tool call; sub-agent runs > 10 min and
returns > 50k tokens; on return, parent emits text + plans further Agent calls
in the same turn — disconnect fires before the second Agent call dispatches.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗