Background task completion notifications lost after CLI process restart; stalled-stream agent deaths surface late
Environment
- Claude Code CLI (native install), macOS (darwin 25.5), model claude-opus-4-8[1m] / claude-fable-5 sessions
Symptom 1: completion records lost across CLI restart
When the CLI process exits while background work (Agent tool subagents, Workflow tool runs) is still executing, the next session receives notifications like:
No completion record was found for background workflow "..." from the previous session. It may have been stopped (via the UI or TaskStop — these leave no transcript marker), or it may have been running when the previous Claude Code process exited.
The underlying subagent transcripts/journals are still on disk, but the orchestrating conversation gets no completion notification and must manually resume every run (Workflow resumeFromRunId / SendMessage). With several concurrent background tasks this silently drops the coordinator's state.
Expected: on restart, the harness reconciles still-running/finished background tasks and delivers completion (or explicit orphaned-task) notifications automatically.
Symptom 2: background agents dying instantly on "Response stalled mid-stream", notification sometimes delayed
Several background Agent-tool subagents terminated within seconds with:
Agent terminated early due to an API error: API Error: Response stalled mid-stream. The response above may be incomplete.
In one case the agent stopped (transcript ~136 bytes) and the completion task-notification did not reach the main conversation across multiple subsequent turns (~3+ min), while an external observer could already see the task as stopped. A retry via SendMessage works, but the coordinator only learns about the death late or via manual polling.
Expected: terminal API errors on background agents should surface a completion notification promptly on the next turn boundary.
Impact
Long autonomous multi-agent sessions (5-10 background tasks) require manual babysitting of task liveness, defeating the purpose of background orchestration.
Repro sketch
- Launch several background Agent/Workflow tasks.
- Restart the CLI process (or hit a mid-stream API stall).
- Observe missing completion records / late notifications in the resumed session.