-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: subagent completion spawns a fresh run on the parent's route instead of resuming the yielded session (supersedes #80310) #81490
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.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.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.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.
Type
Fields
Priority
None yet
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
A subagent completion never resumes a yielded parent on the same external route. The gateway spawns a fresh run on the route instead of re-entering the paused session, so the session-store pointer is overwritten and the paused run is orphaned forever. This is not fixed by PR #76927.
Steps to reproduce
agent:main:telegram:default:direct:<peer>) callsessions_yieldwhile waiting on a subagent.sessionId, the new session's transcript shows the completion announce arriving as an inter-session message, and the originally-yielded.jsonlis orphaned at thesessions_yieldtool call.Expected behavior
The completion announce should resume the paused (yielded) embedded Pi run for that route, not start a fresh run on the same route. After resume, the parent's orchestrator turn continues (typically to spawn the next sub-task).
Actual behavior
Evidence from my reproduction:
Parent session transcript (
0e240a08-fba7-4c37-a3a5-93033f7d95cb.jsonl) ends at thesessions_yieldtool call at2026-05-13T16:29:26ZwithstopReason: "toolUse"and theopenclaw.sessions_yieldcustom_message. Nothing after.Session store entry
agent:main:telegram:default:direct:<peer>(read at 17:39 UTC, ~70 min after the yield):{ "sessionId": "ed84b61c-c24f-4199-a468-11d5d17db3ad", "channel": "telegram", "lastChannel": "telegram", "lastTo": "telegram:<peer>", "lastAccountId": "default", "status": "done", "endedAt": 1778693473927, "updatedAt": 1778693474542, "abortedLastRun": false, "queueMode": null, "deliveryContext": { "channel": "telegram", "to": "telegram:<peer>", "accountId": "default" } }The
sessionIdised84b61c-..., not0e240a08-.... The paused session is gone from the store.The
ed84b61ctranscript contains an assistant-visible line of the form:So the completion announce was routed to the right external route, but the gateway resolved the route to a new embedded Pi run (new session id) instead of the paused one. That new run consumed the announce once, ended, and its
sessionIdwas written to the session store. The yielded run was never re-entered.OpenClaw version
v2026.5.7 (also reproduced with local hotfix backport of PR #76927's
forceCompletionQueuepath; the PR does not affect this code path — see "Additional information").Operating system
Linux (Raspberry Pi 5, Raspberry Pi OS)
Install method
npm global
Model
Claude Sonnet 4.6 on Amazon Bedrock
Provider / routing chain
openclaw -> amazon-bedrock
Logs, screenshots, and evidence
Code pointers (on current
origin/main):livenessState: "paused"andmeta.yielded = trueon the terminal lifecycle meta, then returns.src/agents/pi-embedded-runner/run.ts:2724-2763.agent:main:<channel>:<account>:direct:<peer>), not by pausedsessionId.src/agents/subagent-requester-store-key.ts:12viaresolveMainSessionKey.maybeQueueSubagentAnnounceand friends look up{sessionId, isActive}fromresolveRequesterSessionActivity(canonicalKey).src/agents/subagent-announce-delivery.ts:480. When the announce arrives and there's no active run for the route, delivery falls through to the directagentmethod on the route, which starts a fresh run rather than waking the paused one.Why PR #76927 /
f9eb7d993cdoes not fix this: that PR changes dispatch ordering and addsforceCompletionQueue, which bypasses theisActivegate so the announce can queue for an inactive parent. But in my repro the announce is not dropped — it's delivered to a freshly-started run on the route. The queue-or-direct decision happens downstream of the session-to-route binding, which is where the actual bug is. Backportingf9eb7d993conto v2026.5.7 (confirmed as the minimum sufficient port of that PR's runtime code) does not change the observed behavior on Linux/Bedrock; the session-store entry is still rewritten by the fresh run.Impact and severity
sessions_yieldto wait on a subagent and expects to resume after completion.Additional information
Prior issue #80310 was closed as a duplicate of PR #76927. That was based on source-level inspection only, not a live reproduction. This report (a) adds the live reproduction, (b) shows the session-store pointer overwrite, and (c) demonstrates that a minimal backport of PR #76927's runtime changes onto v2026.5.7 does not fix the symptom. The root cause is upstream of the announce dispatch: the gateway's route-to-run resolution does not reuse paused sessions.
Suggested direction: when a run exits with
livenessState: "paused"/meta.yielded = true, persist the paused session UUID on the route entry (e.g.pausedSessionId) and have the gateway's route resolver for inter-session/inbound delivery prefer resuming that paused session over spawning a fresh one, for some bounded window.Prior issue: #80310 (locked).