[BUG] SubagentHandback from a teammate-spawned subagent reports "spawning agent no longer running" and the report never reaches the caller
Environment
- Claude Code 2.1.289, Windows 11, model opus, permission mode auto.
- Agent teams in use: a lead session spawns named teammate lanes; each lane
dispatches its own subagents (code reviewers, a UI verifier) with the Agent tool.
- Plugins installed, but none registers a SubagentStop/handback hook that touches
delivery (the only SubagentStop hook blocks a stop while the subagent's own
background shell task still runs; it never fires on an Agent child).
Summary
When the spawner of a subagent is itself a teammate (not the lead session), the
subagent's SubagentHandback call fails with "the agent that spawned you is no
longer running". The harness keeps re-prompting the subagent to call
SubagentHandback (handback-send-enforce reminder), each retry fails the same way,
and the subagent ends with the report only in its final text. The report is then
delivered to the lead (or to a different, already-finished lane) or nowhere. The
lane that dispatched the subagent sits idle waiting for a report that never comes.
Steps to reproduce
- Start a lead session with agent teams enabled.
- Spawn a named teammate (lane) with a task that includes "dispatch a
code-reviewer subagent, wait for its report, then act on it".
- In the lane, dispatch a subagent with the Agent tool (default, so it runs in the
background and the lane is notified on completion).
- The lane ends its turn waiting for the completion notification (or keeps
working; both were observed).
- The subagent finishes and calls
SubagentHandback({message}).
Expected
The report is delivered to the lane that dispatched the subagent. If that lane
truly has ended, the handback either wakes the lane (as a completion
notification does for the lead) or fails once with a clear error and the lane is
told its subagent ended without delivering.
Actual
SubagentHandbackfails 3-4 times with "the spawning agent was no longer
running", while the enforce reminder keeps demanding the call (it does not check
caller liveness).
- In at least one case (2026-10-03, lane-1389, PR 1403) the spawning lane was
alive and waiting the whole time.
SendMessagereplies from the subagent to the lane by name were also lost in
one case (2026-10-02, lane-1330).
- Reports surface in the lead's context or not at all; the lane stalls until the
lead relays the report or someone reads the subagent transcript jsonl.
Evidence
Machine-wide incident log, recurrence key handback-caller-gone (plussubagent-handback-parent-not-running, subagent-no-handback): 10 entries
2026-10-01 to 2026-10-03, across lanes 1329, 1330, 1331, 1333, 1389 and the
reviewer side, PRs 1357, 1358, 1361, 1362, 1364, 1366, 1396, 1403. Every entry has
a teammate lane as the spawner; none involves a subagent spawned by the lead
session directly.
Representative entries:
- 2026-10-01 code-reviewer: "SubagentHandback failed 3 times: the spawning agent
was no longer running, while the harness kept re-prompting for handback."
- 2026-10-02 lane-1330: "Three foreground subagents ... ended without delivering
their reports. SubagentHandback reported that the caller was gone, and their
SendMessage replies never reached the lane."
- 2026-10-03 lane-1389: "SubagentHandback failed 4 times each with 'the agent that
spawned you is no longer running', while the spawning lane was alive and
waiting."
Workarounds in use
- The lead relays the report to the lane by SendMessage.
- The lane reads the subagent's final message from its transcript jsonl.
Suspected cause
Handback routing resolves the caller from the lead session's agent registry, so a
subagent whose parent is a teammate either finds no live caller (teammate turn
ended, or teammate not registered as a handback target) or falls back to the lead.
The enforce reminder does not check caller liveness, so the subagent loops.