Skip to content

fix(test): agent session, worktree, and provider tests time out on loaded hosts while polling fixture files - #162545

Merged
steipete merged 1 commit into
mainfrom
steipete/poll-agents
Oct 1, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/poll-agents

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: agent session, worktree, provider-service, MCP cleanup, and native-harness tests fail on a loaded host when a fixture child or worker takes longer than a short wall-clock deadline (1–10 s) to become ready, because the tests poll files, PID files, or the process table against those deadlines.

User Impact

No user-visible change. These suites stop failing spuriously on slow or busy machines, and a genuinely missing event now fails at its owning step or at the Vitest test timeout instead of racing a timer.

Why This Change Was Made

Part of the polling audit from #162274 (which added test/helpers/fixture-receipts.ts and recorded the full census in its body). This batch converts the remaining src/agents sites to the signal that owns each event: retained promises and ChildProcess close handles, stdout readiness lines and an owned stdin release for test-spawned children, fixture receipts with a durable-record fallback for product-spawned children, and direct reads where an awaited product operation already guarantees the state (each ordering claim is cited in the table below). Foreign-PID extinction with no owner join keeps a deadline-free check bound to the test signal. settings-storage.test.ts moves its synchronous reader interception into a child so a held barrier can never wedge the Vitest thread. No product source, test timeout, product timeout, or assertion meaning changed.

Two sites stay unconverted on purpose: sessions/exec.real.test.ts readiness and the cold-session wait in harness/acp-native-execution.process.test.ts. In both, a product timeout (1 s / 3 s) already races the same child boot, so no test-side signal can make a slow boot pass without changing timeout ownership; they are follow-ups.

Release-note context: test-only change, no user-visible behavior change.

Per-site conversions

Old lines are the work-order locations. Categories follow its preference order.

Site Old wait / deadline Replacement Class Justification
src/agents/embedded-agent-subscribe.raw-stream.test.ts:39 vi.waitFor; 1,000 ms 1 — real append-owner completion promise retained by call-through spy B appendRegularFile awaits appendFile and handle.close before resolving (installed fs-safe dist/regular-file.js:247–281); exact JSONL assertion retained.
src/agents/harness/acp-native-execution.process.test.ts:331 waitForFixtureFile; no inner deadline, attempt 3,000/30,000 ms STOP — unchanged cold-session wait A† The attempt timeout starts before native boot; the 3,000 ms variant can settle before session-new entry. A receipt cannot preserve the timeout assertion and make >3 s cold boot succeed without changing clock/timeout ownership.
src/agents/harness/acp-native-execution.process.test.ts:180 waitForFixtureFile; operation bounded by 30,000 ms attempt 3 — prompt-entry receipt and durable marker fallback B owner-agent writes entered marker before receipt/reply; either operation settlement checks that record. withinTest reaches release finally.
src/agents/harness/acp-native-execution.process.test.ts:246 waitForFixtureFile; no inner deadline, 60,000 ms test 3 — mode-control entry receipt and durable marker fallback B Same fixture holdControl producer; recorded review mode precedes receipt/reply.
src/agents/mcp-stdio-client.cleanup.real.test.ts:210 vi.waitFor; 1,000 ms 3 — held-exit receipt, durable PID, retained relay exit B Anchor writes PID synchronously before sendReceipt. Both fulfilled/rejected stop races consult the durable record.
src/agents/provider-local-service.shutdown.test.ts:39 waitForPidToExit; 2,000 ms 1 — retained ChildProcess close promises B Node publishes child_process during construction, before pid assignment; retain by object identity, match PID after readiness, and await close after cleanup.
src/agents/provider-local-service.test.ts:632 waitForPidToExit; 2,000 ms 4 — direct death assertion after replacement acquisition B provider-local-service.ts:363 awaits stopManagedProcess; :556 awaits stopLocalServiceProcess. provider-local-service-process.ts:51,79–96 requires close, no pending signals, and absent tree before returning.
src/agents/provider-local-service.test.ts:755 waitForPidToExit; 2,000 ms 5 — one deadline-free AbortSignal-bound foreign-PID check B Host exit handler sends SIGKILL synchronously but cannot join service extinction (provider-local-service.ts:574–597); test owns the grandparent host only.
src/agents/sessions/bash-output-spill.test-support.ts:301 vi.waitFor; 1,000 ms 5 — combined producer PID/group extinction check B Runner has closed; test has no ChildProcess handle for detached producer/group. One short native tick loop observes both, bounded by test signal.
src/agents/sessions/bash-output-spill.test-support.ts:48 producer interval; 5,000 ms fuse, 20,000 ms runner guard 1/2 — runner-owned socket IPC release; async runner close B Producer waits for prefix-write completion and an owned release byte before final output. Positive release/completed assertions preserve the old fuse assertion meaning. Existing runner 20 s guard and output cap retained.
src/agents/sessions/bash-output-spill.test-support.ts:300 waitForPidToExit; 5,000 ms 5 — same combined producer PID/group extinction check B No additional deadline or duplicate residual loop; runner cancellation is sent through stdin to the product-owned abort path and joined.
src/agents/sessions/exec.real.test.ts:65 vi.waitFor PID JSON; 3,000 ms STOP — unchanged readiness wait A execCommand timeout is 1,000 ms, earlier than the 3,000 ms readiness deadline. Delaying healthy boot beyond the old deadline kills the process before its PID record; a receipt alone cannot fix it under the unchanged product-timeout constraint.
src/agents/sessions/exec.real.test.ts:77 vi.waitFor extinction; 500 ms 5 — one deadline-free AbortSignal-bound two-PID check B Product result already settled. Foreign descendant/root PIDs have no test-owned exit handles; existing process.kill predicates retained.
src/agents/sessions/settings-storage.test.ts:234 waitForFile; 10,000 ms 2 — first-writer stdout lock-entry line A Ready line is written inside the admitted withLock callback; managed child close is raced for early failure, withinTest owns abort.
src/agents/sessions/settings-storage.test.ts:422 waitForFile; 10,000 ms 2 — first-write stdout lock-entry line A Same owned stdout gate for concurrent independent writer.
src/agents/sessions/settings-storage.test.ts:429 waitForFile; 10,000 ms 2 — stdout contention line A Contender emits only after observing EEXIST from the actual lock attempt.
src/agents/sessions/settings-storage.test.ts:208 existsSync / Atomics timed loop; 5,000 ms 1/2 — owned stdin byte bridged to worker SharedArrayBuffer B Child main thread receives stdin asynchronously; worker uses deadline-free Atomics.wait. Parent Vitest stays abortable and managed process-group cleanup is joined.
src/agents/sessions/settings-storage.test.ts:260 commitDuringObservation poll; 5,000 ms 1 — writer completion followed by reader release barrier B Reader captures real existsSync observation before its worker blocks. Parent awaits writer exit (settings-storage.ts:184–192 lock/callback/atomic replace/release) before releasing reader.
src/agents/sessions/settings-storage.test.ts:267 commitDuringObservation poll; 5,000 ms 1 — same completion/barrier for lstatSync observation B Same ordering; synchronous reader interception lives in its own child so timeout cleanup cannot be blocked by Atomics.wait on the Vitest thread.
src/agents/worktrees/filesystem-native.test.ts:161 expect.poll; 1,000 ms 3 — ready receipt with durable marker fallback A Child records ready before receipt/output; shared idempotent release-and-join cleanup is awaited by body finally and afterEach before temp removal.
src/agents/worktrees/filesystem-native.test.ts:163 expect.poll; 1,000 ms 3 — SIGTERM-handler receipt with durable marker fallback B Signal handler records canceled before receipt; original unsettled/finished-file assertions retained.
src/agents/worktrees/service.hooks.test.ts:134 waitForFixtureFile + withTimeout; 15,000 ms 3 — setup child PID receipt with durable fallback B Fixture writes PID before receipt. Outcome await is bound to test signal; independent fixture kill remains in finally after the original death assertion.
src/agents/worktrees/service.provisioned.test.ts:472 waitForPidFile; 5,000 ms 3 — membership child PID receipt with durable fallback A Fixture records PID before receipt; pending removal settlement consults that record if receipt is late.
src/agents/worktrees/service.provisioned.test.ts:476 vi.waitFor; 5,000 ms 1/4 — await pending removal, then original death assertion B src/process/exec-runner.ts:562–571 awaits child and processCleanup; provisioned-files.ts:183–187 awaits the command with killProcessTree.

Stops, residuals, and deliberately unconverted sites

STOP

Evidence

All proof ran on Blacksmith Testbox through node scripts/crabbox-wrapper.mjs one-shot runs; no local Vitest.

Fault and forced-abort probes

  • Settings: identical 11,000 ms healthy startup delay. Original fails with timeout waiting for .../first-entered; fixed passes under the unchanged test deadline. Separate readiness and synchronous-barrier forced aborts both record first-finally and cleanup completion; all recorded child PIDs are absent.
  • Native controlled child: identical 1,500 ms delay. Original fails the old 1,000 ms expect.poll bound with AssertionError: expected empty text to be yes and Matcher did not succeed in time.; fixed passes. The final cleanup revision reran both its forced-abort and delayed-start proof successfully.
  • Provisioned membership: identical 6,000 ms dispatch delay. Original fails Timed out waiting for pid file: at 5,000 ms; fixed passes.
  • Bash: held release IPC forces Vitest abort; durable first-finally marker is present, and external checks after pnpm returns show runner PID, producer PID, and producer group all absent. Separate residual-loop abort proves the same extinction checks and cleanup join.
  • Provider host residual: forced loop hang reaches first-finally, records PROCESS_RESIDUAL_NO_LEAK, and confirms both host/service dead.
  • STOP sites deliberately have no claim of passing delayed-boot proof.

Initial failures were investigated rather than dismissed: Node publishes child-process diagnostics before PID assignment (fixed by retaining object identity); Linux spawned stdin is nonblocking (fixed with async input/SAB worker bridge); native timeout teardown deleted its release file too early (fixed with shared release-and-join lifecycle ownership). The initial native abort probe left a sleeping child parented by PID 1; the probe recorded that failure before rescuing only the exact fixture process. Final native abort evidence has joined: true, in_test_child_gone: true, and post_pnpm_process: null. Bash’s missing late console message was only an observation issue: external durable PID checks proved extinction without changing source.

Key machine-readable proof records:

SETTINGS_PROBE_RESULT {"tag": "settings-fault-original", "returncode": 1, "wall_s": 27.355, "command_timeout": false, "log": "/tmp/openclaw-settings-probes-0z94l0m4/settings-fault-original/output.log", "old_timeout_message": true, "passed": true, "expected": "old first-entered timeout"}
SETTINGS_PROBE_RESULT {"tag": "settings-fault-fixed", "returncode": 0, "wall_s": 27.145, "command_timeout": false, "log": "/tmp/openclaw-settings-probes-0z94l0m4/settings-fault-fixed/output.log", "old_timeout_message": false, "passed": true, "expected": "pass after 11 s healthy delay"}
SETTINGS_PROBE_RESULT {"tag": "settings-abort-readiness", "returncode": 1, "wall_s": 17.089, "command_timeout": false, "log": "/tmp/openclaw-settings-probes-0z94l0m4/settings-abort-readiness/output.log", "events": ["READINESS_HELD", "FINALLY", "CLEANUP_DONE"], "pids": [7453], "leaked_pids": [], "vitest_timeout_seen": true, "expected": "Vitest timeout; finally and cleanup done; no live fixture PIDs", "passed": true}
SETTINGS_PROBE_RESULT {"tag": "settings-abort-sync-barrier", "returncode": 1, "wall_s": 17.661, "command_timeout": false, "log": "/tmp/openclaw-settings-probes-0z94l0m4/settings-abort-sync-barrier/output.log", "events": ["SYNC_BARRIER_HELD", "FINALLY", "CLEANUP_DONE"], "pids": [7700, 7708], "leaked_pids": [], "vitest_timeout_seen": true, "expected": "Vitest timeout; finally and cleanup done; no live fixture PIDs", "passed": true}
WORKTREES_PROBE_RESULT {"label": "native-original-delay-1500ms", "file": "src/agents/worktrees/filesystem-native.test.ts", "expected": "fail", "exit": 1, "wall_s": 16.395, "evidence_matched": true, "ok": true}
WORKTREES_PROBE_RESULT {"label": "native-fixed-delay-1500ms", "file": "src/agents/worktrees/filesystem-native.test.ts", "expected": "pass", "exit": 0, "wall_s": 18.418, "evidence_matched": true, "ok": true}
WORKTREES_PROBE_RESULT {"label": "membership-original-delay-6000ms", "file": "src/agents/worktrees/service.provisioned.test.ts", "expected": "fail", "exit": 1, "wall_s": 27.746, "evidence_matched": true, "ok": true}
WORKTREES_PROBE_RESULT {"label": "membership-fixed-delay-6000ms", "file": "src/agents/worktrees/service.provisioned.test.ts", "expected": "pass", "exit": 0, "wall_s": 23.59, "evidence_matched": true, "ok": true}
WORKTREES_PROBE_RESULT {"label": "native-fixed-forced-abort-3000ms", "file": "src/agents/worktrees/filesystem-native.test.ts", "expected": "fail", "exit": 1, "wall_s": 18.398, "evidence_matched": false, "ok": false}
NATIVE_ABORT_EXTERNAL_RESULT {"exit": 1, "wall_s": 19.89, "expected_timeout": true, "finally_entered": true, "joined": false, "in_test_child_gone": false, "child_receipt": {"pid": 5925, "root": "/tmp/oc-vt-wX7i4Q/openclaw-native-settlement-wRRRYo", "start": "19447"}, "post_pnpm_process": {"pid": 5925, "state": "S", "parent": 1, "start": "19447"}, "child_extinct": false, "ok": false}
FORCED_ABORT_VERIFIED ipc-abort durable first finally reached; external runner/producer/group ESRCH {"root": "/home/runner/_work/openclaw/openclaw/.local/bash-spill-test-VWe8i5", "runnerPid": 6166}
NATIVE_ABORT_EXTERNAL_RESULT {"exit": 1, "wall_s": 17.999, "expected_timeout": true, "finally_entered": true, "joined": true, "in_test_child_gone": true, "child_receipt": {"pid": 5876, "root": "/tmp/oc-vt-T04jyp/openclaw-native-settlement-7327zT", "start": "24662"}, "post_pnpm_process": null, "child_extinct": true, "ok": true}
NATIVE_FINAL_FAULT {"exit": 0, "wall": 19.122}

Standalone repetitions (flake-triage bar)

Each command was CI=1 pnpm test <file> --maxWorkers=1; at most four different files ran concurrently, never two runs of the same file. No failing repetition was retried to erase a failure. Native macOS skips are reported separately.

File Before wall (s) Final clean commands Final median wall (s) Final range (s)
src/agents/embedded-agent-subscribe.raw-stream.test.ts 3.479 20/20 1.835 1.654–3.251
src/agents/harness/acp-native-execution.process.test.ts 73.564 20/20 62.376 48.657–69.355
src/agents/mcp-stdio-client.cleanup.real.test.ts 50.914 20/20 50.695 44.710–56.298
src/agents/provider-local-service.shutdown.test.ts 7.777 20/20 6.046 5.825–7.479
src/agents/provider-local-service.test.ts 33.514 20/20 30.290 24.494–35.348
src/agents/sessions/bash-executor.test.ts 25.779 20/20 24.626 21.334–30.198
src/agents/sessions/exec.real.test.ts 24.224 20/20 29.257 24.573–33.315
src/agents/sessions/settings-storage.test.ts 20.296 20/20 25.306 22.000–29.904
src/agents/sessions/tools/bash.test.ts 25.097 20/20 27.044 23.550–33.438
src/agents/worktrees/filesystem-native.test.ts 20.729 20/20 (platform skips) 21.489 18.727–28.924
src/agents/worktrees/service.hooks.test.ts 35.024 20/20 35.860 27.951–43.224
src/agents/worktrees/service.provisioned.test.ts 39.202 20/20 46.465 29.246–60.383

Every per-run wall, exit code, and test-count summary is in [standalone-results.json]. Before walls came from fetched origin/main bytes; those matched the requested base byte-exactly. Full wall times include cold runtime-fixture builds and test launcher cost, so these measurements are evidence, not a claim of a general speedup.

Owning CI shard replays

Bundles were discovered with createNodeTestShardBundles({ includeProofTests: true }), including release-only ownership; whole-config agents-support ownership was resolved through the canonical owner inventory. Exact [{shard_name, configs, includePatterns}] payloads are in [shards.json]. Every replay uses OPENCLAW_NODE_TEST_GROUPS_JSON=<group> CI=1 node --import tsx scripts/ci-run-node-test-shard.mts.

Bundle Exit Wall (s)
agentic-agents-core-models 0 114.348
agentic-agents-core-runtime 0 143.069
agentic-agents-core-subagents 0 30.740
agentic-agents-support 0 341.204
bundle-infra-small-runtime-11 0 296.157
bundle-infra-small-runtime-12 0 344.423
bundle-infra-small-runtime-7 0 369.701

Types, lint, review

pnpm tsgo:core:test --changed-paths-json <all touched paths> passed all 27 selected core-test graphs in 1,073.786 s. The native cleanup-only follow-up passed the selected agents-tools type graph in 38.4 s; see [tsgo-final.log]. Local checks use the shared donor without modifying it: oxfmt --check on all touched paths; type-aware oxlint with config/tsconfig/oxlint.core.json on src files; plain oxlint for the excluded .mjs fixture; and git diff --check. See [lint.log]. The root test tsconfig excludes test/fixtures, hence no type-aware root fixture lane exists.

Isolated Codex autoreview of the final candidate: see [autoreview-complete.txt] and [autoreview-complete.json]. The earlier candidate review was intentionally interrupted after the independent native abort probe proved a source defect; it is not claimed as a completed review. A second review produced no report after 50 minutes and was restarted with the same engine/model and streamed diagnostics, without changing source or isolation. Streamed diagnostics then showed HTTP 401 before any review report. The existing configured command-auth route was selected explicitly; the helper was invoked with the installed Python 3.14 because its system-Python 3.9 shebang could not parse that route. No credential was changed or printed.

Coordinator shard replays 2 and 3 (flake-triage bar: 3 clean replays of every owning bundle, with the lane's replay above)

SHARD agentic-agents-core-models replay=1 pass wall=113s   76 passed (76) |  1161 passed | 1 skipped (1162)
SHARD agentic-agents-core-models replay=2 pass wall=71s   76 passed (76) |  1161 passed | 1 skipped (1162)
SHARD agentic-agents-core-runtime replay=1 pass wall=147s   208 passed | 1 skipped (209) |  3159 passed | 12 skipped (3171)
SHARD agentic-agents-core-runtime replay=2 pass wall=117s   208 passed | 1 skipped (209) |  3159 passed | 12 skipped (3171)
SHARD agentic-agents-core-subagents replay=1 pass wall=34s   27 passed (27) |  467 passed (467)
SHARD agentic-agents-core-subagents replay=2 pass wall=34s   27 passed (27) |  467 passed (467)
SHARD agentic-agents-support replay=1 pass wall=330s   365 passed | 5 skipped (370) |  5198 passed | 27 skipped (5228)
SHARD agentic-agents-support replay=2 pass wall=341s   365 passed | 5 skipped (370) |  5198 passed | 27 skipped (5228)
SHARD bundle-infra-small-runtime-11 replay=1 pass wall=232s   62 passed | 2 skipped (64) |  868 passed | 12 skipped (880)
SHARD bundle-infra-small-runtime-11 replay=2 pass wall=273s   62 passed | 2 skipped (64) |  868 passed | 12 skipped (880)
SHARD bundle-infra-small-runtime-12 replay=1 pass wall=311s   64 passed (64) |  1140 passed | 1 skipped (1141)
SHARD bundle-infra-small-runtime-12 replay=2 pass wall=403s   64 passed (64) |  1140 passed | 1 skipped (1141)
SHARD bundle-infra-small-runtime-7 replay=1 pass wall=463s   64 passed (64) |  1529 passed | 1 skipped (1530)
SHARD bundle-infra-small-runtime-7 replay=2 pass wall=354s   64 passed (64) |  1529 passed | 1 skipped (1530)
SHARDS overall=0

Replace JSONL, fixture-entry, PID, and teardown polling against 500 ms to
10 s deadlines with real append completion, retained child close events,
stdout and IPC receipts, and joined owner cleanup. Keep foreign-PID and
process-group extinction checks deadline-free and bound to the test signal.

Bridge settings lock barriers through asynchronous child stdin and worker
notifications so Vitest can abort synchronous lock tests. Share native
fixture release-and-join cleanup with afterEach before deleting its inputs.

Leave exec readiness and cold ACP initialization unchanged where existing
product deadlines still precede the requested delayed-boot proof.
@clawsweeper

clawsweeper Bot commented Oct 1, 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 agents Agent runtime and tooling size: XL labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed October 1, 2026, 4:33 AM ET / 08:33 UTC.

ClawSweeper review

What this changes

The PR replaces short polling deadlines in agent tests with owned completion signals, fixture receipts, and abortable process checks while preserving existing assertions.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this remains useful test-reliability work, with convincing delay and cleanup evidence and no identified introduced defect. The merged predecessor supplies shared helpers but does not cover these conversions.

Priority: P2
Reviewed head: 2030bf78c1702f8c51851ceba2d58f89d5315302

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Sound test-only changes have strong fault and cleanup evidence, with one repository validation-record gap remaining.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured Testbox output exercises the changed settings, worktree, Bash, and provider fixture boundaries with injected delays and explicit test aborts; fixed runs recover and cleanup records show process extinction. These observations directly cover test synchronization, while the separate three-replay shard gate remains undocumented. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured Testbox output exercises the changed settings, worktree, Bash, and provider fixture boundaries with injected delays and explicit test aborts; fixed runs recover and cleanup records show process extinction. These observations directly cover test synchronization, while the separate three-replay shard gate remains undocumented. No stored-data contract changes.
Evidence reviewed 10 items Pinned introduced changes: Reviewed the merge-base-to-head delta. All introduced changes are tests, test support, or synthetic fixtures; there are no production, dependency, workflow, configuration, or stored-format changes.
Current-main defect remains: Pinned main still contains the first-writer file polling and synchronous five-second reader barrier. The branch replaces these with stdout readiness and child-worker release barriers without changing the twenty-second test timeout.
Complete captured proof body inspected: Fetched and read the complete PR body; its 18,936 UTF-16 units and SHA-256 a624fd716ac53dd35bd965d9b9ca79213f64b7cd1f4ab1d273dcb5d2c5aed75b match the captured snapshot. Testbox records show original failures and fixed passes for identical eleven-second settings startup, 1.5-second controlled native-child startup, and six-second membership dispatch delays. Forced-abort records show cleanup completion and absent child PIDs, including the repaired native cleanup revision.
Findings None None.
Security None None.

How this fits together

These tests exercise agent settings, native execution, local provider services, and worktree cleanup through child processes. Fixture signals coordinate assertions and teardown so slow startup does not look like a product failure.

flowchart TD
  A[Agent test] --> B[Product operation]
  B --> C[Fixture child]
  C --> D[Readiness or completion signal]
  D --> E[Assertions]
  A --> F[Test cancellation]
  F --> G[Joined process cleanup]
  E --> G
Loading

Before merge

  • Complete next step (P2) - Establish the writing-tests policy’s three clean original-shard replays in the PR evidence, citing existing valid repetitions or completing the missing isolated runs.
Agent review details

Security

None.

PR surface

Tests +402. Total +402 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 16 714 312 +402
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 714 312 +402

Review metrics

Metric Value Why it matters
Runtime scope production +0; tests and fixtures +402 net lines The additional synchronization machinery stays in test ownership and adds no shipped runtime surface.

Technical review

Best possible solution:

Keep fixture synchronization tied to actual readiness and cleanup ownership, with existing product deadlines and regression assertions intact.

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

Yes: current-main polling deadlines race healthy child startup, and matching before/after Testbox delay probes demonstrate the failure mechanism. This review inspected source and supplied execution records without running tests.

Is this the best way to solve the issue?

Yes: owned signals and durable-record fallbacks remove competing test deadlines while preserving cleanup and assertions; no production hook is added.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 83a449f8523c.

Labels

Label changes:

  • add P2: This repairs bounded loaded-host test failures without changing user-facing runtime behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured Testbox output exercises the changed settings, worktree, Bash, and provider fixture boundaries with injected delays and explicit test aborts; fixed runs recover and cleanup records show process extinction. These observations directly cover test synchronization, while the separate three-replay shard gate remains undocumented. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured Testbox output exercises the changed settings, worktree, Bash, and provider fixture boundaries with injected delays and explicit test aborts; fixed runs recover and cleanup records show process extinction. These observations directly cover test synchronization, while the separate three-replay shard gate remains undocumented. No stored-data contract changes.

Label justifications:

  • P2: This repairs bounded loaded-host test failures without changing user-facing runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured Testbox output exercises the changed settings, worktree, Bash, and provider fixture boundaries with injected delays and explicit test aborts; fixed runs recover and cleanup records show process extinction. These observations directly cover test synchronization, while the separate three-replay shard gate remains undocumented. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Testbox output exercises the changed settings, worktree, Bash, and provider fixture boundaries with injected delays and explicit test aborts; fixed runs recover and cleanup records show process extinction. These observations directly cover test synchronization, while the separate three-replay shard gate remains undocumented. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced changes: Reviewed the merge-base-to-head delta. All introduced changes are tests, test support, or synthetic fixtures; there are no production, dependency, workflow, configuration, or stored-format changes. (2030bf78c170)
  • Current-main defect remains: Pinned main still contains the first-writer file polling and synchronous five-second reader barrier. The branch replaces these with stdout readiness and child-worker release barriers without changing the twenty-second test timeout. (src/agents/sessions/settings-storage.test.ts:279, 83a449f8523c)
  • Complete captured proof body inspected: Fetched and read the complete PR body; its 18,936 UTF-16 units and SHA-256 a624fd716ac53dd35bd965d9b9ca79213f64b7cd1f4ab1d273dcb5d2c5aed75b match the captured snapshot. Testbox records show original failures and fixed passes for identical eleven-second settings startup, 1.5-second controlled native-child startup, and six-second membership dispatch delays. Forced-abort records show cleanup completion and absent child PIDs, including the repaired native cleanup revision. (2030bf78c170)
  • Shard-repetition gate: The writing-tests guide requires twenty clean standalone runs and three clean original-shard runs. The complete body supplies twenty standalone repetitions per file and seven successful owning-shard results, but does not establish three clean repetitions of each applicable original shard. Public docs: docs/help/testing/writing-tests.md. (docs/help/testing/writing-tests.md, 2030bf78c170)
  • Receipt ordering and timeout cleanup: The shared receipt contract explicitly allows delivery after replies or exit. Changed callers retain durable-marker fallbacks, and withinTest rejects on the owning test signal so finally cleanup remains reachable. Native write teardown shares one release-and-join promise with afterEach. (src/agents/worktrees/filesystem-native.test.ts:196, 2030bf78c170)
  • Relevant dependency signal: The raw-stream test now awaits the real appendRegularFile promise, and its ordering claim explicitly depends on fs-safe completing both append and descriptor close. package.json pins @openclaw/fs-safe to 0.21.3. (src/agents/embedded-agent-subscribe.raw-stream.test.ts:43, 2030bf78c170)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record three clean replays of each applicable original owning shard, reusing valid existing runs where available.

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.

@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Landing notes:

  • ClawSweeper's evidence item (three clean replays of the original shards) is now in the PR body: replays 2 and 3 of all seven owning bundles (agentic-agents-core-models, -runtime, -subagents, agentic-agents-support, bundle-infra-small-runtime-7/11/12) passed on this head, on top of the lane's first replay.
  • The only red check, checks-windows-node-test-4, is inherited from main: src/config/sessions/session-accessor.sqlite-creation-worker.test.ts fails with "Session creation publication owner is no longer current" in the same job on the hourly main runs 36827062752 and 36831897385. This PR touches no file under src/config/sessions/; the failure is tracked separately.

@steipete
steipete merged commit efdd3c8 into main Oct 1, 2026
155 of 166 checks passed
@steipete
steipete deleted the steipete/poll-agents branch October 1, 2026 09:56
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…aded hosts while polling fixture files (openclaw#162545)

Agent session, worktree, provider-service, MCP cleanup, and native-harness tests waited for fixture children and workers by polling files, PID files, and the process table against 1-10 s wall-clock deadlines, which a loaded host outlasts.

Each wait now awaits its owning signal: retained promises and ChildProcess close handles, stdout readiness lines and an owned stdin release for test-spawned children, fixture receipts with a durable-record fallback for product-spawned children, and direct reads where an awaited product operation already guarantees the state. settings-storage moves its synchronous reader interception into a child so a held barrier cannot wedge the Vitest thread. Foreign-PID extinction without an owner join keeps a deadline-free check bound to the test signal. sessions/exec.real readiness and the native-harness cold-session wait stay unchanged because a product timeout races the same boot (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: delayed-startup fault probes fail the original bytes and pass these bytes; forced-abort probes reach cleanup with no leaked PIDs; 20/20 standalone runs of all twelve files; 3/3 replays of all seven owning bundles; targeted tsgo; Codex autoreview and ClawSweeper (no findings). The red checks-windows-node-test-4 job is inherited from main (session-accessor creation worker; hourly runs 36827062752, 36831897385).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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