Repository navigation
test(update): wait for child binding before reading probe receipts - #160545
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 12:33 PM ET / 16:33 UTC (Revision 2). ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherOpenClaw'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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +8. Total +8 across 1 file. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…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.
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
native command admits only the bound receiver: legacy / samewith 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.database is lockedbefore 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.pathbinding omitted) occurred before spawning children; it was corrected before the comparison above.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 in6e0d8aa1a0c. The branch was rebased patch-identically onto4902e4ae49a669702b92a1df3aeb01b167ec6715. Blacksmith Testboxtbx_01m3md4chnndjk9rh6nwp209dathen verified current head83b0a6dcaa3311fa9db856b54e262aa47c862e64, treea7778a77d59222cd803dcfa970e935df6e8b124a: 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, andupdate-command-service-custody.test.ts, using its captured CLI-process config, ordering, and worker selection. All commands run serially on the same owned Testbox throughnode 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.tsMeasured 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, tree4944f87b28b4dad1ad8d3fd96f956abc83e202b1, fixture blob563068e78bfea09d2cf1a2c1862cdd81d086b412. 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-contractsand 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 head55f8c99eff33482cc412ea83a7825e1ed1b4ffa3, run 36451610368 / job 109028662733. The scanner explicitly excludes.test.tsfiles 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 repair385ac2893544, verified as an ancestor of fresh main73da00a20970e8883fbb8859cb03ec71fab166ae. 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
4aac6a64210c0a8a3ce591b4d17689bc32d34a9bunder the documented inherited-CI exception. Fresh main contains that squash commit, and its fixture blob is exactly563068e78bfea09d2cf1a2c1862cdd81d086b412, matching the tested source.