Repository navigation
fix(test): release-gated fixtures still poll release files; add release and exit receipts to the fixture receipt helper - #163063
Conversation
Extend the shared fixture receipt channel with retained socket releases and connection-close exit observation, plus POSIX FIFO releases for blocked shell fixtures. Keep ordinary receipt sends unref'd and tie release waits to fixture liveness. Convert the remaining release-blocked progress, report, workspace, preflight, scanner, PTY, checkout, and maintenance fixtures without changing product source, product deadlines, or existing assertion meanings. Validate with real-process helper tests, delayed original/fixed fault probes, forced-abort cleanup proofs, 180 standalone runs, and 30 owning-shard replays. Native process-group extinction remains on its existing census contract.
|
🦞👀 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 October 1, 2026, 6:56 PM ET / 22:56 UTC. ClawSweeper reviewWhat this changesThe PR replaces timed file polling in test fixtures with retained socket releases, connection-close exit observations, and POSIX FIFO gates. Merge readiness✅ Ready for maintainer review Keep open: current main still lacks these fixture coordination changes, and the branch contains useful, bounded work with convincing process-level evidence. No blocking correctness or security finding was identified. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's test fixtures run children through real process and tooling owners. The shared receipt channel lets tests observe readiness and control progression without taking over product-owned input or output. flowchart LR
A[Test controller] --> B[Shared fixture channel]
C[Fixture child] -->|Readiness receipts| B
B -->|Retained releases| C
A --> D[POSIX FIFO gate]
D --> E[Shell fixture]
C --> F[Real process and tooling owner]
E --> F
F --> G[Outcome and cleanup assertions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +573. Total +573 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing fixture channel for deterministic progression while preserving durable assertions, process-owner cleanup, and stronger native extinction checks. Do we have a high-confidence way to reproduce the issue? Yes: current-main fixtures visibly race healthy child work against short file-polling deadlines, and the inspected proof body records original/fixed injected-delay failures and recovery. This read-only review did not execute them independently. Is this the best way to solve the issue? Yes: extending the existing test-owned channel removes the scheduling races without new production seams or weaker native process assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 37a8f3486209. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…se and exit receipts to the fixture receipt helper (openclaw#163063) Tests whose fixtures had to be told to proceed, or whose fixture exit could not be observed, still polled generated release and readiness files against 3-15 s wall-clock deadlines and failed on loaded hosts: the Vitest progress and report-owner alpha/beta fixtures, node-host workspace retention, release preflight scheduling, the upgrade-survivor systemd PTY startup gate, check-deadcode reporting (scanner barrier, compiler start/drain), and the PR git-maintenance hook. The shared fixture receipt helper (test/helpers/fixture-receipts.ts) was one-way, so these sites were left on file-polling loops in earlier batches. It now owns both directions instead of a second broker: release(source, token) sends a retained release over the existing socket to connections associated with the source, and fixtures call awaitRelease(source, token), which keeps the fixture alive only while a release is pending; waitForExit(source) resolves when every connection that announced the source has closed (Node sockets are close-on-exec, so close means process exit for a fixture that never ends its socket); openFixtureReleaseFifo gives shell fixtures and synchronously blocked callers a POSIX FIFO release with no polling. A new test/helpers/fixture-receipts.test.ts covers exit receipts (normal exit, SIGKILL, late callers), release before and after the fixture waits, FIFO release of a shell child, close rejecting pending waits, and malformed input. The CI checkout backoff site was retired upstream by openclaw#162925. No product source, test timeout, product timeout, or assertion meaning changed. Part of the polling audit from openclaw#162274. Proof on Blacksmith Testbox: original/fixed delay probes and forced-abort probes for each new waiting pattern, 80/80 standalone runs on the rebased head (20 per file including the helper test), 9/9 owning-shard replays, OpenGrep, deadcode, type-aware lint, base-aware timeout-race ratchet; Codex autoreview focused on the helper contract and ClawSweeper clean.
What Problem This Solves
Fixes: tests whose fixtures had to be told to proceed (a "release") or whose fixture exit could not be observed still polled generated release files and readiness files against 3–15 s wall-clock deadlines and failed on loaded hosts: the Vitest progress and report-owner alpha/beta fixtures, node-host workspace retention, release preflight scheduling, the upgrade-survivor systemd PTY startup gate, check-deadcode reporting (scanner barrier, compiler start/drain), and the PR git-maintenance hook.
User Impact
No user-visible change. These suites stop failing spuriously on slow machines; a fixture that never becomes ready now fails at its owning step or the Vitest test timeout.
Why This Change Was Made
Part of the polling audit from #162274. The shared fixture receipt helper (
test/helpers/fixture-receipts.ts) was one-way: product-spawned fixtures could report to the test, but the test could not release a waiting fixture or observe the exit of a fixture whose process handle is private to product code, so these sites were left on file-polling loops in earlier batches. The helper now owns both directions, instead of a second broker:release(source, token)sends a retained release over the existing socket to connections associated withsource; fixtures callawaitRelease(source, token), which keeps the fixture alive only while a release is pending.waitForExit(source)resolves when every connection that announcedsourcehas closed. Node sockets are close-on-exec, so for a fixture that never ends its socket, close means process exit.openFixtureReleaseFifo(directory, name)gives shell fixtures and synchronously blocked callers a POSIX FIFO release (read -r _ < "$FIFO") with no polling.New
test/helpers/fixture-receipts.test.tscovers exit receipts (normal exit and SIGKILL, late callers), release before and after the fixture waits, FIFO release of a shell child, close rejecting pending waits, and malformed input. The CI checkout backoff site from the original list was retired upstream by #162925, which moved that cancellation into the Python owner. Remaining checkout extinction polls observe native Bash/Python owners or zombie-reaping contracts that socket close cannot prove, and stay unchanged. No product source, test timeout, product timeout, or assertion meaning changed.Release-note context: test-only change, no user-visible behavior change.
Per-site conversions
Old line numbers below are from the pinned base, rather than older-main approximations.
test/scripts/run-vitest-progress.test.ts:106test/scripts/vitest-report-fixture.ts:223beta.donefile wait, 15 ssrc/node-host/node-worker-workspace-retention.test.ts:588:591vi.waitFor, 1 stest/scripts/release-preflight.test.ts:66test/scripts/upgrade-survivor-systemd.test.ts:574test/scripts/check-deadcode-reporting.test.ts:54test/scripts/fixtures/ci-platform-checkout.mjs:476test/scripts/pr-git-maintenance.test.ts:97Stops, residuals, and deliberately unconverted sites
Compiler-start and compiler-drain barriers are absent from
check-deadcode-reporting.test.tsat both pinned base and fetched origin/main. The file has only the scanner barrier. No substitute sites were added.Remaining checkout extinction polls observe native Bash/Python owners, pre-registration actors, or zombie/reaped process-group contracts. Node socket closure cannot prove these outcomes; replacing them would weaken assertions or require out-of-scope/native product seams. They remain unchanged. The remaining workspace
vi.waitForobserves product supervisor state, not authored fixture readiness or exit.vitest-report-owner.test.ts,ci-platform-checkout.test.ts, andci-checkout.test-support.tsrequired no edits. Their consumer proof remains included. Actual backoff consumers areci-git-owner.test.tsandopenclaw-performance-git-lifecycle.test.ts; they are additionally selected for focused proof and owning shards.Native group extinction remains intentionally stronger than socket closure. Socket and FIFO behavior was live-tested on Linux Testbox; no Windows-native proof was run. Named-pipe handling remains in the shared socket path, and FIFO-using tests retain explicit Windows skip guards.
Evidence
All proof ran on Blacksmith Testbox through
node scripts/crabbox-wrapper.mjsone-shot runs; no local Vitest.Standalone repetitions (flake-triage bar)
All nine files passed 20/20 runs, 180 total. Command:
CI=1 pnpm test <file> --maxWorkers=1. Candidate repetitions used at most four different files concurrently, one invocation per file, with distinct filesystem module caches. Baseline was one serial run per file, so these are observed costs under different load/cache conditions, not a controlled speed comparison. All cost values below are wall seconds.test/helpers/fixture-receipts.test.tstest/scripts/run-vitest-progress.test.tssrc/node-host/node-worker-workspace-retention.test.tstest/scripts/release-preflight.test.tstest/scripts/vitest-report-owner.test.tstest/scripts/upgrade-survivor-systemd.test.tstest/scripts/check-deadcode-reporting.test.tstest/scripts/ci-platform-checkout.test.tstest/scripts/pr-git-maintenance.test.tsThe new helper file meets the requested <3 s standalone target on all 20 measured runs. Both actual checkout backoff consumers also passed
-t backoff(2.883 s and 2.824 s). The existing longer integration files preserve their native process/PTY/worker contracts; the new helper itself adds no real timers, sleeps, or polling.Proof (from the lane report)
180/180 standalone runs, 30/30 owning-shard replays, both actual backoff consumers, both owning tsgo lanes, graph boundary, deadcode, OpenGrep, ratchet, formatting, and whitespace checks completed. The changed TypeScript files pass type-aware lint. The MJS fixture's 32 lint diagnostics are inherited, with every location mapped to byte-identical origin/main code; see
fifo-checkout-mjs-lint-baseline-map.jsonand its log. They were not suppressed or broadened into this lane.All Vitest execution was Blacksmith Testbox, Linux/Node 24.19.0. No local Vitest, local dependency installation, browser automation, direct credential-store inspection, or key retrieval was performed. Every proof execution used a fresh one-shot wrapper, with no lease-reuse
--idor kept warmup. One failed read-only download diagnostic used--id; details are explicit below.Proof command shape:
Payloads and logs are retained beside this report:
residual-a-baseline.sh,residual-a-probes.sh,residual-a-full-proof.sh,residual-a-finish-proof.sh,residual-a-opengrep.sh, and matching logs. The wrapper was never piped; source edits were held while capsules froze.The full planner used
createNodeTestShardBundleswith release-only plugin/tooling/runtime, PR-exempt runtime, and proof inclusion enabled. Exact selected groups/commands are inresidual-a-plan.json. Each replay used:OPENCLAW_NODE_TEST_GROUPS_JSON='[group]' CI=1 node --import tsx scripts/ci-run-node-test-shard.mtscore-unit-fast-2core-tooling-1core-tooling-14core-tooling-15core-tooling-16core-tooling-2core-tooling-3core-tooling-8core-tooling-9bundle-infra-small-runtime-17node scripts/check-changed.mjs --dry-run --base origin/mainselectedcoreTests,testRoot, andtooling; the owning type lanes werepnpm tsgo:core:testandpnpm tsgo:test:root.pnpm lint:tmp:tsgo-core-boundarypnpm tsgo:core:testpnpm tsgo:test:rootpnpm deadcode:fullnode --import ./scripts/tsx.mjs scripts/check-test-timeout-race-ratchet.mts --base origin/maingit diff --checkscripts/run-opengrep.sh --changed --sarif --errorLocal
oxfmt --checkpassed on all ten changed files. Final type-aware commands exited 0:OpenGrep was initially absent on Testbox and the Mac. The final one-shot provisioned the exact CI-pinned v1.30.0 Linux binary and verified SHA-256
35779bdd72e92129c8df2a77f0c55e8c08356801ea92591ef32108d6b28d564c. The canonical changed scan reported 104 rules on one source test file, zero findings, and one ignore notice; roottest/paths retain the repository's normal scope/exclusions. The actual SARIF isopengrep.sarif; no ignore or rule changes were made.Original/fixed and forced-abort probes
Probe lease
tbx_01m3w58tr3jvz256g59238ff1p, run, wrapper exit 0 and stopped. Original source bytes loaded from the pinned Git commit were SHA-256 checked against captured origin/main bytes before mutation. Exact payload isresidual-a-probes.sh, full outputresidual-a-probes-4.log, machine countsfault-summary.json. Every mutation was applied identically and restored byte-exactly on both versions.expected false to be trueat readiness assertionReady work did not start while another command held a worker0.completed/scan produced no export sectionsafter barrier expirytimeout waiting for .../release-0maintenance gate was not releasedTimed out waiting for backoff cancellation acknowledgementThe deadline errors in workspace/scanner/shell cases are surfaced by the existing assertion/marker diagnostics, rather than a newly added message. The report-fork real-delay probe remains infeasible under its unchanged 5 s timeout as documented above.
Three temporary tests used explicit 1 s Vitest timeouts. Each produced the first-finally marker and joined child close, then verified
process.kill(pid, 0)threwESRCH:The expected three timeout failures were the only forced-abort failures; command exit 1 was required. No fixture child remained alive. The test file was restored before final proof. The helper's eight-case smoke passed at 1.540 s wall (446 ms Vitest duration); final repeated cost follows below.
Investigation history: two remote command transport attempts were too large (382 KB, then 114 KB), the latter proving
/bin/bash: Argument list too long. Reduced payload is 11 KB by loading Git originals plus SHA checks. The first executing helper smoke caught incorrect use ofit.eachfor context-bearing parameterized tests. These cases now useit.for; the corrected smoke and all fault probes passed. No helper runtime workaround was needed.Standalone walls
All nine files passed 20/20 runs, 180 total. Command:
CI=1 pnpm test <file> --maxWorkers=1. Candidate repetitions used at most four different files concurrently, one invocation per file, with distinct filesystem module caches. Baseline was one serial run per file, so these are observed costs under different load/cache conditions, not a controlled speed comparison. All cost values below are wall seconds.test/helpers/fixture-receipts.test.tstest/scripts/run-vitest-progress.test.tssrc/node-host/node-worker-workspace-retention.test.tstest/scripts/release-preflight.test.tstest/scripts/vitest-report-owner.test.tstest/scripts/upgrade-survivor-systemd.test.tstest/scripts/check-deadcode-reporting.test.tstest/scripts/ci-platform-checkout.test.tstest/scripts/pr-git-maintenance.test.tsThe new helper file meets the requested <3 s standalone target on all 20 measured runs. Both actual checkout backoff consumers also passed
-t backoff(2.883 s and 2.824 s). The existing longer integration files preserve their native process/PTY/worker contracts; the new helper itself adds no real timers, sleeps, or polling.Leases, interruptions, and limitations
tbx_01m3w3yr7h5ttcs0p26f09v200, run, wrapper exit 0, stopped; eight existing files passed.tbx_01m3w58tr3jvz256g59238ff1p, run, wrapper exit 0, stopped.tbx_01m3w5y4cp1sqe6q73mtk8ek3m, run, wrapper exit 255 after 1h47m. It recorded 180 standalone passes, two consumer passes, and 25 shard passes, but no result for the in-flight replay and no failed-test result. The cause remains undetermined. The lease was absent fromblacksmith testbox list --all; no process was signaled. This remains a named Testbox/Crabbox follow-up, not a claimed source fix.tbx_01m3wdbvvntsb2r4jwxs9yd8ws, run, ran only the five unfinished shard replays and static gates, on the identical source tree. All passed except the initially missing OpenGrep executable; wrapper exit 1 and lease stopped. Source fingerprint comparison reported no changes.tbx_01m3wg309hxt7v549vnyt74twx, run, wrapper exit 0 and stopped, same source tree.The long-run monitor initially missed the wrapper's termination footer because it displayed only completed test rows. A read-only
blacksmith testbox download --id …attempt then failed with “no SSH key found.” That diagnostic step was stopped without looking up or retrieving credentials. This is the explicit diagnostic deviation from the no---idinstruction; no proof execution reused a lease. The continuation added live child output and completion-footer monitoring, preserved valid prior results, and did not change source or retry a reported test failure.Two requested real wall-delay proofs remain infeasible under frozen surrounding timeouts: the report fork has a 5 s native Vitest timeout below its old 15 s polling deadline, and checkout has a 45 s supervisor lease below its old 60 s observer deadline. The latter has supplemental clock-advance evidence; neither limitation was hidden by changing timeouts. The remaining native process-group polls and absent compiler-start/drain sites are documented in section 4.
Coordinator follow-up
git diff --check,pnpm deadcode:full.scoped-clean.