Skip to content

fix: wait for child admission before Stop assertions - #149998

Merged
steipete merged 1 commit into
mainfrom
codex/settle-private-completion-wait-20260916
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/settle-private-completion-wait-20260916

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #149124, #149853, #149971

What Problem This Solves

The Stop/restart regression can fail before Stop when the child's completion wait starts after its global polling deadline.

User Impact

CI exercises the real child cancellation after the matching completion observation is admitted. The existing abort-signal, terminal outcome, tombstone, retry, restart, and command-count assertions remain.

Why This Change Was Made

Observe the existing agent-job wait for the exact descendant and return its original promise unchanged. Wait for that admission signal before Stop, release the barrier on test cancellation, and restore the observation during owned cleanup.

This preserves the real child producer already on main. It adds no production seam or manually published terminal outcome.

Evidence

  • On official main a5c1e4440840, the complete file passed 20 cases and failed this case before Stop: both producers were live, but the global wait poll expired.
  • The updated file passes all 21 cases in their original order with matching frozen dependencies (fs-safe 0.12.0, Node 24.21.0). Cold and warm run durations are not treated as a performance comparison.
  • Changed checks, the affected Gateway test-type graph, formatting, and fresh independent P2 review pass. No timeout, retry, baseline, or assertion was relaxed. Exact-head CI and native preparation pass for df55db43bcaa.

@clawsweeper

clawsweeper Bot commented Sep 16, 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 gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 11:01
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 7:52 AM ET / 11:52 UTC (Revision 2).

ClawSweeper review

What this changes

The Gateway Stop regression test waits for the matching child’s completion observer before asserting cancellation, and releases that barrier during test cancellation.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, focused test repair absent from the reviewed main revision. No actionable correctness findings remain, and the maintainer-protected PR is not a cleanup candidate.

Priority: P3
Reviewed head: df55db43bcaa4903b081198c9d0b01f03483728f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused synchronization repair preserves meaningful assertions and cleanup, with reported before/after test validation and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR changes only test synchronization; its reported full-file run exercises real Gateway admission and receipts with a controlled agent command, and no production authority boundary changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR changes only test synchronization; its reported full-file run exercises real Gateway admission and receipts with a controlled agent command, and no production authority boundary changes.
Evidence reviewed 7 items Introduced change and main comparison: The merge-base-to-head diff replaces the global work-holder poll with a descendant-specific observation barrier. The test file is unchanged between the merge base and fetched main; the verified test-merge comparison changes only this test file.
Barrier preserves the production wait: The spy calls the original wait before resolving the barrier and returns its original promise. The production wait registers its waiter synchronously before yielding; the test keeps the child running until Stop. Cancellation releases the barrier, and finally restores the spy before joining both producers.
Completion owner and call path: The agent.wait handler delegates through the agent-turn service to waitForAgentJob, which registers and removes real completion observers. The patch changes neither this owner nor its authorization, terminal-state, or timeout behavior.
Findings None None.
Security None None.

How this fits together

The Gateway tracks agent execution and completion while subagent registration starts a completion observer. This test checks that stopping a parent cancels its child and preserves the stopped outcome across retries and Gateway restarts.

flowchart TD
  A[Parent and child execution] --> B[Register child]
  B --> C[Real completion observer]
  C --> D[Test admission barrier]
  D --> E[Stop parent]
  E --> F[Check cancellation and restart receipts]
  G[Test cancellation] --> H[Release barrier and join producers]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +16. Total +16 across 1 file.

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

Review metrics

None.

Technical review

Best possible solution:

Keep the real child and completion observer, synchronize Stop with the matching observer’s admission, and retain all durable cancellation and restart assertions.

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

No independently verified deterministic reproduction was run. Source supports the timing-sensitive global-poll failure, and the PR reports a failing original-order main run followed by 21 passing cases.

Is this the best way to solve the issue?

Yes. Observing the existing wait for the exact descendant preserves real execution and cancellation while avoiding a global polling deadline and unrelated work-holder matches.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a bounded test-synchronization repair with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR changes only test synchronization; its reported full-file run exercises real Gateway admission and receipts with a controlled agent command, and no production authority boundary changes.

Evidence

What I checked:

  • Introduced change and main comparison: The merge-base-to-head diff replaces the global work-holder poll with a descendant-specific observation barrier. The test file is unchanged between the merge base and fetched main; the verified test-merge comparison changes only this test file. (src/gateway/server.private-completion.test.ts:552, df55db43bcaa)
  • Barrier preserves the production wait: The spy calls the original wait before resolving the barrier and returns its original promise. The production wait registers its waiter synchronously before yielding; the test keeps the child running until Stop. Cancellation releases the barrier, and finally restores the spy before joining both producers. (src/gateway/server.private-completion.test.ts:554, df55db43bcaa)
  • Completion owner and call path: The agent.wait handler delegates through the agent-turn service to waitForAgentJob, which registers and removes real completion observers. The patch changes neither this owner nor its authorization, terminal-state, or timeout behavior. (src/gateway/agent-turn/agent-job.ts:648, df55db43bcaa)
  • Merged fixture history: GitHub’s commit patch connects steipete’s prior merged work to the real-child fixture preserved here. fix: preserve Windows credential reads with fs-safe 0.12.0 #149124 supplied that fixture, not this new barrier. Local history also identifies earlier private-completion work by Jason (Json) and Vincent Koc; full blame traversal was unavailable because an older object could not be read. (src/gateway/server.private-completion.test.ts:523, c7ea115c3e56)
  • Reported validation and review continuity: The complete supplied PR body reports the original-order file run failing before Stop on main and all 21 cases passing afterward with frozen dependencies. This is reported test validation, not independently executed proof. The previous completed review retained no findings or published rank-up moves; its earlier head object was unavailable for comparison. (df55db43bcaa)
  • Related failure is context, not supersession: The merged metadata repair fix: keep chat metadata loading during unrelated session writes #149853 records a Stop/restart fixture failure and successful same-head rerun, but does not implement this barrier. The open conversation-list repair fix: keep conversation list reads from blocking the gateway #149971 addresses a separate read-performance problem.

Likely related people:

  • 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 (1 earlier review cycle)
  • reviewed 2026-09-16T11:07:33.027Z sha 2b41692 :: needs maintainer review before merge. :: none

Await the matching descendant wait through its existing API, retaining the real child producer and all cancellation and restart assertions. Release the barrier on test cancellation and restore observation before producer cleanup.
@steipete
steipete force-pushed the codex/settle-private-completion-wait-20260916 branch from 2b41692 to df55db4 Compare September 16, 2026 11:45
@steipete steipete changed the title fix: settle synthetic child waits in Stop and restart tests fix: wait for child admission before Stop assertions Sep 16, 2026
@steipete
steipete merged commit a1856c3 into main Sep 16, 2026
111 checks passed
@steipete
steipete deleted the codex/settle-private-completion-wait-20260916 branch September 16, 2026 12:22
@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 17, 2026
Await the matching descendant wait through its existing API, retaining the real child producer and all cancellation and restart assertions. Release the barrier on test cancellation and restore observation before producer cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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