-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: Agent / sessions_spawn tool_use can emit with no matching tool_result and no parent-visible signal — silent subagent drop (~3.8% historical rate) #88856
Copy link
Copy link
Closed as not planned
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Environment
claude-cli(direct Anthropic), modelclaude-opus-4-7~/.claude/projects/<slug>/TL;DR
Across the local historical transcript corpus, 23 of 602 (3.82%)
Agent/mcp__openclaw__sessions_spawntool_useblocks emitted by the assistant have no matchingtool_resultblock anywhere later in the same transcript. The subagent either died, was killed, or the runtime dropped the result before the parent resumed — but no signal of that failure reaches the parent's context. The parent transcript shows the spawntool_useand nothing after it, leaving the model to either narrate forward as if the spawn completed (worst case), wait indefinitely, or fabricate the result.The ask is for first-class harness signal on a dropped / killed / disconnected subagent: e.g. an injected
tool_resultwithis_error=trueand anerror_typefield, or a harness-side notification surfaced into the parent context that the model can read on the next turn.Repro shape
This is an observed-rate report against an existing on-disk transcript corpus, not a synthetic single-shot repro. The detection is mechanical:
A spawn id that appears in
spawn_idsand never inresult_idsis an orphan. Backtest result on this host's transcript corpus:tool_usesWhy this matters
Three downstream behaviors the parent can take when the result never arrives, all of them bad:
All three are operator-visible only by inspecting the transcript after the fact. A first-class signal (synthetic error
tool_result, or harness-emitted system reminder) would let the model see the failure on the next turn and decide whether to re-fire, refine the prompt, or explicitly drop the work.Current local workaround
A
Stophook that diffsspawn_ids − result_idsper transcript and surfaces new orphans viaexit 2stderr as a next-turn system reminder. The model reads the reminder on the next turn and chooses re-fire / refine / drop.State (already-surfaced ids) is kept in an append-only ledger so the same orphan doesn't re-fire on every subsequent
Stopevent. The hook is detection-only — it does not retry the spawn or mutate the transcript.The hook is a workaround, not a fix:
Stop, so the first signal arrives at next-turn boundary — not at the moment the subagent dropped.tool_resultshape it already knows how to consume.Proposed change (observed-symptom framing, not an upstream-code claim)
Two viable shapes for first-class signal:
tool_resultinjection. When the harness detects a subagent has died / been killed / disconnected without returning a result, inject atool_resultblock into the parent transcript withtool_use_id=<the dropped spawn>,is_error=true, and a content payload describing the failure mode (subagent died,subagent killed,runtime dropped result, etc.). The model already knows how to readtool_resultand will see the failure on the next turn naturally.Either form removes the silent class of failure. Form (1) is preferable because it slots into the existing
tool_use/tool_resultcontract and is unambiguous to the model.A complementary observation: if there's an existing failure path in the harness that already knows the subagent dropped (e.g. a logged error), the missing link is just the surface to the parent context — not a new detection layer. The 3.82% rate suggests the failure is detected somewhere; it just isn't being signalled upstream to the parent.
This is an observed-symptom proposal, not a claim about where the bug lives. I haven't traced the subagent dispatch path in the upstream source; the right fix could be in the harness's subagent-completion handler, in the runtime's
tool_resultwriter, or in the dispatch resolver. All three are plausible homes for the signal.Cross-refs
MissingAgentHarnessErroron inbound dispatch (also silent until forensics).<workspace>/memory/openclaw-architecture.md → Behavioral Conformance Hooks (2026-06-01)documents the hook + state file + retire condition.