Repository navigation
fix(agents): settle silent subagent completions quietly - #185388
Conversation
Treat parent completion inputs as optional replies and settle successful silence without missing-answer recovery. Remove the blocked system-notice producer and its queue receipt machinery. Keep child and user result requirements, recorded delivery failures, and visible channel receipts. Prove private and user-facing completions through an isolated Gateway with a scripted provider, including NO_REPLY, empty output, and visible replies.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR lets parent completion reviews settle silently and removes the blocked-delivery notice producer while retaining recorded failures. Example: A parent reviews CHILD_RESULT_quiet_parent_1 and returns NO_REPLY.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses unnecessary completion retries and notices on current main; no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherChild results enter the requester announcement flow, which runs a parent continuation and records its delivery outcome through the existing worker-owned registry. flowchart TD
A[Child result] --> B[Completion announcement]
B --> C[Parent continuation]
C --> D[Reply completion policy]
D --> E[Delivery classification]
E --> F[Worker registry settlement]
Technical reviewBest possible solution: Use the existing reply-policy and completion owners to settle successful silence while preserving child results, accepted human obligations, and concrete delivery failures. Do we have a high-confidence way to reproduce the issue? Current-main reply policy requires results for internal completion inputs, and delivery classification rejects silence outside the consumed-cohort exception; the supplied regression reports a matching base failure. Is this the best way to solve the issue? The patch repairs policy at its existing owner and deletes the notice path it retires, with no new manager, persisted model, configuration option, or parallel delivery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e5aa4489f728. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -191, Tests -147, Docs +7. Total -331 across 20 files. Added test files: 1. View PR surface stats
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 October 27, 2026, 12:34 AM ET / 04:34 UTC. |
|
Merged via squash.
|
) Fix the reply-expectation precedence regression introduced by #185388: completion provenance could downgrade an explicit result-required child result to optional and silently accept NO_REPLY. Honor explicit caller expectations at the reply owner, and let ordinary completion handoffs ask that owner for their optional default. Explicit visible-reply obligations and channel receipts remain enforced. Quiet parent completions settle once without a blocked notice or another model turn. Proof: reproduced all 17 CLI failures on the base; final CLI and settle-dispatch suites passed 112/112, with explicit result-required policy cases and the one-undelivered NO_REPLY settle case. The isolated scripted-provider Gateway product test covers quiet and visible completions. Targeted typecheck, lint, format, size ratchet, and Codex P1 autoreview passed. No baseline or dependency changes. Related: #185388.
Use visible unsent parent output to exercise direct completion fallback after #185388 and #185667 made ordinary parent silence optional. Preserve exact-once notices, child failure and side-effect facts, sanitization, private review, and restart assertions. Align the ACK fixture receipt and stale completion docs with the current contract.
) * fix(agents): settle silent subagent completions quietly Treat parent completion inputs as optional replies and settle successful silence without missing-answer recovery. Remove the blocked system-notice producer and its queue receipt machinery. Keep child and user result requirements, recorded delivery failures, and visible channel receipts. Prove private and user-facing completions through an isolated Gateway with a scripted provider, including NO_REPLY, empty output, and visible replies. * test(agents): align silent completion settlement expectations * test(agents): align quiet completion notices and SQLite routing
…claw#185667) Fix the reply-expectation precedence regression introduced by openclaw#185388: completion provenance could downgrade an explicit result-required child result to optional and silently accept NO_REPLY. Honor explicit caller expectations at the reply owner, and let ordinary completion handoffs ask that owner for their optional default. Explicit visible-reply obligations and channel receipts remain enforced. Quiet parent completions settle once without a blocked notice or another model turn. Proof: reproduced all 17 CLI failures on the base; final CLI and settle-dispatch suites passed 112/112, with explicit result-required policy cases and the one-undelivered NO_REPLY settle case. The isolated scripted-provider Gateway product test covers quiet and visible completions. Targeted typecheck, lint, format, size ratchet, and Codex P1 autoreview passed. No baseline or dependency changes. Related: openclaw#185388.
Use visible unsent parent output to exercise direct completion fallback after openclaw#185388 and openclaw#185667 made ordinary parent silence optional. Preserve exact-once notices, child failure and side-effect facts, sanitization, private review, and restart assertions. Align the ACK fixture receipt and stale completion docs with the current contract.
fix(agents): let silent native harness completions settle quietly #185388 made subagent completion turns reply-optional, so a parent that has nothing to add can stay silent. Native harness completions are delivered through the same announcement path with sourceTool agent_harness_completion, and that source was missed. A silent or NO_REPLY parent turn after a native helper completion was treated as an empty required reply, triggered a visible-answer continuation, and sent a redundant second answer (#196253). agent_harness_completion now gets the same optional reply expectation. A caller that asks for a visible reply still gets one. Evidence: built Gateways on node 24.22.1 in secretless Docker with a scripted local stand-in model and a small local harness plugin calling the shipped deliverAgentHarnessCompletion. After a native completion where the parent replied empty or NO_REPLY, main made 2 model requests and sent 1 extra reply after "empty response detected ... visible-answer continuation"; this change makes 1 request and sends nothing. A native completion with a visible reply, a subagent_announce with an empty reply, and a yielded subagent_settle that requires a visible result behave the same on both. Details: #196305 (comment). Closes #196253. Thanks @indra622. Co-authored-by: Ayaan Zaidi <[email protected]>
Upstream openclaw#185388 is 1aba44b ("fix(agents): settle silent subagent completions quietly", merged to main 2026-10-26), with the precedence fix from its follow-up openclaw#185667 b3b0f1b. On 2026.11.x a private completion turn (sessions_spawn completionTarget "parent") that ends with NO_REPLY or no text is treated as a missing answer: the direct-delivery producer passes replyExpectation "required" for every announce that expects a completion message, the runner retries with a visible-answer continuation, and on the released builds the retried turn can fail with "Session transcript keyed user is outside the current turn" and leave the registry row suspended. Ported behavior (private completions only): - subagent-announce-direct-delivery: a private announce no longer owes a reply; an explicit visible-reply obligation still does. - resolveCommandReplyExpectation (attempt-execution.helpers.ts on this branch, reply-completion.ts on main): a private completion input with subagent_announce/subagent_settle provenance and no producer expectation is optional. It runs after the explicit-expectation check, which is the openclaw#185667 precedence (an explicit "required" is never downgraded). - docs/tools/subagents/announce.md: private processing may finish silently. Adaptations: - Not carried: the public (user-target) half of openclaw#185388, i.e. optional public completions plus the direct-response classifier's quiet settle, and the removal of the blocked-delivery system notice and its queue receipt machinery. Those conflict in 15 files and change user-visible behavior of public completions; this branch keeps retry and text fallback there. The private classifier on this branch already settles successful silent consumption (resolvePrivateCompletionDeliveryResult). - The product test is upstream's server.subagent-silent-completion test reduced to the private target, with inline provider and spawn helpers (the upstream test-support files do not exist on this branch) and a settle waiter that also stops on failed/suspended rows. - INTER_SESSION_REPLY_POLICY_CASES: the private settle row now expects optional (upstream openclaw#185667's table has the same row as optional); added private announce, explicit-required private, and private sessions_send rows. Proof (M4, Node 26.12.1, OPENCLAW_VITEST_RUNTIME=node, on e79eb6135f36): - src/gateway/server.subagent-silent-completion.product.test.ts: 1 passed (one Gateway boot, private completions answering NO_REPLY, empty text and visible text; the test takes 18.3 s, the file 47.3 s with --maxWorkers=1). Red-before with the two source files reverted: 1 failed, 'private completion "NO_REPLY": expected 2 to be 1' (the runner retried the silent turn with a second model request). - src/agents/command/attempt-execution.cli.test.ts: 87 passed (39.5 s). Red-before: 2 failed | 85 passed, the openai and claude-cli inter-session reply policy rows ("expected 'required' to deeply equal 'optional'"). - src/agents/subagents/announce, src/agents/command and src/gateway/server.private-completion.test.ts: 63 files, 893 passed. The 7 announce live/e2e files are not in that run; of them subagent-announce.format.e2e.test.ts ran with test/subagent-requester-owner.e2e.test.ts: 2 files, 67 passed. The 6 live files need real providers and were not run. - src/agents/subagents/registry, src/agents/subagents/completion, the 17 src/agents/tools/sessions-s*.test.ts files, openclaw-tools.sessions-send-child-coordination.test.ts and agent-command-restart-recovery.test.ts: 115 files, 1855 passed, 1 skipped.
Head cb4d346 (2 commits on main d44c9ad). A private completionTarget "parent" result that the parent consumed in a private turn settles as delivery "delivered", and the parent's runtime context ("Recently Completed Subagents") and the subagents list/wait views copied that status, so the parent read delivery=delivered for a result the user never saw. Settlement now records delivery.consumedPrivately in both writers (recordAnnounceDeliveryResult and the requester batch in the completion mutation kernel) unless the host confirmed a visible final, and resolveSubagentDeliveryStatus projects it as consumed_privately for the runtime context, list and wait. Settlement outcomes are unchanged. Data model: consumedPrivately is an optional field inside the existing subagent_runs payload_json; nothing is migrated. The codec (subagent-registry.store.codec.ts), delivery-state normalizer and read types are byte-identical between the deployed 11.1 carry eee763b and this branch's base; they keep unknown delivery fields, so rows written by 11.1 load as before (no field, label "delivered") and a downgrade to 11.1 ignores the field. Adaptations: - subagent-list.ts: main's pausedAge line does not exist here; only the resolveSubagentDeliveryStatus call is added. - docs/tools/subagents/announce.md: the PR's sentences merged after the openclaw#185388 carry's private-processing sentence. - Tests ported to this branch's fixtures: the requester-wake case calls mutateRequesterCompletionBatch and reads the row back through SQLite (main has settleOne/stored helpers); the active-context case uses seedSubagentRunForReadTest directly (main has seed/promptFor); the subagents-tool case uses this file's run()/tool() helpers, and its subagent-list.js mock now passes the real resolveSubagentDeliveryStatus through (main does not mock that module). The lifecycle case applies unchanged. - Allocation private-completion-runtime-label.txt is 79 here (upstream 54) for the spelled-out fixtures and mock. - The QA scenario step is carried unchanged; it was not run here. Proof (M4, Node 26.12.1, OPENCLAW_VITEST_RUNTIME=node, on 604757f5e9fc): - The four changed test files with --maxWorkers=1: requester-wake 37 passed (22.5 s), subagent-active-context 16 passed (5.2 s), subagent-registry-lifecycle 249 passed (16.1 s), subagents-tool 5 passed (3.0 s). The new cases take 1-33 ms each. - Red-before, with the six source files at the parent commit and a passthrough resolveSubagentDeliveryStatus stub so the tests import, each file run alone: every consumed_privately case fails ("expected 'delivered' to be 'consumed_privately'", the runtime context lacks "delivery=consumed_privately;", and wait reports "delivered"); the visible-final and announced controls pass. 1 failed | 15, 1 | 248, 1 | 36, 1 | 4. - Regression: src/agents/subagents/{registry,completion,announce} and every other test importing a touched module (subagents tool and scope tests, requester-cron-authority, message-tool, spawn-session-key, commands-subagents, sessions.abort-completion-publication, server.requester-pause-authority, session-utils.subagent): 140 files, 2190 passed, 1 skipped. Not run: 7 announce live/e2e files and 3 registry e2e files.
Upstream openclaw#185388 is 1aba44b. The private-completion half was carried in "carry upstream openclaw#185388" earlier in this stack; this commit carries the rest, with the reply-expectation precedence of openclaw#185667 b3b0f1b and the QA fixture follow-up of openclaw#185840 fc06d3c. User-visible changes: - Removed notice. When a successful child's completion delivery was blocked (the requester settle failed, or delivery was suspended on expiry or permanent failure), the completion kernel queued a system event into the requester session, text "Subagent completion delivery is blocked: <reason> (run <runId>)", with the requester's origin as its delivery context. That event started another model turn in the parent session, and its reply went to the parent's conversation, so the user saw whatever the parent said about the blocked delivery (on 11.2 that turn once sent the child's raw result to Telegram). Nothing is queued now and no extra turn runs. The failure stays on the child run's delivery state (status failed or suspended, lastError = the reason), which subagents list/wait report as deliveryStatus and the parent's runtime context shows as delivery=failed/suspended on its next turn. - Public completions. A user-facing completion turn that ends with NO_REPLY or no text used to be retried once with a visible-answer continuation; if it stayed silent, core sent the child's raw result (or, for a failed child, "A delegated task failed before it could report a result. Please retry the task.") to the chat as a direct-message fallback. It now settles as delivered on the first silent turn, with no retry and no fallback send; the child result stays in the child session and the Subagents panel. A visible parent reply that was not delivered still uses the fallback. Explicit visible-reply obligations (requireVisibleReply) keep their required expectation and retries. Source: - subagent-announce-direct-response.ts: successful silent completion and settle turns return delivered before the fallback paths; the settle-only optional branch it replaces is removed. Kept from this branch: a terminal reply snapshot marked visible is not treated as silence. - subagent-announce-direct-delivery.ts: completion and settle inputs owe no reply unless requireVisibleReply is set (openclaw#185667's resolveCompletionInputReplyExpectation, inlined here); other completion producers stay required. - resolveCommandReplyExpectation (attempt-execution.helpers.ts): the subagent_announce/subagent_settle provenance default is optional for all completion inputs, not only private ones; an explicit producer expectation still wins (the openclaw#185667 precedence). - Completion kernel and store: the blocked-notice producer, its queue intent receipts (queueIds/queueReceipts), the post-commit scheduling and subagent-completion-queue-receipt.ts are removed. - Docs: announce.md and slash-command.md describe quiet settlement and the missing notice. Adaptations: - Classifier: the branch has no "result-required" expectation and its fallback block differs; the quiet-settle return is placed after the delivery-failure check as upstream, using this branch's payload facts. - Tests, rewritten on this branch's fixtures where upstream's files differ: the queue-receipt test now proves a failed settle commits without any system event and replays without a second write; the yielded-settle, direct-delivery and delivery settle cases take upstream's new expectations (silent successful turns settle; cases that need a missing reply now use unsent visible text); requester-wake expects no system events; the reply-policy table and CLI announce cases expect optional completion processing and keep explicit required rows. The product test now runs the user target too (NO_REPLY, empty and visible). Branch-only tests that pinned the old classifier: settle-dispatch's optional cohorts now settle once even when a child result was owed (the same change openclaw#185667 made to its settle-dispatch case); progress-draft's silent retries now model the runner's incomplete turn under a required expectation, so the wake still retries; restart-recovery's receipt tests now assert that replay classifies the bounded receipt like the original turn, and an empty legacy receipt settles without a visible final; the requester-wake e2e case whose woken requester accepts no next child now settles on that empty successful turn instead of retrying it. Not on this branch, so not carried: upstream's mailbox test, the settle-replay recovery harness, and the restart-sentinel blocked-notice case. - openclaw#185840: the qa-lab mock leaves visible parent text unsent for the visible terminal case, so the direct-fallback scenario still exercises fallback; its unit test and the scenario's descriptions follow. Its terminal-ack fixture and empty-completion-recovery wording are not carried (this branch's fixtures and wording differ). Upgrade: blocked-notice system events already queued by 11.1/11.2 stay in the session delivery queue and drain once through the generic session delivery runtime; nothing new is written. Proof (M4, Node 26.12.1, OPENCLAW_VITEST_RUNTIME=node, each file alone with --maxWorkers=1 unless noted): - Changed tests green: server.subagent-silent-completion.product 1 passed (6 cases, 14.4 s test, 35.9 s file), attempt-execution.cli 87, subagent-announce-delivery 137, yielded-settle 20, direct-delivery 35, queue-receipt 1, requester-wake 37, subagent-registry-lifecycle 249, qa-lab mock-openai server 115, agent-command-restart-recovery 33, requester-settle-dispatch 20, subagent-progress-draft 11, delivery-completion.recovery.integration 18. - Red-before (this commit's source files at the parent, tests kept): the product test fails 'user completion "NO_REPLY": expected 2 to be 1' (a retried silent public completion); attempt-execution.cli 20 failed | 67; yielded-settle 2 | 18; queue-receipt 1 failed (a system event is queued); requester-wake 8 | 29; mock-openai server 1 | 114. The delivery and direct-delivery fixture changes pass both ways. - Wider suites (continue-on-failure): src/agents/subagents, src/agents/command, the private-completion, restart-sentinel and product gateway tests, the 17 sessions tool tests, subagents tool and scope tests, commands-subagents, session-utils.subagent, requester-pause-authority, sessions.abort-completion-publication, sessions-send-child-coordination, agent-command-restart-recovery and the qa-lab scenario-catalog, coverage, smoke-plan, terminal-ack and mock tests: 251 files, 3675 passed, 1 skipped, 0 failed. - E2E: subagent-completion-blocked, gateway-restored-requester-settle, gateway-subagent-restart, subagent-requester-owner, announce format and the three registry e2e files pass (139 of 141 before the requester-wake adaptation; that file then 32 passed). gateway-completion-replay fails "expected 2 to be 1" (a second requester tool effect after a silent-stop nudge) both here and at the parent efa05c6, so it is not from this change. - Gates on this commit: check-line-cap-ratchet and check-test-mock-exports against v2026.11.2 exit 0; run-oxlint on the touched .ts files 0 errors; oxfmt --check exit 0; tsgo:core, tsgo:extensions, tsgo:test:src and tsgo:test:extensions exit 0. No config change, so config:docs:check was not needed.
fix(agents): let silent native harness completions settle quietly openclaw#185388 made subagent completion turns reply-optional, so a parent that has nothing to add can stay silent. Native harness completions are delivered through the same announcement path with sourceTool agent_harness_completion, and that source was missed. A silent or NO_REPLY parent turn after a native helper completion was treated as an empty required reply, triggered a visible-answer continuation, and sent a redundant second answer (openclaw#196253). agent_harness_completion now gets the same optional reply expectation. A caller that asks for a visible reply still gets one. Evidence: built Gateways on node 24.22.1 in secretless Docker with a scripted local stand-in model and a small local harness plugin calling the shipped deliverAgentHarnessCompletion. After a native completion where the parent replied empty or NO_REPLY, main made 2 model requests and sent 1 extra reply after "empty response detected ... visible-answer continuation"; this change makes 1 request and sends nothing. A native completion with a visible reply, a subagent_announce with an empty reply, and a yielded subagent_settle that requires a visible result behave the same on both. Details: openclaw#196305 (comment). Closes openclaw#196253. Thanks @indra622. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes extra model turns and “Subagent completion delivery is blocked” notices when a parent quietly consumes a completed child's result.
User Impact
Parent completion turns may return
NO_REPLYor no visible text and settle successfully. The child's result remains available in its own session and the Subagents panel. If the parent still owes an answer, later parent turns own it.Why This Change Was Made
Completion inputs use the existing optional-reply contract, and successful silent processing counts as delivery. This avoids the result-required text-only continuation introduced in #170534 while preserving the result obligation of user turns and child tasks. Visible channel replies still require delivery evidence; actual send failures remain recorded failures.
The blocked-notice producer, its queue receipt types, reconciliation helper, and scheduling path are deleted. Failed completion state remains inspectable on the child. Readers tolerate already persisted blocked-notice rows through the existing queue owner; no schema or stored-row migration is needed. Restart recovery is unchanged; overlapping tests only stop treating successful silence as a recovery trigger.
The simplification removes 191 net production lines. Tests, fixtures, and routing shrink by 147 net lines; documentation grows by 7. Overall: 20 files, +242/-573 lines (net -331).
Evidence
The isolated Gateway regression uses a scripted Responses provider through real
sessions_spawn, completion delivery, and registry settlement. It covers private and user-facing completion prompts returningNO_REPLY, empty output, and visible text. Each case settles delivered after one completion request, retains the child result, and produces no blocked notice or forced continuation.Red on the base:
parent completion "NO_REPLY": expected 2 to be 1(one test failed). Green with the fix: the Gateway regression passes all six scenarios; 260 focused tests pass across nine files, including channel delivery, completion publication, prompt-prefix stability, and user/child result recovery. Core and affected test typechecks, targeted lint, formatting, documentation MDX, andgit diff --checkpass.Local setup limitations are retained as evidence: the receipt fixture's default thread-pool invocation failed with
Shared-state admission requires the host broker; its two tests and all 51 requester-wake tests pass with--pool=forks, the pool used by database-worker suites. An initial lint invocation using the agent tsconfig timed out preparing unrelated plugin declarations at 300000 ms; the standard source-backedconfig/tsconfig/oxlint.core.jsoninvocation passes. No test classification, timeout, budget, baseline, or dependency was changed. The first consumer run had 22 failures from the retired empty-answer requirement; obsolete cases were removed and channel receipt cases now use visible unsent answers, with all 172 consumer tests passing.Affected assertion repair
Coordinator review accepted the production change and confirmed that five failing assertions pinned the removed behavior. The expiry cases now require no notice, the obsolete blocked-notice retry case is deleted, and progress-only replay settles delivered without another model request. Recovery production code is unchanged; its custody, transcript, terminal-evidence, and visible-answer assertions remain covered.
All three complete files pass locally: 47 tests (13 expiry, 11 restart-sentinel, 23 settle replay), using:
The five old assertions failed locally on
94881223e76220d52c051a45c5374b45a9538244before this test repair. Affected agents and Gateway test typechecks, targeted core lint, formatting, andgit diff --checkalso pass. Independent Codex branch review on518e49d45bc0bf1f6326ecb40ebc59e47817aaf0completed withscoped-clean, no actionable P0/P1 findings. Production code is unchanged in subsequent test-only repairs; the clean review is reused per coordinator instruction.Mailbox assertions and SQLite routing
The remaining expiry/permanent-failure mailbox cases now require no SYSTEM notice while retaining rollback and committed-suspension checks. The queue-receipt file retains two useful contracts: failed-outcome persistence across reopen, and idempotent settlement after a publication callback fails. It now uses the existing host-owned SQLite registry, selecting the forked infra lane without a pool override. No production code changed.
The full seven-file
checks-node-changed-3selection passes locally through CI's own runner, with its original target order andbun-allpolicy:Result: 212 tests passed (mailbox20, queue-receipt2, requester-wake51, admission-store16, registry-store-replaced11, registry103, agent-runner-core9); all seven invocations completed with zero failures. The seven wrapper durations total 322.36s on the local host. The earlier CI job took 174.38s for the same selection with four failures. Existing routing-registry guard: 12 tests passed in 2.69s. Targeted lint, agents-session test typecheck, formatting, and diff checks pass.
Exact-head CI run 40448822346 is green on
764ce8c9ef4604d6dc136d58ac2366706aa2e063: combined CI gate, security-sensitive review, and dependency review all succeeded; watcher confirms GREEN with zero pending checks. No CI rerun, dependency/config/budget/baseline change, recovery production edit, or gate waiver was used.