Skip to content

fix(agents): settle silent subagent completions quietly - #185388

Merged
steipete merged 3 commits into
mainfrom
codex/quiet-subagent-completion
Oct 27, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/quiet-subagent-completion

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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_REPLY or 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 returning NO_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, and git diff --check pass.

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-backed config/tsconfig/oxlint.core.json invocation 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:

OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1 node scripts/run-vitest.mjs src/agents/subagents/completion/subagent-completion-admission.expired-receipt.test.ts src/gateway/server-restart-sentinel.system-event-owner.test.ts src/gateway/server.subagent-settle-replay.harness.test.ts --pool=forks --maxWorkers=1

The five old assertions failed locally on 94881223e76220d52c051a45c5374b45a9538244 before this test repair. Affected agents and Gateway test typechecks, targeted core lint, formatting, and git diff --check also pass. Independent Codex branch review on 518e49d45bc0bf1f6326ecb40ebc59e47817aaf0 completed with scoped-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-3 selection passes locally through CI's own runner, with its original target order and bun-all policy:

OPENCLAW_NODE_TEST_TARGETS_JSON='[
  "src/agents/subagents/completion/subagent-completion-admission.mailbox.test.ts",
  "src/agents/subagents/completion/subagent-completion-admission.queue-receipt.test.ts",
  "src/agents/subagents/completion/subagent-completion-admission.requester-wake.test.ts",
  "src/agents/subagents/completion/subagent-completion-admission.store.test.ts",
  "src/agents/subagents/registry/subagent-registry.store-replaced.test.ts",
  "src/agents/subagents/registry/subagent-registry.test.ts",
  "src/auto-reply/reply/agent-runner-core.test.ts"
]' OPENCLAW_CI_TEST_RUNTIME_POLICY=bun-all OPENCLAW_NODE_TEST_VITEST_ARGS_JSON='[]' OPENCLAW_VITEST_SHARD_NAME=changed-3 OPENCLAW_VITEST_MAX_WORKERS=2 OPENCLAW_NODE_TEST_PLAN_CONCURRENCY=1 node --import tsx scripts/ci-run-node-test-shard.mts

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.

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.
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: L labels Oct 27, 2026
@steipete
steipete marked this pull request as ready for review October 27, 2026 03:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T04:19:02.644914Z 764ce8c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The completion can trigger missing-answer recovery and another model request.
  • After: The completion settles once, and the child result remains available without a new notice.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, net-negative repair with useful production-path regression coverage and no actionable finding; independent shipped-entry proof is not supplied.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its supplied in-process Gateway regression exercises spawning, completion processing, registry settlement, and retained child history across six scripted response scenarios.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Parents that quietly consume child findings can trigger redundant model turns and misleading blocked-delivery notices.
Reason: The maintainer-authored direction explicitly accepts quiet parent processing and inspectable failures, with a smaller implementation and retained user and child result obligations.

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
Reviewed head: 764ce8c9ef4604d6dc136d58ac2366706aa2e063

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied Gateway regression uses a scripted provider rather than an independent shipped-entry capture with a real model.
Agent review details

How this fits together

Child 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]
Loading

Technical review

Best 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

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned change and current-main comparison: The introduced production changes were reviewed against the verified merge base; the central production files on fetched main still match their merge-base versions. (src/agents/reply-completion.ts:71, e5aa4489f728)
  • Silent settlement preserves explicit failures: The new successful-silence branch follows delivery-failure handling and excludes aborted, yielded, and continuation-pending runs; visible output continues through receipt classification. (src/agents/subagents/announce/subagent-announce-direct-response.ts:151, 764ce8c9ef46)
  • Accepted behavior tradeoff: The maintainer-authored body explicitly accepts silent parent reviews even when completion guidance requests an answer, and retains actual failure details on the child instead of creating another parent input. (764ce8c9ef46)
  • Existing queued notices remain readable: The unchanged blocked-notice reader and restart-sentinel caller still recognize persisted producer identities and retire notices whose durable completion is delivered; removed receipts are runtime write acknowledgments, not a stored schema. (src/agents/subagents/completion/subagent-completion-delivery.ts:141, 764ce8c9ef46)
  • Human reply obligation retains its owner: Accepted human input still records its stronger obligation on the active run, and resolveReplyExpectation promotes completion policy from that recorded fact. (src/agents/embedded-agent-runner/run/attempt-stream-prepare.ts:455, 764ce8c9ef46)
  • Production-path regression coverage: The added Gateway test uses actual sessions_spawn, provider transport, announcement delivery, history reads, and registry publication for private and user-facing NO_REPLY, empty, and visible completions; the body reports the regression failing on base and passing with the fix. (src/gateway/server.subagent-silent-completion.product.test.ts:21, 764ce8c9ef46)

PR surface

Source -191, Tests -147, Docs +7. Total -331 across 20 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 6 28 219 -191
Tests 13 203 350 -147
Docs 1 11 4 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 242 573 -331

Review metrics

Metric Value Why it matters
Production versus test changes Production +28/-219; tests and support +202/-350 The reduction removes the retired notice producer and receipt machinery while adding a focused Gateway regression.

Labels

Label changes:

  • add P2: Unnecessary model continuations and misleading completion notices affect delegated workflows without establishing data loss or a core runtime outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Unnecessary model continuations and misleading completion notices affect delegated workflows without establishing data loss or a core runtime outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 27, 2026, 12:34 AM ET / 04:34 UTC.

@steipete
steipete merged commit 1aba44b into main Oct 27, 2026
157 checks passed
@steipete
steipete deleted the codex/quiet-subagent-completion branch October 27, 2026 06:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 27, 2026
)

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.
steipete added a commit that referenced this pull request Oct 27, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
)

* 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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
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.
obviyus added a commit that referenced this pull request Nov 10, 2026
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]>
amittell added a commit to amittell/openclaw that referenced this pull request Nov 11, 2026
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.
amittell added a commit to amittell/openclaw that referenced this pull request Nov 11, 2026
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.
amittell added a commit to amittell/openclaw that referenced this pull request Nov 11, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 11, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant