Background subagents (Agent tool) die silently on session pause/resume — no failure notification, no way to re-activate
Environment
- Claude Code 2.1.97 (desktop app session, macOS / Darwin 25.5.0)
- Orchestrator session dispatching subagents via the
Agenttool withrun_in_background: true
What happened
An orchestrator session dispatched 4 background subagents (general-purpose, run_in_background: true). Each got a self-contained implementation brief; all four started fine (worktrees created, commits pushed, PRs opened, review polls running).
The user then interrupted the session mid-turn ("tool use rejected" + a pause) and resumed it ~5 hours later.
After resume, ground-truth checking (PR/branch/worktree footprints) showed 3 of the 4 subagents were dead:
- two died mid-flight after pushing a fix commit — they were waiting on an external review-poll subprocess and never produced activity again;
- one died before producing any output at all (no worktree, no branch, no PR);
- the 4th had completed before the pause.
No <task-notification> with a failed/interrupted status was ever delivered for any of the three. The orchestrator (and the human) believed they were still running for hours — the absence of a completion notification is indistinguishable from "still working". The agents' JSONL transcripts under the session's tasks/ directory simply stop.
Expected behavior (any of these would help, in order of value)
- Death/interrupt notification: if a background subagent is killed by a session pause/interrupt (or dies for any reason), deliver a task-notification with
status: failed/interruptedon resume — silence should always mean "running", never "dead". - Resume/re-activate: the subagent transcripts exist on disk; an API to resume an interrupted subagent with its context intact (the way
SendMessagecontinues a live agent) would make interruptions lossless instead of forcing a from-scratch re-dispatch. - Liveness query: a way for the orchestrator to enumerate its background agents with an actual alive/dead status. (
TaskListreturns "No tasks found" for Agent-tool subagents.)
Workarounds we use now
- Brief every subagent to commit+push after every self-contained unit (made the two mid-flight deaths lossless — the orchestrator took over their open PRs);
- liveness via artifact footprints (branch/PR/worktree mtimes), never via notification-absence.
Impact
Multi-hour silent loss of parallel work per pause; orchestrator context wasted on re-dispatch; misleading "still running" state reported to the user until ground-truth checks are run.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗