Repository navigation
fix(agents): answer Control UI users once after a child finishes - #204098
Conversation
Treat an inter-session internal-sink send as transcript-only only when the session has an external delivery record, so a Control UI parent's final message-tool update ends its turn instead of owing a third-person epilogue. The CLI tracker now reads the message tool's own delivery fact. The settle wake tells the parent to address the user directly. Co-authored-by: obviyus <[email protected]>
|
🦞👀 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 maintainer review before merge. What this changesCount final internal replies in Control UI completion turns as delivered answers and tell the parent to address the original user directly. Example: A child finishes in Control UI session agent:main:dashboard:settle, and the parent sends “Your dates are corrected.” with final=true.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a source-verifiable reply-completion bug still present on main, and no definite introduced code defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherChild completion events resume the parent agent; its message tool records the reply and publishes delivery facts consumed by embedded and CLI completion handling. flowchart TD
A[Child completion] --> B[Parent settle turn]
B --> C[Message tool]
D[Session delivery record] --> C
C --> E[Internal reply sink]
E --> F[Control UI chat]
C --> G[Delivery fact]
G --> H[Runner completion]
Technical reviewBest possible solution: Use the message tool’s canonical delivery fact to complete Control UI replies while preserving transcript-only handling for externally bound sessions. Do we have a high-confidence way to reproduce the issue? Current main excludes all inter-session internal-source sends from completion, and the added regressions target the resulting Control UI classification and settlement failures; no target code was executed during this review. Is this the best way to solve the issue? The patch is a small, coherent repair using the existing session delivery record and message-tool delivery owner, with separate tests for classification and CLI consumption. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6a8b47c86d4b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -5, Tests +123. Total +118 across 6 files. Added test files: 0. 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. Review metrics
LabelsLabel changes:
Label justifications:
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 23, 2026, 9:57 AM ET / 14:57 UTC. |
Control UI E2E: before and afterProof tier: source ( Steps (same on both sides, fresh dashboard session per trial): one prompt: "Delegate a quick schedule check to a child using sessions_spawn ..., wait with sessions_yield. When it finishes, send me the update with the message tool." The child runs
The duplicate on the base (trial 2) was a second model response in the same settle run: "Done! The child subagent finished its Gaps:
|
|
Landed in a9c1dd8. Control UI parents now send one update, addressed to the user, when a child finishes. An inter-session |
…203176) ## Problem A requester that calls `sessions_yield` after spawning several completion-mode subagents was woken only when every member of the frozen yield batch was ready. A sibling that keeps running, or that pauses on its own `sessions_yield` while a background command runs, held every finished result back. Production incident (2026-11-21): a dashboard parent spawned 3 children and yielded at 16:20 IST. Two children finished at 16:26:58 and 16:29:41 with reports that needed a decision. The third kept cycling through exec-yield and resume. The Gateway log has no `announce:requester-settle:…` run for that parent. The parent ran again only at 18:32, when the user typed into the chat. A copy of the state database shows why: both finished rows were `terminal`/`ok` with `delivery.status: pending` and a pending `requesterSettleWake` (`batchRunIds` = all 3, `rearmGeneration: 1`). The third row was still `running`. The gate in `subagent-announce.requester-settle-wake.ts` returned `false` unless every frozen member passed `isRequesterSettleMemberReady`. #200967 had already made an exception for siblings that wait for a message. An exec-yielded or running sibling is the same bug class. ## Change Rule: every ready result wakes the yielded parent. Siblings that are still working keep their wake, with the same `rearmGeneration`, and wake the parent again when they finish. Each result is delivered once. - **Settle wake:** removed the all-or-nothing gate and the message-wait exception (`isEndedSubagentMessageWait` is deleted). The wake delivers the ready members of the frozen batch as one partition, and lists the members that are still working. A member whose partition has already started dispatch records its own batch, so a later partition never offers it again. When a partition holds only results that were already delivered and siblings are still pending, it settles without a redundant wake. - **Wake message:** a partition that leaves members pending no longer says "every subagent has settled… do not call sessions_yield again". It names the siblings that are still working (label, task name or run ID, at most 5, each truncated) and tells the parent: if the request needs those results, call `sessions_yield` to wait; otherwise act on the ready results without reporting the batch as finished. - **Lifecycle failure path:** `offeredBatch` now offers only ready members, so failure settlement can never consume the wake of a sibling that is still running or exec-yielded. - **Yield transfer:** when a child ended before the yield and a sibling is still running, `afterRelease` now schedules the settle for the finished child. Before, nothing woke the parent until the sibling ended. - **Followup owners** (`sessions_send` wait-for-reply, `agent-step`, nested `agent-run-subagent`): the caller is waiting for a single reply. Only the partition that leaves no member pending continues the followup. Earlier partitions wake the session as ordinary settle turns. `successor()` accepts that last partition as a subset of its cohort, so it no longer throws and records the result as a permanent failure. - **Automation authority:** a yield that carried cron-management authority keeps it for the partition that leaves no member pending. Earlier partitions run without borrowing it, and settling them shrinks the retained cohort instead of discarding the authority. - **Silent waits:** while siblings are still working, the parent may stay silent (`NO_REPLY`) and wait. Such a turn is not treated as a missing visible reply, so it is not retried. - **Goal return:** an earlier partition leaves the Goal cohort when it settles. The partition that settles the cohort last resumes the Goal once. - `isRequesterSettleMemberReady` moved to `subagent-run-liveness.ts`, its only owner, and replaces the deleted message-wait predicate. - Docs: `tools/subagents/announce.md` and `concepts/subagent-yield-handoff.md`. Product decisions, under the rules "no stranded user" and "no false done": - A stopped child is a settled outcome, so its report now wakes the parent right away instead of waiting for its siblings. - A followup caller gets one reply, after all results are in. The session itself is still woken for each result. ## Evidence **Regression test** (`subagent-registry.requester-wake.e2e.test.ts`, real registry, lifecycle, yield tool and wake entry point): spawn 2 children, yield, finish one, keep the other exec-yielded. The parent is woken with the finished result, and the wake names the working sibling. The sibling's continuation then wakes the parent again with only its own result. A sweep adds no third wake. A second case covers a child that ended before the yield, while the requester's turn held it. - Base `eb7ca3d33375`: both cases red (`expected [] to have a length of 1`: no wake). - Head: both cases green. **Owner tests:** cron authority (`requester-cron-authority.test.ts`: the early partition neither borrows nor consumes the authority, and the last partition is admitted with it), followup partition (`subagent-announce.requester-settle-followup.test.ts`: early partition runs with no followup successor, last partition carries it). Goal partition (`goal-continuation.test.ts`: early partition does not resume the Goal, last partition resumes it once). **Updated tests that asserted the all-at-once rule:** `requester-settle-cross-turn` (paused member), `subagent-control.worker` progress card (one wake per result; the card retires once), `requester-wake-settlement` (stopped child). **Real-Gateway E2E**, incident shape. Scratch `ocx src` Gateway under `env -i`, OpenAI `gpt-5.5` on the OpenClaw runtime. Parent spawns `alpha` (replies at once) and `beta` (`exec` with `background: true` running `sleep 90`, then `sessions_yield`), then yields. | | alpha ended | first parent wake | beta yielded | beta ended | second parent wake | |---|---|---|---|---|---| | base | 19:47:10 | **19:48:53** (one combined run, after beta) | 19:47:13 | 19:48:50 | none | | head | 19:40:08 | **19:40:11** (`announce:requester-settle:…:<alpha>:yield-1`) | 19:40:12 | 19:41:55 | 19:41:59 (`…:<beta>:yield-1`) | The parent's replies on head were `alpha: ALPHA-RESULT-7`, then `alpha: ALPHA-RESULT-7 / beta: BETA-RESULT-9`. The live Peanutto launchd pid and `openclaw.json` hash did not change. **Live sibling suites** (`subagent-yield-pause`, `subagent-followup-yield`, `subagent-yield-resume`, real OpenAI `gpt-5.5`): the same tests fail on base `eb7ca3d33375` and on this branch, with the same assertions (missing `completion.resultText` after a resumed or paused child completes, a Gateway shutdown timeout, an interim reply in the follow-up watch case; follow-up-yield failed 2 of 2 on base). One run of this branch showed a parent that wrote its final report as soon as the first result arrived; the wake message now says to keep waiting when the request needs the remaining results, and that failure no longer appears. The real-Gateway restart e2e files (`test/gateway-*-restart*.e2e.test.ts`) fail locally on base too (11 of 26 on base, 9 of 26 here, same assertions). **Gates:** `pnpm tsgo:core`, `pnpm check:test-types`, oxlint and oxfmt on the changed files. Every test file in `src/agents/subagents` and `goal-continuation.test.ts` was run across the unit-fast, infra, agents-support, spawn-boundary, core-isolated and e2e projects. Two infra tests failed once under host load and passed when run alone, on head and on base. ## Size Production code is +96 / −56. The gate, the message-wait exception and its predicate are deleted. The added lines are the partition support the old gate did not need: pending members in the message, the followup last-partition rule, Goal cohort shrink, and pre-yield scheduling, and cron-authority cohort shrink. A census of `batchRunIds`, `requesterYieldBatch`, the frozen branch and `selectConnectedSettledSubagentWave` found every remaining reader still in use. v8 coverage could not attribute lines under the compiled-worker test runner (0 files collected in two attempts), so the census was done by reading the code. ## Accepted edge cases - If a Goal cohort's last partition is rejected for an unrelated reason (for example, a rearm-generation mismatch), the Goal return stays retained until Stop or a lifecycle rotation. That is the same outcome as a failed final delivery today. - A nested requester whose early partition answers without yielding reports that answer to its parent. The later result wakes it again as a separate completion. ## Merge danger - **Two-way door.** No schema, stored-row or config change: the wake rows keep their existing fields and generation. A revert restores the all-at-once wake for every cohort, including rows written while this change ran. - **Blast radius:** requesters that yield on two or more completion children (dashboard, chat and nested subagent requesters). A defect here would show as an extra or a missing wake for the parent, not as a lost child result: every result stays saved in its child session. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 09d956b) Release adaptation: Kept stable QA Gateway fixture lifecycle; filtered intentionally silent partial-result wakes. Companion audit: #203222 selected. #204249, #204069, #204048, #203892, #202513, #198960 not applicable (refactors/test cleanup); #204260, #204178, #204098, #204089, #203839, #203271 missing in lane and not prerequisites. Co-authored-by: RomneyDa <[email protected]>
…nclaw#204098) ## Problem In a Control UI chat, when a child finished and the parent sent its update with the `message` tool, the user saw two bubbles: the update, then a second, third-person one ("I sent the user the corrected dates... Still waiting on: ..."). Cause: the requester-settle wake is an inter-session turn. Since openclaw#164860, every inter-session internal-sink send was treated as transcript-only. The tool told the model "Recorded reply in the current chat history ... did not deliver it to an external channel", and neither the embedded delivery fact nor the Claude CLI tracker (openclaw#170534) counted the send as the turn's answer. A reply was still owed, so the model wrote an epilogue to the inter-session sender, and Control UI showed it as a normal assistant row. ## Solution - One fact, computed where the message tool is built: an internal-sink send is transcript-only only when the turn is inter-session **and** the session has an external delivery record (`sessionDeliveryChannel(entry)`, the same record `resolveAnnounceOrigin` treats as the external binding). It feeds the receipt and the embedded delivery fact (`messageDelivery.sourceReplyDelivered`). - The Claude CLI tracker no longer runs its own `inputProvenance.kind !== "inter_session"` check. It reads the message tool's `messageDelivery.sourceReplyDelivered` fact, which it already consumed. The duplicate branch is deleted. - The settle-wake instruction for yielded deliverables now says child results are not a message from the user, and the answer goes to the user of the original conversation, addressed to them directly. The openclaw#164860 case stays fixed: a WhatsApp/Telegram DM-scope main session gets `delivery.kind = "external"` during session init before its first agent turn (`src/auto-reply/reply/session.ts`), and Control UI turns do not replace an external record (`session-delivery.ts`, `metadata-projection.ts`). So a route-less inter-session turn there still gets the transcript-only receipt. Accepted edge (no code): a session used from both an external chat and the Control UI keeps today's behavior (transcript-only receipt on inter-session turns). Not changed: later assistant finals after a send are not hidden; the private-completion path and NO_REPLY policy for completion turns are unchanged. ## User impact Control UI users get one message, addressed to them, when a delegated task finishes. External-chat sessions behave as before. ## Evidence - Regression tests, red on merge base `43bef4fbcc7d`, green on head: - `message-tool.internal-source-reply.integration.test.ts` › "answers a Control UI user from an inter-session result turn": visible receipt and `sourceReplyDelivered: true`. - `cli-runner.reliability.test.ts` (via `cli-runner.reply-completion.test-support.ts`) › "ends a Control UI child-result turn at its final message-tool answer": real message tool, CLI run settles as success with one assistant row. - The openclaw#164860 test now seeds an external delivery record and still gets the transcript-only receipt (green on base and head). - Importers of every changed source: 47 test files that import a changed source or test-support file: all green (`ocx test`, vitest-source). `pnpm check:changed`: typecheck, lint, format and guards pass; the one red is the dead-export scan on `scripts/lib/docker-e2e-watchdog.mjs`, which this PR does not touch. - `pnpm prompt:snapshots:check` (clean HOME): current. ### Control UI E2E: before and after **Proof tier:** source (`ocx src`, pinned Bun fork). Two isolated scratch Gateways (merge base `43bef4fbcc7d` and head `5505abef8ce2`; the later head commit `56262188568a` changes only a test fixture type). Real Anthropic model (`anthropic/claude-sonnet-4-6`), driven through the Control UI in a browser. Embedded OpenClaw runtime. **Steps (same on both sides, fresh dashboard session per trial):** one prompt: "Delegate a quick schedule check to a child using sessions_spawn ..., wait with sessions_yield. When it finishes, send me the update with the message tool." The child runs `sleep 15` and reports. The requester-settle wake (`inter_session`, `subagent_settle`) sends a targetless `message` with `final: true`. | | Receipt on the settle wake (3/3) | Visible settle bubbles per trial | |---|---|---| | Before (merge base) | `Recorded reply in the current chat history via internal-ui. This send did not deliver it to an external channel.` | 1, **2**, 1 (the other two ended with hidden `NO_REPLY`) | | After (this PR) | `Sent visible reply to the current source conversation via internal-ui.` | 1, 1, 1 (no later model message in the settle run) | The duplicate on the base (trial 2) was a second model response in the same settle run: "Done! The child subagent finished its `sleep 15` and reported back. Here's the summary it delivered: ..." No empty-response or incomplete-turn errors on either side. **Gaps:** - Claude CLI runtime: real CLI runs worked on both sides, but in this scratch setup the settle-wake message tool did not receive inter-session provenance on the base either (base receipt was already "Sent visible ..."), so the live CLI runs did not reach the changed condition. The CLI path is covered by the regression test that drives the real CLI runner and the real message tool (`cli-runner.reliability.test.ts`, red on base, green on head). - The `sessions_send`-to-a-kept-child variant was not run; the spawn + yield variant reaches the same settle wake. - The model's wording varied; the head reply was a direct update to the user in each trial.   Diff: production +9 / −14 (one fact, one deleted tracker branch, one prompt line, one comment). Co-authored-by: Ayaan Zaidi <[email protected]>
…n its own part (#203174) Root cause: src/shared/assistant-answer-text.ts:24 picks only text blocks that carry a signature as the answer, which is meant for OpenAI Responses item ids. Since #170534 (first shipped in 2026.11.5) it also picks empty signed blocks. Gemini 3 sends its thought signature on a separate empty part after the answer, so the selected answer is `""`, the turn is marked empty rather than silent, and the `NO_REPLY` text is delivered. Fixes #203131 Thanks @Avi711 for the clear report and trace. ## What Problem This Solves With Gemini 3 on a `google-generative-ai` provider, a reply of exactly `NO_REPLY` reaches the chat as the text "NO_REPLY" instead of ending the turn silently. It happens in direct chats and in automations that announce their result. 2026.8.2 stayed silent. ## User Impact Gemini 3 replies of exactly `NO_REPLY` end the turn silently again, in direct chats and in announced automations. Normal Gemini answers are delivered as before. ## Why This Change Was Made Signed-block selection now applies only to OpenAI Responses messages, where a text signature is an output item id. A Gemini thought signature is not an item id, so Gemini answers use all of their text blocks. The Google stream reader still keeps the signature-only part as its own block. That keeps the next request byte-identical: the signature is replayed as its own empty part, as Gemini sent it. Attaching the signature to the previous text block would change those replayed bytes. Responses answer selection is unchanged. ## Evidence Real Gateway (`ocx src`, isolated profile state) with the QA channel recording deliveries and a local `google-generative-ai` fixture that streams `{"text":"NO_REPLY"}` and then `{"text":"","thoughtSignature":"..."}`. Base is the merge base 423ae09. | Check | Base | This PR | |---|---|---| | Direct chat, exact `NO_REPLY` | "NO_REPLY" delivered | nothing delivered | | Announced automation, exact `NO_REPLY` | "NO_REPLY" delivered (`deliveryStatus: delivered`) | nothing delivered (`not-delivered`) | | Normal answer with trailing signature part, 2 turns | delivered once per turn | delivered once per turn | | Next request replays the signature | `[{"text":"Here is…"},{"text":"","thoughtSignature":"Q2lN…Sw=="}]` | identical bytes | The new regression test fails on base (`disposition: 'empty'`, expected `'silent'`) and passes here; its OpenAI Responses row (signed empty item still wins) passes on both. Observed proof lines: #203174 (comment) Merge danger: two-way door. No stored state, config or published contract changes; a revert fully restores the old behavior. Blast radius: answer text selection for non-Responses messages that carry text signatures (Google Gemini), which now use all of their text blocks. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit fcfb114) Follow-ups: e58ca10 fix: preserve runtime custody, inference history, and recovery (#203901) [not selected for this narrow backport]; 44f7c52 fix: keep automations silent when the model closes its reasoning before NO_REPLY (#203432) [not selected for this narrow backport]; 6c2ff33 fix(cron): optional-silent cron run fails after the agent collects its collector child's result (#164949) [not selected for this narrow backport]; a9c1dd8 fix(agents): answer Control UI users once after a child finishes (#204098) [separately ordered lane row] Co-authored-by: RomneyDa <[email protected]>
…4098) ## Problem In a Control UI chat, when a child finished and the parent sent its update with the `message` tool, the user saw two bubbles: the update, then a second, third-person one ("I sent the user the corrected dates... Still waiting on: ..."). Cause: the requester-settle wake is an inter-session turn. Since #164860, every inter-session internal-sink send was treated as transcript-only. The tool told the model "Recorded reply in the current chat history ... did not deliver it to an external channel", and neither the embedded delivery fact nor the Claude CLI tracker (#170534) counted the send as the turn's answer. A reply was still owed, so the model wrote an epilogue to the inter-session sender, and Control UI showed it as a normal assistant row. ## Solution - One fact, computed where the message tool is built: an internal-sink send is transcript-only only when the turn is inter-session **and** the session has an external delivery record (`sessionDeliveryChannel(entry)`, the same record `resolveAnnounceOrigin` treats as the external binding). It feeds the receipt and the embedded delivery fact (`messageDelivery.sourceReplyDelivered`). - The Claude CLI tracker no longer runs its own `inputProvenance.kind !== "inter_session"` check. It reads the message tool's `messageDelivery.sourceReplyDelivered` fact, which it already consumed. The duplicate branch is deleted. - The settle-wake instruction for yielded deliverables now says child results are not a message from the user, and the answer goes to the user of the original conversation, addressed to them directly. The #164860 case stays fixed: a WhatsApp/Telegram DM-scope main session gets `delivery.kind = "external"` during session init before its first agent turn (`src/auto-reply/reply/session.ts`), and Control UI turns do not replace an external record (`session-delivery.ts`, `metadata-projection.ts`). So a route-less inter-session turn there still gets the transcript-only receipt. Accepted edge (no code): a session used from both an external chat and the Control UI keeps today's behavior (transcript-only receipt on inter-session turns). Not changed: later assistant finals after a send are not hidden; the private-completion path and NO_REPLY policy for completion turns are unchanged. ## User impact Control UI users get one message, addressed to them, when a delegated task finishes. External-chat sessions behave as before. ## Evidence - Regression tests, red on merge base `59b0aec099f5`, green on head: - `message-tool.internal-source-reply.integration.test.ts` › "answers a Control UI user from an inter-session result turn": visible receipt and `sourceReplyDelivered: true`. - `cli-runner.reliability.test.ts` (via `cli-runner.reply-completion.test-support.ts`) › "ends a Control UI child-result turn at its final message-tool answer": real message tool, CLI run settles as success with one assistant row. - The #164860 test now seeds an external delivery record and still gets the transcript-only receipt (green on base and head). - Importers of every changed source: 47 test files that import a changed source or test-support file: all green (`ocx test`, vitest-source). `pnpm check:changed`: typecheck, lint, format and guards pass; the one red is the dead-export scan on `scripts/lib/docker-e2e-watchdog.mjs`, which this PR does not touch. - `pnpm prompt:snapshots:check` (clean HOME): current. ### Control UI E2E: before and after **Proof tier:** source (`ocx src`, pinned Bun fork). Two isolated scratch Gateways (merge base `59b0aec099f5` and head `5505abef8ce2`; the later head commit `56262188568a` changes only a test fixture type). Real Anthropic model (`anthropic/claude-sonnet-4-6`), driven through the Control UI in a browser. Embedded OpenClaw runtime. **Steps (same on both sides, fresh dashboard session per trial):** one prompt: "Delegate a quick schedule check to a child using sessions_spawn ..., wait with sessions_yield. When it finishes, send me the update with the message tool." The child runs `sleep 15` and reports. The requester-settle wake (`inter_session`, `subagent_settle`) sends a targetless `message` with `final: true`. | | Receipt on the settle wake (3/3) | Visible settle bubbles per trial | |---|---|---| | Before (merge base) | `Recorded reply in the current chat history via internal-ui. This send did not deliver it to an external channel.` | 1, **2**, 1 (the other two ended with hidden `NO_REPLY`) | | After (this PR) | `Sent visible reply to the current source conversation via internal-ui.` | 1, 1, 1 (no later model message in the settle run) | The duplicate on the base (trial 2) was a second model response in the same settle run: "Done! The child subagent finished its `sleep 15` and reported back. Here's the summary it delivered: ..." No empty-response or incomplete-turn errors on either side. **Gaps:** - Claude CLI runtime: real CLI runs worked on both sides, but in this scratch setup the settle-wake message tool did not receive inter-session provenance on the base either (base receipt was already "Sent visible ..."), so the live CLI runs did not reach the changed condition. The CLI path is covered by the regression test that drives the real CLI runner and the real message tool (`cli-runner.reliability.test.ts`, red on base, green on head). - The `sessions_send`-to-a-kept-child variant was not run; the spawn + yield variant reaches the same settle wake. - The model's wording varied; the head reply was a direct update to the user in each trial.   Diff: production +9 / −14 (one fact, one deleted tracker branch, one prompt line, one comment). Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit a9c1dd8) Follow-ups: cded11f fix(agents): deliver a child's end state as parent history, not a turn obligation (#204178) [not selected for this narrow backport] Co-authored-by: RomneyDa <[email protected]>


Problem
In a Control UI chat, when a child finished and the parent sent its update with the
messagetool, the user saw two bubbles: the update, then a second, third-person one ("I sent the user the corrected dates... Still waiting on: ...").Cause: the requester-settle wake is an inter-session turn. Since #164860, every inter-session internal-sink send was treated as transcript-only. The tool told the model "Recorded reply in the current chat history ... did not deliver it to an external channel", and neither the embedded delivery fact nor the Claude CLI tracker (#170534) counted the send as the turn's answer. A reply was still owed, so the model wrote an epilogue to the inter-session sender, and Control UI showed it as a normal assistant row.
Solution
sessionDeliveryChannel(entry), the same recordresolveAnnounceOrigintreats as the external binding). It feeds the receipt and the embedded delivery fact (messageDelivery.sourceReplyDelivered).inputProvenance.kind !== "inter_session"check. It reads the message tool'smessageDelivery.sourceReplyDeliveredfact, which it already consumed. The duplicate branch is deleted.The #164860 case stays fixed: a WhatsApp/Telegram DM-scope main session gets
delivery.kind = "external"during session init before its first agent turn (src/auto-reply/reply/session.ts), and Control UI turns do not replace an external record (session-delivery.ts,metadata-projection.ts). So a route-less inter-session turn there still gets the transcript-only receipt.Accepted edge (no code): a session used from both an external chat and the Control UI keeps today's behavior (transcript-only receipt on inter-session turns).
Not changed: later assistant finals after a send are not hidden; the private-completion path and NO_REPLY policy for completion turns are unchanged.
User impact
Control UI users get one message, addressed to them, when a delegated task finishes. External-chat sessions behave as before.
Evidence
59b0aec099f5, green on head:message-tool.internal-source-reply.integration.test.ts› "answers a Control UI user from an inter-session result turn": visible receipt andsourceReplyDelivered: true.cli-runner.reliability.test.ts(viacli-runner.reply-completion.test-support.ts) › "ends a Control UI child-result turn at its final message-tool answer": real message tool, CLI run settles as success with one assistant row.ocx test, vitest-source).pnpm check:changed: typecheck, lint, format and guards pass; the one red is the dead-export scan onscripts/lib/docker-e2e-watchdog.mjs, which this PR does not touch.pnpm prompt:snapshots:check(clean HOME): current.Control UI E2E: before and after
Proof tier: source (
ocx src, pinned Bun fork). Two isolated scratch Gateways (merge base59b0aec099f5and head5505abef8ce2; the later head commit56262188568achanges only a test fixture type). Real Anthropic model (anthropic/claude-sonnet-4-6), driven through the Control UI in a browser. Embedded OpenClaw runtime.Steps (same on both sides, fresh dashboard session per trial): one prompt: "Delegate a quick schedule check to a child using sessions_spawn ..., wait with sessions_yield. When it finishes, send me the update with the message tool." The child runs
sleep 15and reports. The requester-settle wake (inter_session,subagent_settle) sends a targetlessmessagewithfinal: true.Recorded reply in the current chat history via internal-ui. This send did not deliver it to an external channel.NO_REPLY)Sent visible reply to the current source conversation via internal-ui.The duplicate on the base (trial 2) was a second model response in the same settle run: "Done! The child subagent finished its
sleep 15and reported back. Here's the summary it delivered: ..." No empty-response or incomplete-turn errors on either side.Gaps:
cli-runner.reliability.test.ts, red on base, green on head).sessions_send-to-a-kept-child variant was not run; the spawn + yield variant reaches the same settle wake.Diff: production +9 / −14 (one fact, one deleted tracker branch, one prompt line, one comment).