Skip to content

test(update): wait for child binding before reading probe receipts - #160545

Merged
steipete merged 1 commit into
mainfrom
deslop/l136-custody-fixture
Sep 28, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l136-custody-fixture

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The native-custody fixture reads the handoff database before waiting for the parent to commit its child PID/start binding. The legacy probe can therefore read an unbound row or fail on a competing SQLite transaction before writing its receipt.

User Impact

This changes the test fixture only. It preserves the capability payloads, native admission checks, process cleanup, lease assertions, and timeout budgets.

Why This Change Was Made

The process runner closes stdin only after synchronous child binding returns. The generated check branch now awaits that existing EOF barrier before inspecting the bound row. The shared wait also replaces the later duplicate wait in the without-backup branch. A missing receipt now reports the child status and stderr already captured by the fixture.

Found while validating #160038; kept separate from the provider refactor.

Evidence

  • CI job 108964509634 failed native command admits only the bound receiver: legacy / same with a missing probe receipt. A diagnostic replay of the original four-file shard and 20 focused legacy runs passed; the original intermittent error's stderr was not reproduced.
  • A controlled Linux comparison uses the exact generated fixture child and canonical PID/start binding, holds an exclusive SQLite transaction, and withholds EOF. The original child fails with database is locked before receipt/output. The corrected child observes stdin admission, waits for the transaction and EOF, then passes the original receipt assertions and emits byte-identical legacy capability JSON. Both controls passed. This proves the ordering defect under the forced conflict; it does not identify the unobserved stderr from the original CI failure.
  • The control uses IPC gates and real processes/lease rows, with the existing 20-second probe budget. No sleeps, polling, retries, or enlarged deadlines. An initial control-renderer failure (path binding omitted) occurred before spawning children; it was corrected before the comparison above.
  • Independent managed Codex review: scoped-clean through P2.
  • Blacksmith Testbox tbx_01m3m8ahpqznnmnqby3b2srrx2: 20 complete file runs passed, 340 cases. All three original four-file shard repetitions also passed (108 cases). The selected changed check stopped on the base's environment budget (484 names, budget 483); main already repairs it in 6e0d8aa1a0c. The branch was rebased patch-identically onto 4902e4ae49a669702b92a1df3aeb01b167ec6715. Blacksmith Testbox tbx_01m3md4chnndjk9rh6nwp209da then verified current head 83b0a6dcaa3311fa9db856b54e262aa47c862e64, tree a7778a77d59222cd803dcfa970e935df6e8b124a: the 17-case file, original 36-case shard, and all selected changed checks passed. Both leases are stopped. No budget exception is added here.

The original shard retains update-command-plugins.persistence.test.ts, doctor-output.process.test.ts, update-command-executor-native.test.ts, and update-command-service-custody.test.ts, using its captured CLI-process config, ordering, and worker selection. All commands run serially on the same owned Testbox through node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --id tbx_01m3m8ahpqznnmnqby3b2srrx2 --timing-json -- OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 ..., with frozen dependencies and verified source bytes.

pnpm test src/cli/update-cli/update-command-service-custody.test.ts --maxWorkers=1
node --import tsx scripts/ci-run-node-test-shard.mts
node scripts/check-changed.mjs --staged --base origin/main --timed -- src/cli/update-cli/update-command-service-custody.test.ts

Measured full-file wall cost across the 20 runs: median 14.39s, range 13.22–57.46s including cold preparation. The existing 17-case integration suite checks actual subprocess binding, rejection, cleanup, and lease retirement; no new cases or process boots were added. The larger cold invocation includes worker compilation; the existing real-process custody contract cannot be proved by an in-memory mock. The refreshed-head file command took 36.06s wall, including cold preparation. Exact-head CI passed all 17 cases in 52.00s from shard start to exit (Vitest 49.25s; 84% transformation and 14% test execution).

Repeated-run source: commit 4efc6fc04fcd7c8cd110cc87d833123671649448, tree 4944f87b28b4dad1ad8d3fd96f956abc83e202b1, fixture blob 563068e78bfea09d2cf1a2c1862cdd81d086b412. Current head: 83b0a6dcaa3311fa9db856b54e262aa47c862e64. The prior lease is stopped. The rebase also incorporates an existing retained-service cleanup simplification, covered by the refreshed full-file/shard run.

The completed current-head CI run passed 15 jobs. Only check-source-contracts and its aggregate gate failed, reporting repository-wide daemon export-name collisions. Current-head ClawSweeper review reports no findings and no before-merge requests. The identical nine collision names and file pairs failed on current unrelated PR #156389 at head 55f8c99eff33482cc412ea83a7825e1ed1b4ffa3, run 36451610368 / job 109028662733. The scanner explicitly excludes .test.ts files before building analyzed definitions/import/re-export sets, so this PR's only changed file cannot create the reported collisions. Its alias inventory is informational. Main already contains the exact owner repair 385ac2893544, verified as an ancestor of fresh main 73da00a20970e8883fbb8859cb03ec71fab166ae. No baseline or suppression is added.

Under the maintainer's explicit inherited-CI exception, landing is pinned to 83b0a6dcaa3311fa9db856b54e262aa47c862e64. This records the failed check and independent proof; it does not report green CI. No follow-up collision repair is needed because the owner repair is already on main.

Merged as 4aac6a64210c0a8a3ce591b4d17689bc32d34a9b under the documented inherited-CI exception. Fresh main contains that squash commit, and its fixture blob is exactly 563068e78bfea09d2cf1a2c1862cdd81d086b412, matching the tested source.

Await the existing EOF admission barrier before the synthetic capability probe reads its bound lease row. Keep every payload and custody assertion, and include captured child diagnostics when a receipt is missing.
@clawsweeper

clawsweeper Bot commented Sep 28, 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 cli CLI command changes size: XS labels Sep 28, 2026
@steipete
steipete marked this pull request as ready for review September 28, 2026 16:26
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 12:33 PM ET / 16:33 UTC (Revision 2).

ClawSweeper review

What this changes

The branch makes the native update-custody test wait for child binding before reading its SQLite probe receipt and adds captured child diagnostics when the receipt is missing.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still has the probe-ordering race, and this focused test repair remains useful. No introduced correctness defect was found.

Priority: P3
Reviewed head: 83b0a6dcaa3311fa9db856b54e262aa47c862e64

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture fix has credible real-process proof and no identified patch defect; the original intermittent CI failure was not directly diagnosed.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The changed native probe waits on the production runner's child-input admission boundary. The captured PR body reports a real Linux child and SQLite-lock before/after comparison, with the corrected fixture completing the original receipt assertions, plus repeated full-file and shard runs. The original intermittent CI stderr remains unknown. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed native probe waits on the production runner's child-input admission boundary. The captured PR body reports a real Linux child and SQLite-lock before/after comparison, with the corrected fixture completing the original receipt assertions, plus repeated full-file and shard runs. The original intermittent CI stderr remains unknown. No stored-data contract changes.
Evidence reviewed 6 items Introduced change: The only introduced file moves the existing stdin EOF wait ahead of the generated probe's SQLite read and adds failure diagnostics without changing production code.
Current-main gap: Current main's generated check branch reads the handoff database before waiting for EOF; only the later without-backup branch waits.
Binding boundary: The capability check passes child binding as synchronous input admission; the process runner calls that admission before ending child stdin.
Findings None None.
Security None None.

How this fits together

OpenClaw's update CLI checks a child process's capabilities before service-update work. The custody test compares that child's recorded lease and process identity with the result returned to the updater.

flowchart LR
A[Update custody test] --> B[Spawn capability child]
B --> C[Bind child identity]
C --> D[Close child input]
D --> E[Read lease and write receipt]
E --> F[Assert custody result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +8. Total +8 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 11 3 +8
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 11 3 +8

Review metrics

Metric Value Why it matters
Test cost 17 existing cases, 0 added; 14.39 s median file wall time over 20 reported runs The fixture repair adds no test cases or process boots to this real-process suite.

Technical review

Best possible solution:

Keep the native-custody suite deterministic while preserving its real child-process, lease-identity, cleanup, and timeout assertions.

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

Yes. Current-main source permits the probe to read before child binding, and the PR describes a controlled SQLite-lock reproduction through the real process runner; I did not execute it in this read-only review.

Is this the best way to solve the issue?

Yes. The fixture uses the runner's existing EOF admission barrier at the point of its premature read, without changing production update behavior or weakening custody assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ad7669535c37.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a narrow reliability repair to a test fixture, with no changed user-facing update 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. Sufficient (terminal): The changed native probe waits on the production runner's child-input admission boundary. The captured PR body reports a real Linux child and SQLite-lock before/after comparison, with the corrected fixture completing the original receipt assertions, plus repeated full-file and shard runs. The original intermittent CI stderr remains unknown. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed native probe waits on the production runner's child-input admission boundary. The captured PR body reports a real Linux child and SQLite-lock before/after comparison, with the corrected fixture completing the original receipt assertions, plus repeated full-file and shard runs. The original intermittent CI stderr remains unknown. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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-28T16:25:42.362Z sha 83b0a6d :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 4aac6a6 into main Sep 28, 2026
175 of 181 checks passed
@steipete
steipete deleted the deslop/l136-custody-fixture branch September 28, 2026 17:16
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…penclaw#160545)

Await the existing EOF admission barrier before the synthetic capability probe reads its bound lease row. Keep every payload and custody assertion, and include captured child diagnostics when a receipt is missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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