Skip to content

fix(agents): restore subagent QA fallback coverage - #185840

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-subagent-qa-empty-completion-direct-fallback-20261027
Oct 27, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-subagent-qa-empty-completion-direct-fallback-20261027

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #185388, #185667

What Problem This Solves

Repairs the subagent-empty-completion-recovery and subagent-completion-direct-fallback QA smoke fixtures, which still used empty parent output to trigger direct delivery.

User Impact

No runtime behavior changes. QA continues to prove exact-once failure notices and sanitized child-result delivery, plus no replay after restart, under the current completion contract.

Why This Change Was Made

These are stale fixture expectations after #185388, not a product regression. The documented announce contract allows ordinary parent completions to return empty text or NO_REPLY and settle quietly. #185667 preserves explicit child-result obligations without making ordinary parent completion output required. Both commits are ancestors of the reported CI evidence build 5efafd1f0de1.

The mock now produces visible parent text without sending it. That exercises the existing direct-message fallback: successful children deliver their original sanitized result, while a failed empty child produces the canonical system notice. The child remains empty and failed, with exactly one successful write. All executable scenario assertions remain intact. The associated ACK fixture now uses the current automation-result receipt shape, and stale command documentation agrees with the announce contract.

Evidence

Current-main runtime: 712a32e5d7761a3d6c721747d975da2e316bae34. Built once with OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build qaRuntime; base and candidate use that identical runtime through the real QA Lab runner, mock provider, and isolated local QA channel. Only the source mock fixture changes. The final rebase to ff7ab0a379a1 changes none of the QA Lab, scenario, or subagent owners exercised by this proof.

  • Baseline: 3/3 failures for each scenario, reproducing the missing system notice and public:visible timeout after 60 seconds.
  • Candidate: 3/3 passes for each scenario. Every direct-fallback run completed visible, silent, sanitized fallback, private-parent, and restart cases. Every empty-child run retained the failed outcome, exactly one successful write, exactly one system notice, and no replay after restart.
  • Regression before the repair: two mock completion expectations failed and four existing ACK cases failed on the retired receipt format; 125 other focused tests passed.
  • Focused candidate tests: 164/164 passed across five files (152.31s wrapper including compiler preparation). Targeted extension lint, documentation MDX, formatting, diff checks, and commit-hook gates passed.
  • Independent subagent review (autoreview route unavailable): clean through P2, including the final test-assertion simplification. Canonical autoreview refused the requested provider route because it did not match operator configuration; configuration was not changed.
  • Final focused regression replay: 3/3 selected cases passed (63.41s wrapper). Exact-head CI run 40494932609 is green on 82f654b8961b818716f5f8b5117a3404eff7c817: all four QA Smoke CI profiles, the full selected test/build/lint/ratchet checks, and openclaw/ci-gate passed. Profiles 2 and 4 include every sibling of the repaired scenarios. No CI rerun or gate exception was used.
Real QA Lab scenario Baseline Candidate
Empty completion recovery 0/3 pass; missing failure notice 3/3 pass
Direct completion fallback 0/3 pass; visible-case timeout 3/3 pass

Production runtime LOC delta: 0. Mock dispatcher LOC delta: 0; this is a QA contract repair, not a performance change, so allocation/CPU microbenchmarks and Gateway load tests do not apply. No Team access or Testbox lease was used.

The initial packaged-candidate bootstrap did not reach scenario execution; it was stopped and replaced with QA Lab's standard source-checkout plugin staging. This setup attempt is not counted as product proof.

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

@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-27T11:18:38.108376Z 82f654b PR opened
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: qa-lab size: XS labels Oct 27, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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-repro 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 uses visible unsent parent output to exercise completion fallback, updates the ACK receipt fixture, and aligns completion documentation.

Example: Run subagent-empty-completion-recovery after the child performs its write and returns no result.

  • Before: The mock parent returns empty text, settles quietly, and the scenario fails because its expected failure notice never arrives.
  • After: The mock parent returns visible unsent text, exercising fallback that sends exactly one canonical failure notice.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused contract repair with reported production-entry QA results, successful smoke checks, preserved assertions, and no actionable finding.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored fixture and documentation repair is outside the ordinary contributor proof gate; its body reports real QA Lab runner baseline/candidate results through an isolated Gateway and QA channel, and reviewed-head smoke checks succeeded.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Maintainers receive false smoke failures because QA fixtures no longer exercise the intended fallback path.
Reason: The maintainer-authored repair restores useful coverage without reverting the approved quiet-completion behavior or adding runtime machinery.

Merge readiness

✅ Ready for maintainer review

Keep this PR: it repairs stale QA fixtures against the current completion contract while preserving delivery, sanitization, and restart assertions; no introduced defect was found.

Priority: P2
Reviewed head: 82f654b8961b818716f5f8b5117a3404eff7c817

Before merge

None.

Findings

None.

Agent review details

How this fits together

QA Lab drives an isolated Gateway with a scripted provider and QA channel, then checks native subagent outcomes, outbound messages, delivery receipts, and restart behavior.

flowchart LR
  A[QA scenario runner] --> B[Isolated Gateway]
  B --> C[Native child run]
  D[Mock provider] --> C
  C --> E[Parent completion]
  D --> E
  E --> F[Existing direct fallback]
  F --> G[QA channel capture]
Loading

Technical review

Best possible solution:

Retain this focused fixture repair and the existing runtime owners, with ordinary exact-head CI gates controlling landing.

Do we have a high-confidence way to reproduce the issue?

Source inspection confirms the stale empty-parent trigger and obsolete ACK receipt; the author reports baseline failures, but this read-only review ran no reproduction.

Is this the best way to solve the issue?

The patch repairs the fixture producer and receipt input while preserving the independent end-to-end assertions, making it the smallest complete fix.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0f074a2ca7e3.

Provenance checked

  • Mock completion fallback trigger and scenario descriptions changes intended behavior with a stated reason (bd5f760: Empty output previously exercised missing-answer fallback under the required-result contract; the PR explicitly explains why the merged optional-parent contract requires visible unsent output instead.)
  • Completion delivery documentation changes intended behavior with a stated reason (751d109: Earlier documentation described blocked-notice retirement after recovery; the later quiet-completion change intentionally removed that notice producer.)
  • ACK fixture delivery receipt keeps the original intent (3fe7f1e: Confirmed outbound payloads now use the shared destination-history owner and automation-result receipt identity.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source 0, Tests +2, Docs 0, Other +2. Total +4 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 3 0
Tests 2 6 4 +2
Docs 1 3 3 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 6 4 +2
Total 6 18 14 +4

Labels

Label changes:

  • add P2: Stale fixtures produce false QA failures and prevent useful fallback validation, without changing user runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Stale fixtures produce false QA failures and prevent useful fallback validation, without changing user runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • 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, 7:31 AM ET / 11:31 UTC.

@steipete
steipete merged commit fc06d3c into main Oct 27, 2026
160 of 162 checks passed
@steipete
steipete deleted the steipete/fix-subagent-qa-empty-completion-direct-fallback-20261027 branch October 27, 2026 11:40
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: qa-lab P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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