Skip to content

fix(subagents): preserve private completions across parent yield - #148405

Merged
steipete merged 1 commit into
mainfrom
codex/fix-private-completion-yield-handoff
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-private-completion-yield-handoff

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A private child result that finishes before its parent calls sessions_yield can start an obsolete continuation and report subagent source lifecycle changed before completion delivery as a failed parent turn.

User Impact

Parents process private results without a false run-failure notice. Finished private children also resume after a normal parent response without waiting for unfinished siblings. Existing task identity, privacy, cancellation, and restart contracts are preserved; no configuration or migration is required.

Why This Change Was Made

The registry retains private results until the spawning turn settles, then uses the existing individual review or yielded-batch owner. Late announcement failures cannot rewrite transferred delivery state, while confirmed sends retain their receipts. This keeps the handoff within the existing lifecycle instead of adding another queue or cancellation controller.

Related: #147206, #147571, #146667.

Evidence

  • A real isolated Gateway with a scripted local Responses provider reproduced the exact failure before the fix. The final regression passes with one result-processing inference, one successful durable processing receipt, fully settled delivery, and no chat error. All three requester-owner E2E cases pass, including requester isolation and restart recovery.
  • All three new lifecycle regressions fail on the original production source. The candidate passes 280 lifecycle, requester-yield, persistence, and parent-recovery tests, including late committed sends and a finished private child beside an unfinished sibling.
  • Full changed-file checks, candidate QA runtime build, deslop, and independent Codex P2 review passed. This is synthetic provider proof, not a production deployment or live external-provider test.
  • Exact-head CI passed for e7de4902fbd5: the native watcher reported GREEN with zero pending checks. ClawSweeper reviewed the same head with no findings or remaining before-merge items.

The initial CI run stopped at a duplicate test registration on main. A later run passed all other execution jobs but exposed a stale Custodian test selector. Main now contains the fixes in #148425 and #148444.

The current branch contains only the original subagent commit, replayed onto main at b8de9f88996b. The temporary #148403 dependency and its catalog deletion are removed. The subagent patch remains identical by git range-diff, and the test registry matches main byte-for-byte.

@clawsweeper

clawsweeper Bot commented Sep 14, 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.

@steipete steipete self-assigned this Sep 14, 2026
@steipete
steipete marked this pull request as ready for review September 14, 2026 17:14
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 3:19 PM ET / 19:19 UTC (Revision 5).

ClawSweeper review

What this changes

The PR preserves private subagent results until the parent turn settles, prevents late announcement failures from overwriting yielded-batch delivery, and adds regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on the reviewed main revision. No actionable correctness or security findings remain, and the previous stacking prerequisite no longer applies.

Priority: P2
Reviewed head: e7de4902fbd503a663a46c19394285ed7413e2cb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant production-boundary proof and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured proof reports the actual Gateway and OpenClaw runtime processing a scripted child-before-yield scenario through real RPC and HTTP boundaries, with one successful processing receipt and no false parent error afterward; source inspection matches that scenario. This is isolated synthetic-provider proof, not an external-provider deployment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured proof reports the actual Gateway and OpenClaw runtime processing a scripted child-before-yield scenario through real RPC and HTTP boundaries, with one successful processing receipt and no false parent error afterward; source inspection matches that scenario. This is isolated synthetic-provider proof, not an external-provider deployment.
Evidence reviewed 8 items Private completion admission: The new guard defers private announcement admission while requesterTurnRunId remains bound. The reviewed main source lacks this guard, so the central repair is still unique to this branch.
Settlement and late-callback handling: Settlement persists the existing batch before resuming finished private children, including when siblings remain active. Cleanup fences late failed announcements while retaining committed delivery evidence.
Production-boundary regression proof: The captured PR body reports an isolated real Gateway using a scripted local Responses server: the original race failed before the fix, then produced one result-processing inference, one successful durable receipt, settled delivery, and no chat error. The inspected E2E test exercises agent RPC, sessions_spawn, child completion, subagents inspection, and sessions_yield through that runtime. Tests were not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

OpenClaw’s subagent registry retains worker results and coordinates their return to the parent agent. Parent settlement chooses individual private review or a combined continuation after an explicit yield.

flowchart TD
  A[Child finishes] --> B[Registry retains private result]
  B --> C[Parent turn settles]
  C -->|Normal finish| D[Individual private review]
  C -->|Explicit yield| E[Frozen child batch]
  E --> F[Parent continuation]
  D --> G[Recorded delivery outcome]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +40, Tests +280, Docs +10. Total +330 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 46 6 +40
Tests 3 286 6 +280
Docs 2 11 1 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 343 13 +330

Review metrics

Metric Value Why it matters
Production versus regression coverage production +40 net lines; tests +280 net lines Production growth implements bounded admission and callback fencing within existing owners; regression coverage exercises the timing failure and durable outcome.

Technical review

Best possible solution:

Keep private results under one settlement owner while preserving requester identity, successful receipts, and the existing restart recovery path.

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

Yes: finish a private child before its spawning parent calls sessions_yield. The source and reported before/after Gateway run establish the race; this review did not execute it.

Is this the best way to solve the issue?

Yes: the patch fixes admission and settlement in the existing registry owners without adding another queue, changing public configuration, or modifying stored formats.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded private-subagent completion race that can falsely report parent failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured proof reports the actual Gateway and OpenClaw runtime processing a scripted child-before-yield scenario through real RPC and HTTP boundaries, with one successful processing receipt and no false parent error afterward; source inspection matches that scenario. This is isolated synthetic-provider proof, not an external-provider deployment.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured proof reports the actual Gateway and OpenClaw runtime processing a scripted child-before-yield scenario through real RPC and HTTP boundaries, with one successful processing receipt and no false parent error afterward; source inspection matches that scenario. This is isolated synthetic-provider proof, not an external-provider deployment.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-14T17:55:26.202Z sha 451663645f1034581c231dc13f22e4b699c48cf5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T18:38:39.327Z sha 687bce91efc3b0a505da2aa6da1edf0f29b3cfd3 :: needs changes before merge. :: none
  • reviewed 2026-09-14T18:53:08.664Z sha 687bce91efc3b0a505da2aa6da1edf0f29b3cfd3 :: needs changes before merge. :: none
  • reviewed 2026-09-14T19:10:22.287Z sha 397f7cad48f79175c0f497e0889f8c99274ca125 :: needs changes before merge. :: none

@steipete
steipete force-pushed the codex/fix-private-completion-yield-handoff branch 2 times, most recently from 687bce9 to 397f7ca Compare September 14, 2026 19:01
Keep private results under the spawning turn until it settles, then resume
individual review or the existing yielded batch. Fence late failed announcements
without discarding committed delivery receipts.

The real Gateway regression reproduces the false parent failure before this
change and passes with one processed result afterward. Three requester-owner
E2E cases, 280 lifecycle/recovery tests, and changed-file checks pass.

Related: #147206, #147571, #146667.
@steipete
steipete force-pushed the codex/fix-private-completion-yield-handoff branch from 397f7ca to e7de490 Compare September 14, 2026 19:12
@steipete
steipete merged commit 523973a into main Sep 14, 2026
197 checks passed
@steipete
steipete deleted the codex/fix-private-completion-yield-handoff branch September 14, 2026 20:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
…nclaw#148405)

Keep private results under the spawning turn until it settles, then resume
individual review or the existing yielded batch. Fence late failed announcements
without discarding committed delivery receipts.

The real Gateway regression reproduces the false parent failure before this
change and passes with one processed result afterward. Three requester-owner
E2E cases, 280 lifecycle/recovery tests, and changed-file checks pass.

Related: openclaw#147206, openclaw#147571, openclaw#146667.
steipete added a commit that referenced this pull request Sep 15, 2026
Remove unused internal announcement inputs, consolidate dispatch and requester
preference lookup, and inline single-use replacement and result-selection wrappers.
Keep public harness idempotency, routing, authority, receipt, and retry contracts.

Validated with 904 focused tests, three real-Gateway requester-owner scenarios,
full changed checks, QA runtime build, deslop, and independent P2 review.

Related: #148405.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
Remove unused internal announcement inputs, consolidate dispatch and requester
preference lookup, and inline single-use replacement and result-selection wrappers.
Keep public harness idempotency, routing, authority, receipt, and retry contracts.

Validated with 904 focused tests, three real-Gateway requester-owner scenarios,
full changed checks, QA runtime build, deslop, and independent P2 review.

Related: openclaw#148405.
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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