Skip to content

fix(agents): record empty subagent completion delivery - #126179

Merged
steipete merged 2 commits into
mainfrom
steipete/subagent-empty-delivery-accounting
Aug 19, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/subagent-empty-delivery-accounting

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #126122
Related: #126075

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes a stacked regression where an empty-after-side-effect subagent completion visibly sent its terminal representation but never recorded delivery after #126075 made the underlying tool-bearing turn fail closed. The subagent-completion-direct-fallback QA scenario therefore timed out after 60 seconds on current main even though the outbound marker had committed.

This is the single follow-up commit discovered while rebasing and proving #126122. That PR was independently merged before this second repair could be added.

Why This Change Was Made

The incomplete-turn diagnostic from #126075 remains correct: a tool-bearing assistant turn without a later final reply is a failed execution. Delivery is a separate lifecycle fact, so a source-matched final message already committed through the message tool now settles the detached task as delivered even when automatic delivery diagnostics report failure.

The QA scenario now asserts both authoritative outcomes for the empty case: taskStatus: failed and taskDeliveryStatus: delivered. It continues to require exactly one terminal representation, no replay after restart, and no internal metadata leak.

Production LOC: +7/-5 (net +2). Tests/QA: +40/-7 (net +33). No protocol, config, storage, or schema changes.

AI-assisted: Codex. The implementation and evidence were inspected locally before publication.

User Impact

Operators still receive the correct incomplete-turn diagnostic for an empty side-effect-bearing subagent, while the terminal representation is delivered exactly once and the task ledger no longer remains pending.

No screenshot is attached because this is lifecycle accounting behind channel delivery. The repo-native QA scenario exercises the mock provider, ephemeral Gateway, transport boundary, task ledger, restart, and QA bus end to end.

Evidence

  • Current-main red control: the exact subagent-completion-direct-fallback run timed out twice after 60 seconds. Gateway logs showed the empty-case marker was sent, while the task remained unobservable through the scenario's completed-only delivery query.
  • Boundary red control: records a committed direct completion when the announce turn ends incomplete failed on current main with delivery.delivered: expected false to deeply equal true.
  • Exact latest-main QA proof: all five cases (visible, silent, fallback, restart, empty) passed. Empty recorded taskStatus: failed, taskDeliveryStatus: delivered, and one QA-SUBAGENT-TERMINAL-EMPTY-REPRESENTED send; restart replay/unexpected counts were zero.
  • PATH=/opt/homebrew/opt/node@24/bin:$PATH OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build qaRuntime — pass.
  • PATH=/opt/homebrew/opt/node@24/bin:$PATH node scripts/run-vitest.mjs src/agents/subagents/announce/subagent-announce-delivery.test.ts src/agents/subagents/announce/subagent-announce-delivery.runtime.test.ts src/agents/subagents/registry/subagent-gateway-context-binding.test.ts — pass, 3 files / 174 tests across 2 shards.
  • PATH=/opt/homebrew/opt/node@24/bin:$PATH pnpm check:changed — pass through the fail-safe all-lanes plan, including all typecheck, lint, dead-export, import-cycle, storage, and architecture guards.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output — clean; no accepted/actionable findings, patch judged correct at 0.98 confidence.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 19, 2026 04:14
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 19, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready for 8a11f2232ca52593d3c811faf95d4ff6302d8714:

  • Exact Node 24 private-QA build and subagent-completion-direct-fallback run passed all five cases. Empty-after-side-effect recorded taskStatus: failed, taskDeliveryStatus: delivered, and exactly one terminal representation.
  • Focused owner coverage passed: 3 files / 174 tests. The QA catalog contract passed 16/16.
  • pnpm check:changed passed its fail-safe all-lanes plan.
  • Fresh branch autoreview was clean with no accepted/actionable findings (0.98 confidence); the bounded CI test-only fix review was also clean (0.99).
  • Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/32215885365 is green after one failed-job rerun. The branch-owned catalog assertion was fixed; unrelated MCP refresh and browser handshake timing flakes were documented, and the browser flake passed on rerun.
  • Native review artifacts validated READY FOR /prepare-pr, 0 findings.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 126179 passed in hosted_exact_or_recent_parent mode and verified the remote tree.

This is the single follow-up discovered while rebasing merged PR #126122 over #126075. No protocol, config, storage, schema, docs, or changelog change is required.

@steipete
steipete merged commit dc37ed8 into main Aug 19, 2026
404 of 406 checks passed
@steipete
steipete deleted the steipete/subagent-empty-delivery-accounting branch August 19, 2026 04:46
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
* fix(agents): preserve delivery after incomplete completion

* test(qa): distinguish failed delivered completions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: qa-lab maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant