Skip to content

fix(test): agent-exec, update candidate-state, handoff, and QA-lab Gateway tests fail on loaded hosts when fixture children outlast polling deadlines - #162945

Merged
steipete merged 2 commits into
mainfrom
steipete/poll-infra-cli-2
Oct 2, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/poll-infra-cli-2

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: agent-exec (plugin e2e and construction), update candidate-state budget/cleanup, managed-service handoff boundary/process support, plugin install-record commit, the local TUI PTY e2e, and the QA Lab Gateway heartbeat-routing and package-for-Docker tests fail on a loaded host when a fixture child or preparation step outlasts a wall-clock polling deadline, because they poll readiness/PID files or race process exit against fixed timers.

User Impact

No user-visible change. These suites stop failing spuriously on slow machines; a missing readiness or exit now fails at its owning step or the Vitest test timeout. No update, Doctor, or migration behavior changes: only their tests' synchronization changes.

Why This Change Was Made

Part of the polling audit from #162274 and the follow-up to #162696, covering files that lane had to skip. Waits now await existing owner callbacks (e.g. the command onOutputChunk readiness), retained child close promises, fixture receipts with a durable-record fallback where the product owns the child, and same-process fixture events registered before the Gateway starts. The rebase onto main keeps #162694's stronger managed-service triage receipts byte-for-byte, #162403's cleanup directory-retirement fault, and #162496's Bun preload settings, and layers this lane's receipts and joins on top.

Deliberately unchanged (13 sites): runner guards whose independent 400/2000 ms clocks fire before readiness, cleanup joins that must still complete after test abort, a host blocked synchronously inside DatabaseSync.prepare interception, producers outside this lane's file set, and deliberately killed helpers with no retained close handle. 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 identify the supplied inventory. Signal categories are the work order’s preference order: 1 existing owned signal; 2 test-owned child IPC; 3 fixture receipt with durable ordering; 4 direct assertion after guaranteed settlement; 5 justified deadline-free residual.

File:old-line Old helper/deadline New signal/category or disposition Class Ordering / justification
src/cli/cli-process-child.test-helpers.test.ts:367 PID file / 5000 ms STOP A Independent runner guard fires at 400/2000 ms before readiness; passing >5s fault requires changing coupled clock semantics.
src/cli/update-cli/update-command-executor-legacy.test.ts:313 waitForDead / 5000 ms STOP B Cleanup releases an independently grouped leaf by file; aborted test signal cannot safely bound the final join.
src/commands/agent-exec-plugin.e2e.test.ts:259 waitForDead / 5000 ms 5: deadline-free signal-bound PID observation B Product kills fixture parents and descendants together; no retained descendant close owner crosses CLI boundary.
src/commands/agent-exec-plugin.e2e.test.ts:265 waitForDead / 5000 ms STOP B Final release marker must still be consumed after test abort; needs independent exit observer before replacing cleanup join.
src/commands/agent-exec.construction.test.ts:109 waitForPidFile / 3000 ms 3: socket receipt + durable PID fallback + withinTest A PID written before receipt; result-first race consults PID record; existing frozen construction clock preserved.
src/commands/agent-exec.construction.test.ts:129 waitForDead / 5000 ms 5: deadline-free signal-bound PID observation B Managed result settlement intentionally does not guarantee foreign command extinction after relay loss.
src/infra/device-identity.test.ts:299 waitForFileSync / 15000 ms STOP B Host blocks inside synchronous DatabaseSync.prepare interception. Async IPC/socket callbacks cannot execute; deadline-free Atomics wait cannot observe the same-thread Vitest abort. Requires independently supervised synchronous acknowledgement.
src/infra/sqlite-worker-preparation.test.ts:42 waitForFixtureFile / no deadline STOP B Producer is unlisted sqlite-worker-store.test-support.ts:161-174; its input has only markerPath/gatePath.
src/infra/sqlite-worker-preparation.test.ts:121 waitForFixtureFile / no deadline STOP B Same unlisted preparation producer must emit entry receipt.
src/infra/tailscale.test.ts:435 waitForFixtureFile / no deadline; native startup 15000 ms STOP B Diagnostic flush writer is unlisted test/fixtures/tailscale-foreground-fixture.mjs:26-34; public claim exposes outcome, not this flush callback.
src/infra/update-candidate-state.budget.test.ts:387 waitForDead / 5000 ms 4: direct assertion after snapshot rejection C update-candidate-snapshot.ts:349-395 awaits command with requireProcessTreeExtinction; exec-runner.ts:562-570 joins child and processCleanup. PID is direct worker process.pid.
src/infra/update-candidate-state.budget.test.ts:249 waitForFile / 5000 ms 3: socket readiness receipt + durable record A Fixture atomically publishes scratch path before sending readiness or replying.
src/infra/update-candidate-state.budget.test.ts:76 waitForFile / 5000 ms 1: existing command onOutputChunk readiness deferred A Synchronous stderr frame follows atomic PID marker; blocked statSync hook cannot service async socket connection. Existing callback forwarded unchanged.
src/infra/update-candidate-state.budget.test.ts:266 waitForFile / 5000 ms 3: numbered progress receipt + durable ACK C Existing worker writes ACK file before sending progress receipt; settlement race checks that ACK.
src/infra/update-candidate-state.cleanup.test.ts:515 waitForPidFile / 5000 ms 3: readiness receipt + durable PID fallback + withinTest A PID marker precedes receipt; finally aborts and joins inspection scope.
src/infra/update-candidate-state.cleanup.test.ts:519 waitForDead / 5000 ms 4: direct assertion after inspection rejection C inspection.ts:60 enters process.ts:16 command scope; exec-spawn.ts:109-122,146,229-246 joins direct child close before returning.
src/infra/update-candidate-state.cleanup.test.ts:609 waitForDead / 5000 ms 4: direct assertion after snapshot outcome C Snapshot command requires tree extinction and joins cleanup before failure; PID is actual backup worker process.pid.
src/infra/update-managed-service-handoff-boundary.test-support.ts:473 waitForFile / 5000 ms STOP B Partial-write producer is unlisted update-managed-service-native.test-support.ts:50; needs receipt in that generator.
src/infra/update-managed-service-handoff-boundary.test-support.ts:434 waitForFile / 120000 ms 3: validation receipt + durable record + withinTest B Updater sends receipt after both validation marker writes; helper close fallback reads record.
src/infra/update-managed-service-handoff-process.test-support.ts:68 waitForChildClose / 5000 ms 1: retained live-child close promises C Subscribe before synchronous SIGKILL; synchronous census cannot deliver close callbacks before subscription.
src/infra/update-managed-service-handoff.test-support.ts:109 waitForPidFile / 15000 ms 3: updater receipt + durable PID + withinTest B Updater writes PID before readiness; independent helper close race consults record.
src/infra/update-managed-service-handoff.test-support.ts:148 waitForDead / 15000 ms STOP C Deliberately killed helper no longer retains orphan close handle; test-signal residual can abandon cleanup.
src/infra/update-managed-service-handoff.test-support.ts:210 waitForDead / 15000 ms STOP C Same orphan cleanup needs independent supervisor or cleanup-safe residual contract.
src/infra/update-managed-service-triage.test-support.ts:441 waitForFixtureFile / no deadline 3: branch-spawn receipt + durable record + withinTest B Existing branch spawn callback writes marker then receipt; helper exit fallback consults marker.
src/plugins/install-record-commit.sqlite.test.ts:285 waitForFile / 15000 ms 2: entered IPC + awaitGateBeforeSettlement + withinTest C Keep existing child IPC connected through commit; entered after marker, before release-gated completion.
src/plugins/install-record-commit.sqlite.test.ts:301 waitForFile / 15000 ms 2: entered IPC + awaitGateBeforeSettlement + withinTest C Second commit uses same retained channel and races its done promise.
src/plugins/install-record-commit.sqlite.test.ts:297 expectFileToStayAbsent / 500 ms UNCHANGED negative observation N Preserves full exclusion interval while first writer owns lease.
src/state/openclaw-agent-worker-store.test-support.ts:71 file release / 5000 ms STOP B Unlisted openclaw-agent-worker-store.test.ts:155-182 passes and releases path-only gates; MessagePort cutover needs that consumer.
src/state/openclaw-agent-worker-store.test-support.ts:86 file release / 5000 ms STOP B Same unlisted consumer, including finally release at :201-204, must migrate.
src/tui/tui-pty-local.e2e.test.ts:1624 local waitFor / 4000 ms 5: deadline-free signal-bound PID observation A PTY error is visible before reclamation; no descendant handles or group-complete signal crosses boundary.
src/tui/tui-pty-local.e2e.test.ts:1549 waitForPidFile / 120000 ms 4: direct PID read after visible command completion C Fixture synchronously writes PID before root exits; tui-local-shell.ts:147 awaits run.wait before rendering exit at :164-170.
test/e2e/qa-lab/runtime/gateway-heartbeat-session-routing.e2e.test.ts:414 waitForFile / 15000 ms 1: cron_reconciled callback deferred + withinTest B Same-process fixture callback emits unique event; listener registered before gateway starts and removed in finally.
test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts:2407 waitForDead / 2000 ms 5: deadline-free signal-bound PID observation B Runner close only joins direct owner; foreign descendant has no retained handle.
test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts:2178 waitForDead / 2000 ms 5: same per-file residual C package-openclaw-for-docker.mts:390-398 allows bounded group reap; :419-440 owns direct close only.
test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts:2257 waitForDead / 2000 ms 5: same per-file residual C Direct child result cannot prove descendant extinction after fallback cleanup.
test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts:515 waitForDead / 2000 ms WINDOWS DEFERRED; semantics unchanged C Native Windows target exists, but requested Node bundles/Testbox proof are Linux-only. Original helper retained as waitForWindowsChildDeath.
src/infra/update-candidate-state.cleanup.test.ts:585 (additional) expect.poll / 10000 ms 3: backup-ready receipt + durable marker + withinTest B Fault preload writes PID/destination before receipt and before thrown fault; same worker lifecycle as listed backup death.
src/infra/update-managed-service-handoff-boundary.test-support.ts:442 (additional) vi.waitFor elapsed marker 4: direct elapsed-value assertion C New readiness follows second marker write, so elapsed value is complete before assertion; fake clock injection unchanged.

Stops, residuals, and deliberately unconverted sites

13 requested sites remain stopped/deferred: 12 explicit STOPs plus the native Windows site. The separate 500 ms negative exclusion interval is intentionally preserved. The table above contains the precise producer/caller and ordering boundaries; the following list makes the omissions explicit.

  • src/cli/cli-process-child.test-helpers.test.ts:367 — Independent runner guard fires at 400/2000 ms before readiness; passing >5s fault requires changing coupled clock semantics.

  • src/cli/update-cli/update-command-executor-legacy.test.ts:313 — Cleanup releases an independently grouped leaf by file; aborted test signal cannot safely bound the final join.

  • src/commands/agent-exec-plugin.e2e.test.ts:265 — Final release marker must still be consumed after test abort; needs independent exit observer before replacing cleanup join.

  • src/infra/device-identity.test.ts:299 — Host blocks inside synchronous DatabaseSync.prepare interception. Async IPC/socket callbacks cannot execute; deadline-free Atomics wait cannot observe the same-thread Vitest abort. Requires independently supervised synchronous acknowledgement.

  • src/infra/sqlite-worker-preparation.test.ts:42 — Producer is unlisted sqlite-worker-store.test-support.ts:161-174; its input has only markerPath/gatePath.

  • src/infra/sqlite-worker-preparation.test.ts:121 — Same unlisted preparation producer must emit entry receipt.

  • src/infra/tailscale.test.ts:435 — Diagnostic flush writer is unlisted test/fixtures/tailscale-foreground-fixture.mjs:26-34; public claim exposes outcome, not this flush callback.

  • src/infra/update-managed-service-handoff-boundary.test-support.ts:473 — Partial-write producer is unlisted update-managed-service-native.test-support.ts:50; needs receipt in that generator.

  • src/infra/update-managed-service-handoff.test-support.ts:148 — Deliberately killed helper no longer retains orphan close handle; test-signal residual can abandon cleanup.

  • src/infra/update-managed-service-handoff.test-support.ts:210 — Same orphan cleanup needs independent supervisor or cleanup-safe residual contract.

  • src/state/openclaw-agent-worker-store.test-support.ts:71 — Unlisted openclaw-agent-worker-store.test.ts:155-182 passes and releases path-only gates; MessagePort cutover needs that consumer.

  • src/state/openclaw-agent-worker-store.test-support.ts:86 — Same unlisted consumer, including finally release at :201-204, must migrate.

  • test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts:515 — Native Windows target exists, but requested Node bundles/Testbox proof are Linux-only. Original helper retained as waitForWindowsChildDeath.

  • src/plugins/install-record-commit.sqlite.test.ts:297 — Preserves full exclusion interval while first writer owns lease.

No out-of-allowlist producer/consumer was edited to bypass these constraints. Native Windows has a CI owner, but this lane’s Blacksmith evidence is Linux only; the native helper retains its original semantics. Worker BroadcastChannel support already existed on the base, but the blocked worker sites require unlisted fixture/caller changes. The short socket-root fallback later appeared on origin/main as 4dbd5fb85258; this lane did not edit or cherry-pick the shared helper.

The cross-file import/consumer search is preserved in [final-consumer-search.json] and [support-consumers.json]. The 24-target inventory includes the owning handoff/triage consumers. No context-dependent body emulation required an unlisted edit.

Named full-owner blocker: Gateway 2/4 ran once in its earlier67-file envelope and failed only untouched base assertions already repaired on main by 9413ff9a0639b1bf7385e62153ff059723d3980a (model refresh wording) and fd74b3415fa9d985253be34434e5430eae5ef568 (yielded requester history/private receipts). The changed agent-plugin file passed all three cases. The allowlist forbids changing those two test files; no remote patch or rerun merely to obtain green was used. The final weighted Gateway2 envelope has66 files and contains the same two stale tests; the prior failure remains attributable blocker evidence, not final execution of that66-file envelope. Three clean Gateway2 replays are therefore not claimed. Direct producer/source comparison: [gateway-2-blockers.md], [gateway-2-source-comparison.json], [gateway-2-failure-result.json].

Final package-owner scope blocker: Gateway3/4 on final tree ran the exact67-file owner once and failed after985.547s:546 passed,6 skipped,1 failed. The changed package test had67 passing and3 skipped assertions, zero failed. gateway-timeout-recovery-subagent.e2e.test.ts observed a generic failure outbound. Related mainfix 85f09d7ea34b80af6e79dc33807ce6780ccf2dd9 (#162260) changes the exact failing test and the persisted-user callback owner, but the retained logs do not expose the underlying Gateway exception. Exact attribution is unproven; this is not labeled inherited merely because the file is untouched. Replays2/3 were not run, and three clean replays are not claimed. See [gateway-3-final-blockers.md], [gateway-3-final-failure-result.json], [gateway-3-final-source-comparison.json].

Review STOP: the configured autoreview attempt returned HTTP 401 Unauthorized. Authentication recovery, credential lookup, and review retries were stopped exactly as instructed. An earlier review attempt had been interrupted after about 43 minutes without a verdict. No passing autoreview is claimed; coordinator review remains required. Evidence: [autoreview-stream.log] and [autoreview.log].

Evidence

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

Owning CI shard replays

Owner Clean replays / 3 Per-replay wall (s) Case/file summaries
agentic-cli 3/3 1: 298.577 (exit 0), 2: 312.942 (exit 0), 3: 277.309 (exit 0) [shard:agentic-cli] Test Files 394 passed | 1 skipped (395)
agentic-commands-agent-channel 3/3 1: 146.310 (exit 0), 2: 108.895 (exit 0), 3: 110.314 (exit 0) [shard:agentic-commands-agent-channel] Test Files 48 passed (48); [shard:agentic-commands-agent-channel] Tests 652 passed | 1 skipped (653); [shard:agentic-commands-agent-channel] Duration 143.37s (tests 72%, transform 23%, import 4%, worker 1%); [shard:agentic-commands-agent-channel] Test Files 48 passed (48); [shard:agentic-commands-agent-channel] Tests 652 passed | 1 skipped (653); [shard:agentic-commands-agent-channel] Duration 106.12s (tests 69%, transform 26%, import 4%, worker 1%); [shard:agentic-commands-agent-channel] Test Files 48 passed (48); [shard:agentic-commands-agent-channel] Tests 652 passed | 1 skipped (653); [shard:agentic-commands-agent-channel] Duration 107.57s (tests 68%, transform 26%, import 4%, worker 1%)
bundle-infra-small-3 3/3 1: 79.581 (exit 0), 2: 82.010 (exit 0), 3: 83.771 (exit 0) [shard:bundle-infra-small-3] Test Files 52 passed | 2 skipped (54)
bundle-infra-small-runtime-14 3/3 1: 176.649 (exit 0), 2: 249.539 (exit 0), 3: 177.865 (exit 0) [shard:bundle-infra-small-runtime-14] Test Files 63 passed | 1 skipped (64); [shard:bundle-infra-small-runtime-14] Tests 815 passed | 1 skipped (816); [shard:bundle-infra-small-runtime-14] Duration 158.65s (tests 72%, import 12%, transform 11%, setup 5%); [shard:bundle-infra-small-runtime-14] Test Files 63 passed | 1 skipped (64); [shard:bundle-infra-small-runtime-14] Tests 815 passed | 1 skipped (816); [shard:bundle-infra-small-runtime-14] Duration 204.22s (tests 74%, import 11%, transform 11%, setup 4%); [shard:bundle-infra-small-runtime-14] Test Files 63 passed | 1 skipped (64); [shard:bundle-infra-small-runtime-14] Tests 815 passed | 1 skipped (816); [shard:bundle-infra-small-runtime-14] Duration 154.38s (tests 74%, import 12%, transform 10%, setup 5%)
bundle-infra-small-runtime-19 3/3 1: 192.992 (exit 0), 2: 163.845 (exit 0), 3: 164.356 (exit 0) [shard:bundle-infra-small-runtime-19] Test Files 54 passed | 1 skipped (55); [shard:bundle-infra-small-runtime-19] Tests 1021 passed | 8 skipped (1029)
bundle-infra-small-runtime-20 3/3 1: 212.138 (exit 0), 2: 231.709 (exit 0), 3: 187.971 (exit 0) [shard:bundle-infra-small-runtime-20] Test Files 57 passed (57); [shard:bundle-infra-small-runtime-20] Tests 959 passed | 8 skipped (967); [shard:bundle-infra-small-runtime-20] Duration 207.82s (tests 88%, transform 7%, import 3%, setup 3%); [shard:bundle-infra-small-runtime-20] Test Files 57 passed (57); [shard:bundle-infra-small-runtime-20] Tests 959 passed | 8 skipped (967); [shard:bundle-infra-small-runtime-20] Duration 226.60s (tests 82%, transform 13%, import 3%, setup 2%); [shard:bundle-infra-small-runtime-20] Test Files 57 passed (57); [shard:bundle-infra-small-runtime-20] Tests 959 passed | 8 skipped (967); [shard:bundle-infra-small-runtime-20] Duration 184.29s (tests 84%, transform 10%, import 3%, setup 3%)
core-runtime-tui-pty 3/3 1: 453.864 (exit 0), 2: 378.892 (exit 0), 3: 341.704 (exit 0) [shard:core-runtime-tui-pty] Test Files 10 passed (10); [shard:core-runtime-tui-pty] Tests 143 passed | 1 skipped (144); [shard:core-runtime-tui-pty] Duration 449.55s (tests 95%, transform 5%); [shard:core-runtime-tui-pty] Test Files 10 passed (10); [shard:core-runtime-tui-pty] Tests 143 passed | 1 skipped (144); [shard:core-runtime-tui-pty] Duration 374.90s (tests 92%, transform 7%); [shard:core-runtime-tui-pty] Test Files 10 passed (10); [shard:core-runtime-tui-pty] Tests 143 passed | 1 skipped (144); [shard:core-runtime-tui-pty] Duration 338.53s (tests 93%, transform 6%)
Gateway 1/4 3/3 1: 887.328 (exit 0), 2: 831.178 (exit 0), 3: 682.392 (exit 0) replay 1: 66 files; 340 passed / 0 failed / 3 skipped of 343 cases; changed coverage {"test/e2e/qa-lab/runtime/gateway-heartbeat-session-routing.e2e.test.ts": {"failedTests": 0, "passedTests": 1, "status": "passed", "tests": 1}}; replay 2: 66 files; 340 passed / 0 failed / 3 skipped of 343 cases; changed coverage {"test/e2e/qa-lab/runtime/gateway-heartbeat-session-routing.e2e.test.ts": {"failedTests": 0, "passedTests": 1, "status": "passed", "tests": 1}}; replay 3: 66 files; 340 passed / 0 failed / 3 skipped of 343 cases; changed coverage {"test/e2e/qa-lab/runtime/gateway-heartbeat-session-routing.e2e.test.ts": {"failedTests": 0, "passedTests": 1, "status": "passed", "tests": 1}}
Gateway 2/4 0/3 pending / not recorded pending / not recorded
Gateway 3/4 0/3 1: 985.547 (exit 1) replay 1: 67 files; 546 passed / 1 failed / 6 skipped of 553 cases; changed coverage {"test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts": {"failedTests": 0, "status": "passed", "tests": 70}}

Earlier release-envelope results retained as historical evidence after heartbeat source and weighted membership changed; these do not contribute to the final-byte owner count:

Historical replay Wall (s) Cases Source
Gateway 2/4 replay 1 518.978 544 passed / 3 failed / 6 skipped [gateway-2-replays.log:432]
Gateway 1/4 replay 1 942.155 340 passed / 0 failed / 3 skipped [gateway-1-replays.log:257]
Gateway 1/4 replay 2 993.187 340 passed / 0 failed / 3 skipped [gateway-1-replays.log:282]
Gateway 1/4 replay 3 810.477 340 passed / 0 failed / 3 skipped [gateway-1-replays.log:303]
Gateway 4/4 replay 1 960.726 713 passed / 0 failed / 13 skipped [gateway-4-replays.log:265]
Gateway 4/4 replay 2 1004.376 713 passed / 0 failed / 13 skipped [gateway-4-replays.log:290]
Gateway 4/4 replay 3 953.502 713 passed / 0 failed / 13 skipped [gateway-4-replays.log:314]

Passing logs explicitly confirm touched-file/consumer execution. The first CLI and infra-small-3 local log filters dropped prefixed total Tests lines; file totals (394+1 skipped and 52+2 skipped) and touched passing-case coverage (163 and 41 lines per replay) remain valid. These coverage-line counts are not full shard case totals. Successful shards were not rerun solely to recover missing summary text. Later owner payloads retained prefixed totals or Vitest JSON.

Full ownership/source and replay artifacts: [owning-shard-coverage.json], [release-e2e-shards.json], [candidate-runtime19-results.json], [gateway-replays-evidence.json], [handoff-shard-agentic-commands-agent-channel-summary.json]

Types, lint, review

The candidate-owner typechecks precede the plugin/heartbeat lifecycle revisions and remain proof for unchanged inputs. Final plugin proof adds targeted core:test and final heartbeat proof adds root tsgo; current owner log/results below distinguish that new receipt.

  • Exit 0; 276.011s; [candidate-owner-final.log:452]:
pnpm tsgo:core:test --changed-paths-json '["src/commands/agent-exec-plugin.e2e.test.ts", "src/commands/agent-exec.construction.test.ts", "src/infra/update-candidate-state.budget.test.ts", "src/infra/update-candidate-state.cleanup.test.ts", "src/infra/update-managed-service-handoff-boundary.test-support.ts", "src/infra/update-managed-service-handoff-process.test-support.ts", "src/infra/update-managed-service-handoff.test-support.ts", "src/infra/update-managed-service-triage.test-support.ts", "src/plugins/install-record-commit.sqlite.test.ts", "src/tui/tui-pty-local.e2e.test.ts"]'
  • Exit 0; 191.880s; [candidate-owner-final.log:459]:
pnpm tsgo:test:root
  • Exit 0; 93.422s; [combined-plugin-ipc-final-proof.log:582]:
pnpm tsgo:core:test --changed-paths-json '["src/plugins/install-record-commit.sqlite.test.ts"]'
  • Exit 0; 174.114s; [heartbeat-final-proof.log:319]:
pnpm tsgo:test:root

Final static commands: node_modules/.bin/oxfmt --check <12 changed files>; type-aware oxlint --tsconfig config/tsconfig/oxlint.core.json <changed src files>; root test files through their owning config where recorded; git diff --check; and node --import ./scripts/tsx.mjs scripts/check-test-timeout-race-ratchet.mts --base origin/main.

Fresh final-source checks are recorded in [final-static-results.json] and [final-precommit-checks.log]. The collector verifies every recorded source hash against the final file bytes; all five checks passed, including root type-aware lint. This supersedes the older silent/raw local logs.

  • Exit 0; 0.071s:
node_modules/.bin/oxfmt --check src/commands/agent-exec-plugin.e2e.test.ts src/commands/agent-exec.construction.test.ts src/infra/update-candidate-state.budget.test.ts src/infra/update-candidate-state.cleanup.test.ts src/infra/update-managed-service-handoff-boundary.test-support.ts src/infra/update-managed-service-handoff-process.test-support.ts src/infra/update-managed-service-handoff.test-support.ts src/infra/update-managed-service-triage.test-support.ts src/plugins/install-record-commit.sqlite.test.ts src/tui/tui-pty-local.e2e.test.ts test/e2e/qa-lab/runtime/gateway-heartbeat-session-routing.e2e.test.ts test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts
  • Exit 0; 3.985s:
node_modules/.bin/oxlint --type-aware --tsconfig config/tsconfig/oxlint.core.json src/commands/agent-exec-plugin.e2e.test.ts src/commands/agent-exec.construction.test.ts src/infra/update-candidate-state.budget.test.ts src/infra/update-candidate-state.cleanup.test.ts src/infra/update-managed-service-handoff-boundary.test-support.ts src/infra/update-managed-service-handoff-process.test-support.ts src/infra/update-managed-service-handoff.test-support.ts src/infra/update-managed-service-triage.test-support.ts src/plugins/install-record-commit.sqlite.test.ts src/tui/tui-pty-local.e2e.test.ts
  • Exit 0; 2.913s:
node_modules/.bin/oxlint --type-aware --tsconfig test/tsconfig/tsconfig.test.root.json test/e2e/qa-lab/runtime/gateway-heartbeat-session-routing.e2e.test.ts test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts
  • Exit 0; 5.560s:
node --import ./scripts/tsx.mjs scripts/check-test-timeout-race-ratchet.mts --base origin/main
  • Exit 0; 0.134s:
git diff --check

Ratchet origin/main at the final static run: c1600bbf16614de4f72e3f59d158fedff3ea8959; timestamp 2026-10-01T16:00:45.579184+00:00.

[final-root-type-lint-result.json]

[final-static-results.json]

[final-precommit-checks.log]

Coordinator follow-up (supersedes the lane's owner-gate notes above)

Follow-up: ClawSweeper timeout-teardown findings (coordinator)

ClawSweeper found two real P2 defects in this conversion: in src/infra/update-candidate-state.budget.test.ts and src/commands/agent-exec-plugin.e2e.test.ts, a converted wait can now run until the enclosing test aborts, and Vitest runs the file's teardown (mock restore, temp-directory removal) without awaiting the abandoned body, so the body's finally could lose its release file or stop markers and skip worker cancellation or descendant cleanup. 334ea44 retains the complete fixture lifetime in one memoized cleanup that both the body and teardown await, keeps the directories and markers until that join, and makes a failed release write unable to bypass cancellation. Forced-abort probes reproduce all four teardown defects on the previous bytes and pass on the fix. Re-proof on Blacksmith Testbox: 20/20 standalone runs per file, Node owner 3/3, Gateway E2E 2/4 2 clean replays (the third could not be admitted while Testbox was saturated), targeted types, type-aware lint (including the CI lint wrapper's unused-directive check), oxfmt, pnpm deadcode:full, base-aware ratchet.

Selected CLI, update, plugin, TUI, and packaging tests polled PID files,
marker files, and process death against wall-clock deadlines of 2 to 120
seconds. Healthy child startup and cleanup could outlast those deadlines.

Await existing callbacks, retained child close events, IPC, and fixture
receipts instead. Consult durable markers when operation settlement wins
an independent receipt race, and read state once after an owner has
already joined cleanup. Bind unavoidable foreign-PID observation to the
Vitest test signal. Retain the negative lock-exclusion observation.

Join candidate worker settlement before timed-out test teardown removes
its fixture directory or restores mocks. Retain the plugin fixture through
onTestFinished so timeout cannot abandon child-close and state cleanup.
Join heartbeat fixture shutdown before outer runtime and SQLite teardown.
Preserve fake-clock boundaries, assertions, test timeouts, and product
timeout and grace values.
@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 commands Command implementations size: L labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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, 7:14 PM ET / 23:14 UTC (Revision 2).

ClawSweeper review

What this changes

The PR replaces deadline-based polling in CLI, update, plugin, TUI, and Gateway tests with fixture signals and cleanup joins that survive test cancellation.

Merge readiness

⛔ Needs changes before merge - 1 item remains

The PR remains useful: current main retains the affected polling deadlines. Both previous cleanup findings are resolved, and no remaining blocking code defect was found.

Likely related people: steipete and fuller-stack-dev (unverified routing candidates).

Priority: P2
Reviewed head: 334ea447cc7fc0889c529e5d43168c97af66570b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-infrastructure repair with both previous defects resolved and no remaining blocking code finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a MEMBER author, so the external-contributor proof gate does not apply. Testbox evidence exercises the changed fixture cancellation and teardown paths; no production stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a MEMBER author, so the external-contributor proof gate does not apply. Testbox evidence exercises the changed fixture cancellation and teardown paths; no production stored-data contract changes.
Evidence reviewed 10 items Pinned introduction reviewed: Reviewed the complete introduced hunks from c1fa9c0 to 334ea44. All changes are tests or test support; endpoint drift and the stale test merge were not treated as PR edits.
Previous budget finding resolved: The teardown hook awaits the memoized fixture cleanup before restoring mocks or removing directories. Both budget fixtures share that cleanup with their finally blocks; failed release writes cannot bypass cancellation and worker settlement.
Previous transport finding resolved: Transport teardown retains receipt and stop-marker files until the shared cleanup finishes. Cleanup aborts and joins the CLI operation, releases descendants, and joins PID extinction; a failed stop-marker write invokes SIGKILL before the extinction join.
Findings None None.
Security None None.

How this fits together

These test fixtures exercise OpenClaw commands, update workers, and Gateway lifecycle behavior. Their readiness and process-exit observations determine when assertions run and when temporary state can safely be removed.

flowchart TD
  A[Test starts fixture] --> B[Command or Gateway runs]
  B --> C[Readiness signal or durable receipt]
  C --> D[Test assertions]
  E[Test cancellation] --> F[Shared cleanup join]
  D --> F
  F --> G[Retire temporary state]
Loading

Before merge

  • Complete next step (P2) - Complete and record the third clean Gateway E2E 2/4 owner-shard replay for the latest fix, as required by the repository's flake-triage policy.
Agent review details

Security

None.

PR surface

Tests +386. Total +386 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 11 575 189 +386
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 575 189 +386

Review metrics

Metric Value Why it matters
Production versus test growth production +0; tests and test support +386 net lines The added synchronization stays in fixtures and introduces no production hooks.
Latest owner replay coverage Node owner 3/3; Gateway 2/4 owner 2/3 The repository's three-replay flake-validation gate remains incomplete for the latest transport fix.

Technical review

Best possible solution:

Keep fixture synchronization tied to existing readiness and settlement owners, with temporary state retained until cancellation cleanup completes.

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

Yes, from source: healthy fixture startup or extinction can exceed the fixed polling deadlines retained on current main. This read-only review did not execute a current-main failure.

Is this the best way to solve the issue?

Yes. Existing callbacks, receipts with durable fallback, and shared cleanup joins repair synchronization without changing production behavior or extending deadlines.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a MEMBER author, so the external-contributor proof gate does not apply. Testbox evidence exercises the changed fixture cancellation and teardown paths; no production stored-data contract changes.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded test-infrastructure reliability repair without a user-visible runtime change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a MEMBER author, so the external-contributor proof gate does not apply. Testbox evidence exercises the changed fixture cancellation and teardown paths; no production stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction reviewed: Reviewed the complete introduced hunks from c1fa9c0 to 334ea44. All changes are tests or test support; endpoint drift and the stale test merge were not treated as PR edits. (334ea447cc7f)
  • Previous budget finding resolved: The teardown hook awaits the memoized fixture cleanup before restoring mocks or removing directories. Both budget fixtures share that cleanup with their finally blocks; failed release writes cannot bypass cancellation and worker settlement. (src/infra/update-candidate-state.budget.test.ts:25, 334ea447cc7f)
  • Previous transport finding resolved: Transport teardown retains receipt and stop-marker files until the shared cleanup finishes. Cleanup aborts and joins the CLI operation, releases descendants, and joins PID extinction; a failed stop-marker write invokes SIGKILL before the extinction join. (src/commands/agent-exec-plugin.e2e.test.ts:287, 334ea447cc7f)
  • Re-review continuity verified: The exact-head GitHub commit patch confirms that the follow-up changes both previously flagged files and records parent 587ac88. Local earlier-head blob comparison failed with an HTTP 403 during object retrieval; the GitHub commit patch provided the comparison instead. (334ea447cc7f)
  • Complete captured proof context inspected: The fetched full body matches captured SHA-256 0a9c3bfe1f496cd83117f9df8112ce3a2d8289e2fedf287d4d1643de52ca4356. Its coordinator follow-up reports forced-abort probes failing on previous bytes and passing after the fix, 20/20 standalone runs per changed follow-up file, three clean Node-owner replays, and two clean Gateway 2/4 replays; the third Gateway replay was not admitted because Testbox was saturated. (334ea447cc7f)
  • Remaining repository validation gate: The flake-triage contract requires 20 clean standalone runs and three clean runs of the original shard. The latest transport fix currently records only two of the required three Gateway-owner replays. Public docs: docs/help/testing/writing-tests.md. (docs/help/testing/writing-tests.md:139, 334ea447cc7f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: 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 the third clean Gateway E2E 2/4 owner-shard replay for the latest fix, completing the repository's flake-validation gate.

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-10-01T19:18:23.708Z sha 587ac88 :: blocked before merge. :: [P2] Join budget fixture cleanup before retiring its temporary directory | [P2] Keep transport release files alive until timeout cleanup finishes

Converted budget readiness and transport-extinction waits can reject at the
enclosing test timeout. Vitest may run afterEach while the body's finally
still owns release writes and worker settlement, removing state too early.

Share a memoized cleanup promise between finally, afterEach, and
onTestFinished. Join it before removing temporary directories or restoring
mocks. Cancel and join workers even if a release write fails, and keep
transport receipts and the stop marker until the CLI and descendants settle.

Preserve existing assertions and all test and product deadlines.
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 1, 2026
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Third Gateway E2E 2/4 owner-shard replay on 334ea44 (Blacksmith Testbox): exit 0, 590.7 s, 67 files / 519 tests (513 passed, 6 skipped), no failures; both changed files ran and passed (agent-exec-plugin 3 passed; package-openclaw-for-docker 67 passed, 3 skipped). Gateway 2/4 is now 3/3 clean on the final head.

@steipete
steipete merged commit 47ff1fd into main Oct 2, 2026
134 of 136 checks passed
@steipete
steipete deleted the steipete/poll-infra-cli-2 branch October 2, 2026 00:01
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…teway tests fail on loaded hosts when fixture children outlast polling deadlines (openclaw#162945)

agent-exec (plugin e2e and construction), update candidate-state budget/cleanup, managed-service handoff boundary/process support, plugin install-record commit, the local TUI PTY e2e, and the QA Lab Gateway heartbeat-routing and package-for-Docker tests polled readiness/PID files or raced process exit against fixed timers, so a fixture child or preparation step that outlasted the bound on a loaded host failed the test.

Waits now await existing owner callbacks (such as the command onOutputChunk readiness), retained child close promises, fixture receipts with a durable-record fallback where the product owns the child, and same-process fixture events registered before the Gateway starts. The rebase keeps openclaw#162694's managed-service triage receipts byte-for-byte, openclaw#162403's cleanup directory-retirement fault, and openclaw#162496's Bun preload settings, and layers this lane's receipts and joins on top. Thirteen sites stay unchanged where independent runner clocks, post-abort cleanup joins, a synchronously blocked host, out-of-scope producers, or killed helpers without a close handle leave no owned signal. The budget and agent-exec plugin tests keep their whole fixture lifetime until teardown joins it, so a timed-out body can no longer lose its release file or stop markers to afterEach (forced-abort probes reproduce the four defects before the fix). No product source, test timeout, product timeout, or assertion meaning changed.

Follow-up to openclaw#162696 in the polling audit from openclaw#162274. Proof on Blacksmith Testbox: delay probes fail the original bytes and pass these bytes, forced-abort probes reach cleanup, 480 standalone runs, 120/120 on the rebased head, Gateway E2E shards 2/4 and 3/4 3/3 each (2/4 re-proven 3/3 on the final teardown-fix head), type-aware lint, deadcode, base-aware timeout-race ratchet; Codex autoreview clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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