fix(agents): preserve subagent wake delivery route#91381
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 8, 2026, 5:41 AM ET / 09:41 UTC. Summary PR surface: Source +74, Tests +98. Total +172 across 8 files. Reproducibility: yes. at source level: the linked report describes a live Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a narrow agents/reply routing fix that actually carries requester delivery context through the active wake consumption path, with focused regression coverage and redacted external-channel or runtime proof before merge. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the linked report describes a live Is this the best way to solve the issue? No, not yet: preserving the requester route is the right fix direction, but this branch currently proves a mock receives Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against b75d1a0b85b0. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +74, Tests +98. Total +172 across 8 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
d8f1172 to
3728ae0
Compare
|
@clawsweeper re-review Updated after the initial review:
Additional local verification after the update:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Superseded by a clean replacement PR from current The replacement drops the broad/ambiguous parts of this PR and follows the maintainer boundary more tightly:
It also avoids claiming #91356 as a proven current-main core regression after Josh's current-main Telegram check. Closing this PR once the replacement is available for review. |
|
Closing in favor of the clean replacement PR #92251. |
Summary
Fixes #91356.
This preserves the parent turn's original delivery route when a subagent completion wakes an active requester session through
sessions_yield/ the active reply-run queue bridge.Changes:
queueReplyRunMessage(...)andReplyBackendHandle.queueMessage(...)instead of dropping them on the active reply-run bridgeDeliveryContextinto active subagent completion wake queue optionssubagent_announceuser-facing inter-session provenance to inherit the established external route, matching the existingsessions_sendroute-preservation behaviorThis is the same turn lifecycle visible-outcome reconciliation invariant as #91333 and #91357: once a parent channel turn has an established user-visible route, internal resume/completion bookkeeping should not silently replace it.
Real behavior proof
Behavior or issue addressed: Parent replies after a
sessions_yield/ subagent completion wake can resume under an internal completion/webchat context and lose the original external channel route.Real environment tested: Local OpenClaw source checkout on branch
agent/xiaozhua/sessions-yield-route-preservation, head3728ae01a858e2679b196eb9f29283f33ef5cc33, using the repository focused Vitest runner and changed-file lint gate.Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: The active requester wake path now queues the completion with the parent external
DeliveryContext, the reply-run bridge preserves those queue options, andsubagent_announceinter-session provenance inherits the established external route when the live resume context is internal webchat. The added regressionpreserves the requester external route when the completion origin is internalverifies an internal completion origin no longer replaces the requester external route.What was not tested: I did not run a live Telegram/Slack end-to-end delivery against production credentials. The proof is source-level route preservation plus focused regression coverage for the affected queue and route-resolution paths.
Tests
node scripts/run-vitest.mjs src/auto-reply/reply/effective-reply-route.test.ts src/agents/embedded-agent-runner/runs.test.ts src/agents/subagent-announce-delivery.test.tspnpm exec oxlint src/auto-reply/reply/effective-reply-route.ts src/auto-reply/reply/effective-reply-route.test.ts src/auto-reply/reply/reply-run-registry.ts src/agents/embedded-agent-runner/run-state.ts src/agents/embedded-agent-runner/runs.ts src/agents/embedded-agent-runner/runs.test.ts src/agents/subagent-announce-delivery.ts src/agents/subagent-announce-delivery.test.tsgit diff --checkRelated: #91333, #91357