Repository navigation
Conversation
Hidden subagent sessions inherit the requester's delivery route. A background wake turn (exec/tool handoff) in such a session replied directly into that chat, bypassing the announce chain. Capture deliver:false for hidden subagent envelopes; visible spawned and ordinary sessions keep direct delivery.
… thread Only silence direct wake delivery for hidden workers with no active conversation binding; thread-bound subagents and persistent ACP sessions are addressed by the user directly. Pass cfg to the envelope checks.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesSuppresses automatic chat delivery of hidden-worker wake replies while preserving visible, ordinary, and actively bound sessions. Example: A hidden worker replies “Worker follow-up result” after a background completion.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 2 items remain This PR addresses a current delivery bug and adds distinct bound-session handling, but its acknowledged transcript-only outcome for ended workers needs a scope decision. Reviewed head: Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherBackground completions capture a session-event target, execute a wake turn, and use its delivery policy to control external replies; parent completion handoff is separate. flowchart TD
A[Background completion] --> B[Capture event target]
B --> C[Execute worker wake]
C --> D[Worker transcript]
C --> E[Automatic chat delivery]
B --> E
D --> F[Existing parent completion handoff]
F --> G[Parent summary]
Technical reviewBest possible solution: Consolidate the overlapping capture-policy fixes while preserving interactive delivery and explicitly tracking any remaining ended-worker parent handoff. Do we have a high-confidence way to reproduce the issue? Current-main target capture and delivery establish the inherited-route failure, supported by the linked release report; this review executed no target code. Is this the best way to solve the issue? Target capture is the smallest existing owner for suppression, but this is only a partial solution to the linked issue’s parent-delivery requirement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 89425fd75d4e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +16, Tests +150. Total +166 across 3 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 27, 2026, 9:00 AM ET / 14:00 UTC. |
) Root cause: src/auto-reply/reply/session-event-target.ts:156 (base 03cdb2c) captures `deliver` from the producing run only, so a hidden subagent's exec-wake turn keeps the requester's chat route with delivery on, and its reply is posted to that chat. Fixes #206556 Fixes #206708 Thanks @stealthybear for the report, the fix and the live repro, and @Nocha12 for #206708 and for #206709, whose active-binding exception (thread-bound subagents and persistent ACP sessions keep replying in their own conversation) this PR now carries. ## What Problem This Solves When an agent hands work to a hidden helper (a subagent) that runs a background command and waits for it, the helper's reply after the command finishes is posted straight to your chat, for example your Telegram DM with the bot. The parent agent also gets that reply and posts its own summary, so you see two messages for one result: first the helper's raw report (sometimes with notes meant only for the parent), then the summary. ## User Impact A hidden helper's wake reply now reaches only its parent agent, so you see one summary instead of two. The parent still gets the helper's result through its normal finished-task report. Visible spawned sessions keep posting to the chat as before, and thread-bound helpers and persistent ACP sessions bound to their own conversation keep replying in that thread. No setting, schema or migration. ## Why This Change Was Made The event target capture, which already decides `deliver: false` for private producers, now also sets it when the destination is a hidden subagent (`isSubagentEnvelopeSession` and not `isVisibleSpawnedSession`) with no active conversation binding (`listSessionBindingsBySessionAsync`). Without the binding check a thread-bound subagent would stop replying in its own thread. The capabilities module is loaded lazily in the async capture because a static import formed a runtime import cycle (`subagent-capabilities -> config/sessions -> ... -> session-event-target`). ## Evidence Live Telegram Test Server DM, real Gateway, Telegram delivery, spawn, exec, yield, wake and announce; only the model is scripted. The DM asks the agent to spawn a hidden helper that runs `exec` in the background, calls `sessions_yield`, and replies a marker when the exit wakes it. | Build | Helper's raw reply in the DM | Parent got the helper's result | Parent's summary in the DM | | --- | --- | --- | --- | | main 73940d3 (2 runs), 03cdb2c (1 run) | yes, every run | yes | yes | | this PR c428bfa (2 runs) | no | yes | yes | | `visible: true` control, main and this PR | yes (posts as before) | n/a | n/a | Thread-bound control: Telegram has no thread-bound spawn (its binding placement is `current`), so the thread case ran on Discord through QA Lab: on this head and on the earlier head without the binding check, `thread: true, mode: "session"` spawns, the child's exec wake runs and it replies. That lane's recorder cannot see SUT-created threads, so the thread message itself is covered by the unit case below, which fails without the binding check (`expected false to be undefined`) and passes with it. Observed proof lines: #206570 (comment). Local review on c428bfa: no findings. Tests: `session-event-handoff.test.ts` plus the 12 test files that import `session-event-target.ts` pass (151 tests); `check:import-cycles` reports 0 cycles. Earlier live evidence from @stealthybear (released 2026.11.10, real model on a real Telegram bot):  Related, separate: #168227, #198204, #200046. Merge danger: two-way door. A revert restores the duplicate post; nothing is stored, migrated or published. Blast radius: event turns (exec wakes, tool handoff results) of hidden subagent sessions without an active binding; ordinary, visible and bound sessions are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
) Root cause: src/auto-reply/reply/session-event-target.ts:156 (base 03cdb2c) captures `deliver` from the producing run only, so a hidden subagent's exec-wake turn keeps the requester's chat route with delivery on, and its reply is posted to that chat. Fixes #206556 Fixes #206708 Thanks @stealthybear for the report, the fix and the live repro, and @Nocha12 for #206708 and for #206709, whose active-binding exception (thread-bound subagents and persistent ACP sessions keep replying in their own conversation) this PR now carries. ## What Problem This Solves When an agent hands work to a hidden helper (a subagent) that runs a background command and waits for it, the helper's reply after the command finishes is posted straight to your chat, for example your Telegram DM with the bot. The parent agent also gets that reply and posts its own summary, so you see two messages for one result: first the helper's raw report (sometimes with notes meant only for the parent), then the summary. ## User Impact A hidden helper's wake reply now reaches only its parent agent, so you see one summary instead of two. The parent still gets the helper's result through its normal finished-task report. Visible spawned sessions keep posting to the chat as before, and thread-bound helpers and persistent ACP sessions bound to their own conversation keep replying in that thread. No setting, schema or migration. ## Why This Change Was Made The event target capture, which already decides `deliver: false` for private producers, now also sets it when the destination is a hidden subagent (`isSubagentEnvelopeSession` and not `isVisibleSpawnedSession`) with no active conversation binding (`listSessionBindingsBySessionAsync`). Without the binding check a thread-bound subagent would stop replying in its own thread. The capabilities module is loaded lazily in the async capture because a static import formed a runtime import cycle (`subagent-capabilities -> config/sessions -> ... -> session-event-target`). ## Evidence Live Telegram Test Server DM, real Gateway, Telegram delivery, spawn, exec, yield, wake and announce; only the model is scripted. The DM asks the agent to spawn a hidden helper that runs `exec` in the background, calls `sessions_yield`, and replies a marker when the exit wakes it. | Build | Helper's raw reply in the DM | Parent got the helper's result | Parent's summary in the DM | | --- | --- | --- | --- | | main 73940d3 (2 runs), 03cdb2c (1 run) | yes, every run | yes | yes | | this PR c428bfa (2 runs) | no | yes | yes | | `visible: true` control, main and this PR | yes (posts as before) | n/a | n/a | Thread-bound control: Telegram has no thread-bound spawn (its binding placement is `current`), so the thread case ran on Discord through QA Lab: on this head and on the earlier head without the binding check, `thread: true, mode: "session"` spawns, the child's exec wake runs and it replies. That lane's recorder cannot see SUT-created threads, so the thread message itself is covered by the unit case below, which fails without the binding check (`expected false to be undefined`) and passes with it. Observed proof lines: #206570 (comment). Local review on c428bfa: no findings. Tests: `session-event-handoff.test.ts` plus the 12 test files that import `session-event-target.ts` pass (151 tests); `check:import-cycles` reports 0 cycles. Earlier live evidence from @stealthybear (released 2026.11.10, real model on a real Telegram bot):  Related, separate: #168227, #198204, #200046. Merge danger: two-way door. A revert restores the duplicate post; nothing is stored, migrated or published. Blast radius: event turns (exec wakes, tool handoff results) of hidden subagent sessions without an active binding; ordinary, visible and bound sessions are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]> Follow-up scan: 34d4f8f improve: list Docker streams and flag unconfirmed cleanup in Doctor (#201292); 21786f6 refactor(ui): stop sending 28 additional unused labels to translators (#207982); 9cec330 refactor(workboard): group session tiles without rescanning each column (#207380); 16a2d4b refactor(ui): lowercase log search text only once (#207383). Other hits are not required by this focused beta.2 fix. (cherry picked from commit 2a428f2) Co-authored-by: RomneyDa <[email protected]>
) Root cause: src/auto-reply/reply/session-event-target.ts:156 (base 03cdb2c) captures `deliver` from the producing run only, so a hidden subagent's exec-wake turn keeps the requester's chat route with delivery on, and its reply is posted to that chat. Fixes #206556 Fixes #206708 Thanks @stealthybear for the report, the fix and the live repro, and @Nocha12 for #206708 and for #206709, whose active-binding exception (thread-bound subagents and persistent ACP sessions keep replying in their own conversation) this PR now carries. ## What Problem This Solves When an agent hands work to a hidden helper (a subagent) that runs a background command and waits for it, the helper's reply after the command finishes is posted straight to your chat, for example your Telegram DM with the bot. The parent agent also gets that reply and posts its own summary, so you see two messages for one result: first the helper's raw report (sometimes with notes meant only for the parent), then the summary. ## User Impact A hidden helper's wake reply now reaches only its parent agent, so you see one summary instead of two. The parent still gets the helper's result through its normal finished-task report. Visible spawned sessions keep posting to the chat as before, and thread-bound helpers and persistent ACP sessions bound to their own conversation keep replying in that thread. No setting, schema or migration. ## Why This Change Was Made The event target capture, which already decides `deliver: false` for private producers, now also sets it when the destination is a hidden subagent (`isSubagentEnvelopeSession` and not `isVisibleSpawnedSession`) with no active conversation binding (`listSessionBindingsBySessionAsync`). Without the binding check a thread-bound subagent would stop replying in its own thread. The capabilities module is loaded lazily in the async capture because a static import formed a runtime import cycle (`subagent-capabilities -> config/sessions -> ... -> session-event-target`). ## Evidence Live Telegram Test Server DM, real Gateway, Telegram delivery, spawn, exec, yield, wake and announce; only the model is scripted. The DM asks the agent to spawn a hidden helper that runs `exec` in the background, calls `sessions_yield`, and replies a marker when the exit wakes it. | Build | Helper's raw reply in the DM | Parent got the helper's result | Parent's summary in the DM | | --- | --- | --- | --- | | main 73940d3 (2 runs), 03cdb2c (1 run) | yes, every run | yes | yes | | this PR c428bfa (2 runs) | no | yes | yes | | `visible: true` control, main and this PR | yes (posts as before) | n/a | n/a | Thread-bound control: Telegram has no thread-bound spawn (its binding placement is `current`), so the thread case ran on Discord through QA Lab: on this head and on the earlier head without the binding check, `thread: true, mode: "session"` spawns, the child's exec wake runs and it replies. That lane's recorder cannot see SUT-created threads, so the thread message itself is covered by the unit case below, which fails without the binding check (`expected false to be undefined`) and passes with it. Observed proof lines: #206570 (comment). Local review on c428bfa: no findings. Tests: `session-event-handoff.test.ts` plus the 12 test files that import `session-event-target.ts` pass (151 tests); `check:import-cycles` reports 0 cycles. Earlier live evidence from @stealthybear (released 2026.11.10, real model on a real Telegram bot):  Related, separate: #168227, #198204, #200046. Merge danger: two-way door. A revert restores the duplicate post; nothing is stored, migrated or published. Blast radius: event turns (exec wakes, tool handoff results) of hidden subagent sessions without an active binding; ordinary, visible and bound sessions are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 2a428f2) Release adaptation: Suppress only hidden unbound helper events at the stable target capture; honor explicit delivery restrictions, visible sessions, active bindings, and the existing scheduled/requester custody. Companion audit: PR #206570 uses existing binding and spawn classifiers. Resume the stopped cherry-pick at the stable agent-run registry import anchor without importing main-only authority handlers. Co-authored-by: RomneyDa <[email protected]>
…claw#206570) Root cause: src/auto-reply/reply/session-event-target.ts:156 (base 7e9542f) captures `deliver` from the producing run only, so a hidden subagent's exec-wake turn keeps the requester's chat route with delivery on, and its reply is posted to that chat. Fixes openclaw#206556 Fixes openclaw#206708 Thanks @stealthybear for the report, the fix and the live repro, and @Nocha12 for openclaw#206708 and for openclaw#206709, whose active-binding exception (thread-bound subagents and persistent ACP sessions keep replying in their own conversation) this PR now carries. ## What Problem This Solves When an agent hands work to a hidden helper (a subagent) that runs a background command and waits for it, the helper's reply after the command finishes is posted straight to your chat, for example your Telegram DM with the bot. The parent agent also gets that reply and posts its own summary, so you see two messages for one result: first the helper's raw report (sometimes with notes meant only for the parent), then the summary. ## User Impact A hidden helper's wake reply now reaches only its parent agent, so you see one summary instead of two. The parent still gets the helper's result through its normal finished-task report. Visible spawned sessions keep posting to the chat as before, and thread-bound helpers and persistent ACP sessions bound to their own conversation keep replying in that thread. No setting, schema or migration. ## Why This Change Was Made The event target capture, which already decides `deliver: false` for private producers, now also sets it when the destination is a hidden subagent (`isSubagentEnvelopeSession` and not `isVisibleSpawnedSession`) with no active conversation binding (`listSessionBindingsBySessionAsync`). Without the binding check a thread-bound subagent would stop replying in its own thread. The capabilities module is loaded lazily in the async capture because a static import formed a runtime import cycle (`subagent-capabilities -> config/sessions -> ... -> session-event-target`). ## Evidence Live Telegram Test Server DM, real Gateway, Telegram delivery, spawn, exec, yield, wake and announce; only the model is scripted. The DM asks the agent to spawn a hidden helper that runs `exec` in the background, calls `sessions_yield`, and replies a marker when the exit wakes it. | Build | Helper's raw reply in the DM | Parent got the helper's result | Parent's summary in the DM | | --- | --- | --- | --- | | main 2877834 (2 runs), 7e9542f (1 run) | yes, every run | yes | yes | | this PR c428bfa (2 runs) | no | yes | yes | | `visible: true` control, main and this PR | yes (posts as before) | n/a | n/a | Thread-bound control: Telegram has no thread-bound spawn (its binding placement is `current`), so the thread case ran on Discord through QA Lab: on this head and on the earlier head without the binding check, `thread: true, mode: "session"` spawns, the child's exec wake runs and it replies. That lane's recorder cannot see SUT-created threads, so the thread message itself is covered by the unit case below, which fails without the binding check (`expected false to be undefined`) and passes with it. Observed proof lines: openclaw#206570 (comment). Local review on c428bfa: no findings. Tests: `session-event-handoff.test.ts` plus the 12 test files that import `session-event-target.ts` pass (151 tests); `check:import-cycles` reports 0 cycles. Earlier live evidence from @stealthybear (released 2026.11.10, real model on a real Telegram bot):  Related, separate: openclaw#168227, openclaw#198204, openclaw#200046. Merge danger: two-way door. A revert restores the duplicate post; nothing is stored, migrated or published. Blast radius: event turns (exec wakes, tool handoff results) of hidden subagent sessions without an active binding; ordinary, visible and bound sessions are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #206708
What Problem This Solves
When a hidden subagent's background command or tool handoff finishes after its turn, the wake-up turn replies straight into the chat of the person who started the parent task. Hidden workers are supposed to report through their parent, so users get raw worker messages in their DM, often duplicated with the parent's own report.
User Impact
Background follow-ups from hidden subagents no longer appear directly in the requester's chat; the wake turn still runs and its reply stays in the worker session. Visible spawned sessions (
sessions_spawnwithvisible=true), thread-bound subagents and persistent ACP sessions with an active conversation binding, and ordinary chat sessions behave as before. No configuration or migration needed.Why This Change Was Made
Hidden subagents inherit the requester's delivery route at spawn, and the session-event target captured for a wake turn left
deliverunset, so the inherited route was used. The target capture now setsdeliver: falseonly when the caller did not choose a value, the session is a subagent envelope that is not a visible spawned session (existing helpers insubagent-capabilities, now givencfg), and the session has no active conversation binding (the same binding listing bound delivery uses), so thread-bound workers keep replying in their own thread. An explicitdeliverfrom the caller still wins, and the existing merge rule (any retained target withdeliver: falsekeeps the batch silent) is unchanged.Evidence
session-event-hidden-subagent-delivery.test.tsdrives a real background wake through admission and delivery planning with a synthetic model, for four destinations: hidden subagent, hidden dashboard child, visible spawned session, ordinary session. It is registered in the database-worker core list like the other session-event tests.session-event-handoff.test.tspass (26 tests total).delivered: true, reply routed to the requester chat); visible and ordinary cases still pass.pnpm tsgo:corepasses.Known limitation
If a hidden worker's run has already ended, nothing re-announces the wake turn's reply to the parent, so that follow-up is only visible in the worker transcript. This PR stops the leak into the requester's chat; routing ended-worker wake output into the announce chain would be a follow-up. Separately,
bash-process-durable-notify.tsalready disables exec-exit notifications for all hidden envelopes without a binding exemption (pre-existing, unchanged here).