Repository navigation
fix(test): accepted-sync worker-environment tests time out on loaded hosts while polling apply markers - #162573
Conversation
Accepted-workspace apply tests polled backup-rename marker files against 10-second deadlines. Child close also raced 10-second body deadlines and a 1-second cleanup deadline despite healthy pending work. Await fixture readiness on owned stderr, the existing settlement deferred, and retained child-close promises instead. Bind waits to the test signal and drain fixture bodies before removing their inputs, so timed-out tests finish FIFO release and process cleanup. Keep child cancellation active until close so an abort arriving during cleanup still terminates the child. Keep the receiver fixture unchanged: its detached process groups lack an owned cross-platform abort completion signal. Other assigned files remain unchanged because the pre-edit census found worktree ownership conflicts.
|
🦞👀 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, 5:19 AM ET / 09:19 UTC. ClawSweeper reviewWhat this changesThe PR replaces deadline-based apply-fixture polling with readiness signals and retained child-close promises, and joins cleanup before removing test directories. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, well-validated fixture reliability fix, with no blocking defect found. Likely related people: steipete, supported by prior merged work on this area. Priority: P2 Review scores
Verification
How this fits togetherAccepted workspace publication copies reconciled files into a worker workspace and settles uncertain remote transaction outcomes. These tests exercise its production transaction scripts while controlling child readiness, publication progress, and cleanup. flowchart TD
A[Accepted workspace files] --> B[Workspace publisher]
B --> C[Apply transaction child]
C --> D[Readiness signal]
D --> E[Test assertions and gate release]
F[Test cancellation] --> G[Child close and fixture cleanup]
E --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +68. Total +68 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use owned readiness and completion signals for the direct apply fixtures while preserving the receiver fixture until its detached-process lifecycle has an adequate owner. Do we have a high-confidence way to reproduce the issue? Yes: current main visibly races apply readiness against a 10-second deadline, and the reported identical 11-second delay fails before and passes after. This read-only review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: the patch uses existing test-signal and fixture-lifetime helpers, preserves transaction assertions, and changes no production timeout or API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3ea571a6b98f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
… out on loaded hosts while polling fixture files (#162635) Gateway hook-mapping, cron live, session-creation, and worker-environment workspace mutation/inventory/manifest tests waited for fixture children by polling marker, PID, and ready files against 5-10 s wall-clock deadlines, which a loaded host outlasts. Hook mapping now waits for a synchronous module-entry event with a separate release; directly spawned controllers are joined through durable close promises attached at spawn; readiness for test-spawned children arrives on stdout/IPC lines written after the fact they announce; waits raced against a command that can settle first fail fast via awaitGateBeforeSettlement bound to the test signal; and cleanup joins through onTestFinished so a timeout cannot orphan fixtures (a forced-abort probe caught and fixed exactly that in the inventory test). Receiver, tunnel, and cron-watcher waits whose processes the product starts in separately detached groups keep their original waits (follow-up). No product source, test timeout, product timeout, or assertion meaning changed. Part of the polling audit from #162274 (follow-up to #162573). Proof on Blacksmith Testbox: delayed-startup fault probes fail the original bytes and pass these bytes; forced-abort probes reach cleanup with no leaked processes; 20/20 standalone runs of all six files; 3/3 replays of each owning Gateway shard; targeted tsgo; Codex autoreview and ClawSweeper clean.
…hosts while polling apply markers (openclaw#162573) The accepted-sync worker-environment tests waited for the apply child by polling an apply-started marker file against a 10 s deadline and racing the child's close against fixed timers. On a loaded host the healthy child boot outlasts the deadline. The apply child now reports readiness on a stderr line written after it opens the FIFO (so an immediate release cannot lose the gate bytes), the test owns the FIFO writer, child close is retained as a promise that also terminates the child on test abort, and a fixture lifetime joins cleanup before temp directories are removed. Six waits convert. The five receiver-fixture waits stay unchanged because the product starts the receiver in its own detached process group with no owned join (follow-up). No product source, test timeout, product timeout, or assertion meaning changed. Part of the polling audit from openclaw#162274. Proof on Blacksmith Testbox: an 11 s delayed-startup probe fails the original bytes with the old timeout and passes these bytes; three forced-abort probes reach cleanup with the child dead; 20/20 standalone runs; 3/3 replays of agentic-gateway-core-2; targeted tsgo; Codex autoreview and ClawSweeper clean.
… out on loaded hosts while polling fixture files (openclaw#162635) Gateway hook-mapping, cron live, session-creation, and worker-environment workspace mutation/inventory/manifest tests waited for fixture children by polling marker, PID, and ready files against 5-10 s wall-clock deadlines, which a loaded host outlasts. Hook mapping now waits for a synchronous module-entry event with a separate release; directly spawned controllers are joined through durable close promises attached at spawn; readiness for test-spawned children arrives on stdout/IPC lines written after the fact they announce; waits raced against a command that can settle first fail fast via awaitGateBeforeSettlement bound to the test signal; and cleanup joins through onTestFinished so a timeout cannot orphan fixtures (a forced-abort probe caught and fixed exactly that in the inventory test). Receiver, tunnel, and cron-watcher waits whose processes the product starts in separately detached groups keep their original waits (follow-up). No product source, test timeout, product timeout, or assertion meaning changed. Part of the polling audit from openclaw#162274 (follow-up to openclaw#162573). Proof on Blacksmith Testbox: delayed-startup fault probes fail the original bytes and pass these bytes; forced-abort probes reach cleanup with no leaked processes; 20/20 standalone runs of all six files; 3/3 replays of each owning Gateway shard; targeted tsgo; Codex autoreview and ClawSweeper clean.
What Problem This Solves
Fixes: the accepted-sync worker-environment tests fail on a loaded host when the apply child takes longer than 10 s to start, because they poll an
apply-startedmarker file and race the child's close against a fixed timer.User Impact
No user-visible change.
src/gateway/worker-environments/workspace-accepted-sync.test.tsstops failing spuriously on slow machines; a missing apply start now fails at the owning step or the Vitest test timeout.Why This Change Was Made
Part of the polling audit from #162274. The apply child now announces readiness on a stderr line written after it opens the FIFO (so an immediate release cannot lose the gate bytes), the test owns the FIFO writer, child close is retained as a promise that also terminates the child on test abort, and a fixture lifetime joins cleanup before temp directories are removed. Six waits convert. The five receiver-fixture waits in the same file are left unchanged on purpose: the product starts the receiver in its own detached process group (
workspace-mutation-remote-script.ts) with no owned join the test can await, so converting them needs a product-side ownership change (follow-up). 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
Category numbers follow the work order. Old line numbers are its census identifiers.
The receiver fixture is byte-identical to the b512f38 base. Product settlement follows the apply callback result, which follows readiness. Converted waits use the existing gate and test-signal helpers.
Stops, residuals, and deliberately unconverted sites
The exact full-status census reached its 120-second cap. Bounded, path-scoped status censuses then checked all registered worktrees, including another check immediately before applying changes. Counts varied from 346 to 356 as other lanes created/removed worktrees. Stale registrations with missing directories returned 128; existing-worktree conflicts below were preserved.
/Users/steipete/Projects/openclaw/.claude/worktrees/openclaw-ci-status-5bd23e— scheduler and projects modified./Users/steipete/.codex/worktrees/heartbeat-integration-c0cb2d87/openclaw— projects unmerged; tunnel modified./Users/steipete/Projects/openclaw/.claude/worktrees/poll-scripts-1a— mutation and manifest staged deletions./Users/steipete/Projects/openclaw/.claude/worktrees/poll-scripts-2a— mutation and manifest staged deletions./Users/steipete/Projects/openclaw/.claude/worktrees/poll-infra-cli— hooks mapping and inventory staged deletions plus untracked replacements.Lifecycle STOP (the five receiver rows in the per-site table): the early-abort probe blocked the controller before receiver spawn. FIFO release left it alive (SYNC_EARLY_RESCUE_REQUIRED); probe-owned SIGKILL then rescued/reaped it. This is failure evidence, not cleanup proof. The product starts a separate detached group (src/gateway/worker-environments/workspace-mutation-remote-script.ts:57). Existing attached-tree termination is Linux-only (packages/agent-core/src/harness/env/kill-tree.ts:62); detaching outer rsync would not own that separate group. Rsync cleanup uses SIGUSR1, which Node reserves for debugger startup. A portable replacement needs additional cancellation ownership or fixture restructuring. Per the escape hatch, the receiver fixture was restored exactly. Evidence: early-abort.log; tbx_01m3v75bh3vs9pgn8vsbnd99sg; run 36832810327.
No prepared scratch proposals for skipped files were applied or counted as proof. The pre-edit census for the final accepted-sync repair found only this lane's own modification.
Evidence
All proof ran on Blacksmith Testbox through
node scripts/crabbox-wrapper.mjsone-shot runs; no local Vitest.Proof (from the lane report)
All Vitest/typecheck execution used one-shot Blacksmith Testbox wrappers. No local Vitest or local pnpm install, browser automation, GitHub PR/comment, push, or shared-dependency modification. The remote wrapper performed its standard dependency preparation.
Final Testbox:
tbx_01m3v9fdvyk4bpsfmdt4ftat23, providerblacksmith-testbox, run 36836922087. Wrapper exit 0; one-shot box stopped. Full user command took 971.934s; wrapper total 977.924s.timeout waiting for .../apply-started; fixed passed 1/1 selected case. Walls 27.821s and 28.863s. Probe cleanup: originalSYNC_DELAY_CLEAN 1, fixedSYNC_DELAY_CLEAN 0.SYNC_ABORT_FINALLY lineandSYNC_ABORT_CLEAN line; direct child PID dead after retained close join.SYNC_ABORT_FINALLY callbackandSYNC_ABORT_CLEAN callback; direct apply PID confirmed dead after its close and publication joins. Both final abort patterns target the SSH-loss fixture; earlier receiver-callback proof is not counted.createNodeTestShardBundles({includeReleaseOnlyToolingShards:true})and retained its exactconfigsandincludePatternsingroups.json.pnpm tsgo:core:test --changed-paths-json '["src/gateway/worker-environments/workspace-accepted-sync.test.ts"]': exit 0, 80.274 s.node_modules/.bin/oxfmt --check src/gateway/worker-environments/workspace-accepted-sync.test.ts: passed.node_modules/.bin/oxlint --type-aware --tsconfig config/tsconfig/oxlint.core.json src/gateway/worker-environments/workspace-accepted-sync.test.ts: passed.git diff --check: passed.Standalone walls by run (seconds):
18.432, 19.880, 18.457, 16.600, 19.447, 17.705, 16.839, 16.079, 16.070, 16.341, 15.983, 16.291, 20.319, 18.447, 16.293, 16.901, 16.507, 19.101, 17.999, 18.098.Commands/payloads retained beside this report:
proof-verified.shembeds the exact original bytes and probe transformers. Each probe restores bytes in Python finally and the payload verifies the final hash.proof-verified.logrecords per-run walls and results;groups.jsonrecords the owning shard selection.Coordinator shard replays (flake-triage bar: 3 total with the lane's replay above)