Skip to content

fix(test): Gateway run-loop, update executor, hooks, and ClawHub CLI process tests fail on loaded hosts when fixture children outlast polling deadlines - #163044

Merged
steipete merged 1 commit into
mainfrom
steipete/poll-w2-cli-process
Oct 1, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/poll-w2-cli-process

Conversation

@steipete

@steipete steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: CLI process tests for the Gateway run loop (package helper/lifecycle, update respawn, direct stop with active work, forced cron, model acquisition), the hooks CLI, ClawHub plugin search, the update command executor (auxiliary/native) and service custody, cleanup-utils handle exclusion, and triage fail on a loaded host when a fixture child outlasts a wall-clock wait (5–45 s withTestTimeout/vi.waitFor/expect.poll), because they poll trace, PID, and readiness files or race child close 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.

Why This Change Was Made

Part of the polling audit from #162274. Waits now await registered close promises, existing stdout readiness lines and close gates, fixture receipts with durable-record fallback where the product owns the child, and owned triage callbacks; existing rescue SIGKILLs remain for failure paths. The ClawHub search e2e consumes the fixture server's native { port } IPC readiness that #162848 added, rather than adding a second message shape.

Deliberately unchanged (20 sites): waits inside the shared test/helpers/stop-child-process.ts TERM/KILL owner (its grace and final-kill guard are coupled), product-owned scripts with no retained child handle or reap receipt, and similar cases listed below. No product source, product grace, test timeout, or assertion meaning changed.

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

Per-site conversions

Old line numbers are the work-order identifiers. Categories: 1 existing owned signal; 2 fixture IPC/stdout; 3 product-child receipt with durable ordering; 4 direct assertion after an owner join; 5 deadline-free test-signal-bound residual. “Adjacent” marks an additional same-owner wait.

Site Old wait / deadline New signal Category Class Ordering or reason
src/cli/cli-process-child.test-helpers.ts:52 stopChildProcess(force: true); 5s final KILL guard Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/cli/gateway-cli/run-loop-package-helper.test-support.ts:232 withTimeout(close); 15s Captured helper close promise 1 B observeFixtureHelper captures close synchronously at spawn; existing boundary cleanup still cancels and reaps the helper.
src/cli/gateway-cli/run-loop-package-lifecycle.test-support.ts:322 expect.poll(script-entered); 15s Fixture receipt after durable PID marker, with marker fallback on helper settlement 3 B writePackageLifecycleFixture writes script-entered before sendReceipt; independent receipt delivery cannot invalidate an already-written marker.
src/cli/gateway-cli/run-loop-package-lifecycle.test-support.ts:537 expect.poll(script PID dead); 15s Unchanged deferred B Product-owned script has no retained child handle or reaping receipt. A pre-exit message cannot prove extinction; close/exit receipt capability is unavailable.
src/cli/gateway-cli/run-loop-package-lifecycle.test-support.ts:445 waitForClose; 15s Captured helper close via withinTest 1 B Cancellation remains with its existing owner; observation joins the exact helper without a second local deadline.
src/cli/gateway-cli/run-loop-package-lifecycle.test-support.ts:313 waitForClose; 15s Captured helper close via withinTest 1 C Cancellation remains with its existing owner; observation joins the exact helper without a second local deadline.
src/cli/gateway-cli/run-loop-package-lifecycle.test-support.ts:454 expect.poll(helper PID dead); 15s Close promise, then direct PID assertion 4 C src/cli/gateway-cli/run-loop-package-helper.test-support.ts:211 captures the exact helper close; src/cli/gateway-cli/run-loop-package-lifecycle.test-support.ts:471 joins it before the PID assertion at :472. Existing cancellation already owns termination.
src/cli/gateway-cli/run-loop-update-respawn.test-support.ts:253 withTimeout(parked IPC); 5s Existing message raced against captured close, withinTest 1 A The child installs its IPC handler before reporting parked; early close fails fast.
src/cli/gateway-cli/run-loop-update-respawn.test-support.ts:305 withTimeout(listening IPC); 5s Existing message raced against captured close, withinTest 1 B Message subscription precedes listen command; fixture sends listening from socket listen callback.
src/cli/gateway-cli/run-loop-update-respawn.test-support.ts:312 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/cli/gateway-cli/run-loop.direct-stop-active-work.process.test.ts:31 withTestTimeout(close batch); 5s Registered close promises 1 B Existing rescue SIGKILL remains; close joins native streams before temporary-directory deletion.
src/cli/gateway-cli/run-loop.direct-stop-active-work.process.test.ts:216 vi.waitFor(gateway-ready trace); 45s Existing stdout readiness line and close gate, withinTest 1 B Fixture trace() records gateway-ready before emitting its existing stdout line; trace assertions remain.
src/cli/gateway-cli/run-loop.direct-stop-active-work.process.test.ts:168 withTestTimeout(stdout ready); 45s Existing stdout data event and close gate, withinTest 1 B Existing afterEach retains rescue ownership; close before output fails fast.
src/cli/gateway-cli/run-loop.forced-cron.process.test.ts:106 withTestTimeout(close); 5s Registered close promise, withinTest 1 A Normal stop/drain owns exit; afterEach remains failure rescue.
src/cli/gateway-cli/run-loop.forced-cron.process.test.ts:103 waitForOutput readiness; 15s Existing output event and retained text, close gate, withinTest 1 B Accumulated readiness fact remains observable even if produced before wait registration.
src/cli/gateway-cli/run-loop.forced-cron.process.test.ts:86 waitForOutput readiness; 45s Existing output event and retained text, close gate, withinTest 1 B Accumulated readiness fact remains observable even if produced before wait registration.
src/cli/gateway-cli/run-loop.forced-cron.process.test.ts:22 withTestTimeout(close batch); 5s Registered close promises 1 C Joins existing failure rescue before temporary cleanup.
src/cli/gateway-cli/run-loop.model-acquisition.process.test.ts:73 withTestTimeout(close); 20s Close event, withinTest; original duration assertions retained 1 B Elapsed native stop budget assertions still enforce the intentional latency contract; only the redundant preemptive timeout race is removed.
src/cli/gateway-cli/run-loop.model-acquisition.process.test.ts:115 withTestTimeout(finally close); 5s Registered close promise 1 C Existing conditional rescue SIGKILL is followed by native close join.
src/cli/gateway-cli/run-loop.model-acquisition.process.test.ts:66 (adjacent) vi.waitFor(startup output); 45s Owned stdout deferred, close gate, withinTest 1 B Adjacent same-owner readiness wait; exact startup fact and assertions preserved.
src/cli/hooks-cli.process.test.ts:387 expect.poll(relay ready PID); 45s Fixture stdout line after durable PID marker; withinTest close gate 2 B Generated preload writes RELAY_READY_MARKER synchronously before emitting relay-ready.
src/cli/hooks-cli.process.test.ts:398 expect.poll(timeout-owned PID dead); 5s Direct assertion after captured close and same-PID log equality 4 C src/cli/hooks-cli.process.test.ts:156 writes the ready PID before stdout at :157; :411 proves all recorded PIDs equal the owned shell PID; :414 joins close before the direct checks at :416. No cleanup is initiated by the checks.
src/cli/hooks-cli.process.test.ts:401 expect.poll(all recorded relay PIDs dead); 5s Direct assertion after captured close and same-PID log equality 4 C src/cli/hooks-cli.process.test.ts:156 writes the ready PID before stdout at :157; :411 proves all recorded PIDs equal the owned shell PID; :414 joins close before the direct checks at :416. No cleanup is initiated by the checks.
src/cli/plugins-search-command.clawhub.e2e.test.ts:119 500 x 5ms port-file checks; nominal 2.5s Owned IPC carrying bound port, close gate, withinTest 2 A scripts/e2e/lib/clawhub-fixture-server.cjs sends port only after listen callback and synchronous port-file write.
src/cli/plugins-search-command.clawhub.e2e.test.ts:21 stopServer exit race; 1s TERM grace Pre-registered close promise; TERM/KILL grace retained 1 B The 1s timer owns escalation, not an assertion deadline; final native close is joined even if exit was already recorded.
src/cli/runtime-cleanup-scope.windows.process.test.ts:32 IPC ready; 20s Windows-deferred deferred B Native Windows Job/descendant contract cannot be proved on this Linux Testbox lane. File is present in test:windows:ci:2 / ci-windows-test-plan.mts; no claim that Linux skips prove Windows behavior. Exact owner extinction receipt is also unavailable.
src/cli/runtime-cleanup-scope.windows.process.test.ts:43 waitForPidToExit; 2s Windows-deferred deferred C Native Windows Job/descendant contract cannot be proved on this Linux Testbox lane. File is present in test:windows:ci:2 / ci-windows-test-plan.mts; no claim that Linux skips prove Windows behavior. Exact owner extinction receipt is also unavailable.
src/cli/update-cli/update-command-database-rollback.test.ts:544 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/cli/update-cli/update-command-database-rollback.test.ts:123 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/cli/update-cli/update-command-database-rollback.test.ts:501 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/cli/update-cli/update-command-executor-auxiliary.test.ts:292 vi.waitFor(descendant drain-entry); 5s Fixture receipt after durable marker; settlement checks marker; withinTest 3 A Generated fixture writes the marker before sendReceipt. The command result cannot invalidate readiness merely by overtaking socket delivery.
src/cli/update-cli/update-command-executor-auxiliary.test.ts:111 vi.waitFor(installer readiness); 5s Fixture receipt after durable marker; settlement checks marker; withinTest 3 A Generated fixture writes the marker before sendReceipt. The command result cannot invalidate readiness merely by overtaking socket delivery.
src/cli/update-cli/update-command-executor-native.test.ts:333 vi.waitFor(spawner PID dead); 5s Exact spawned child exit deferred, withinTest, then original dead-PID assertion 1 B The test captures the actual spawner exit event before SIGKILL; that event follows OS root retirement.
src/cli/update-cli/update-command-executor-native.test.ts:405 vi.waitFor(surviving receiver dead); 5s Unchanged deferred B Finally-only cleanup of a foreign receiver whose spawner intentionally exits. Exact receiver exit/reaper receipt is unavailable; no test-owned cleanup was substituted as autonomous-cleanup proof.
src/cli/update-cli/update-command-executor-native.test.ts:305 vi.waitFor(receiver ready); 20s Fixture receipt after durable marker, withinTest 3 B Markers are written/renamed before receipts. Ordinary operation settlement consults marker; killed-spawner case intentionally awaits receiver receipt directly because its spawner has already settled.
src/cli/update-cli/update-command-executor-native.test.ts:347 vi.waitFor(operation results done); 20s Fixture receipt after durable marker, withinTest 3 B Markers are written/renamed before receipts. Ordinary operation settlement consults marker; killed-spawner case intentionally awaits receiver receipt directly because its spawner has already settled.
src/cli/update-cli/update-command-executor-native.test.ts:341 vi.waitFor(config precommit); 15s Fixture receipt after durable marker, withinTest 3 C Markers are written/renamed before receipts. Ordinary operation settlement consults marker; killed-spawner case intentionally awaits receiver receipt directly because its spawner has already settled.
src/cli/update-cli/update-command-executor.test.ts:965 vi.waitFor(orphan tree extinction); 2s Unchanged deferred B These are finally-only checks after test-issued TERM; spawnSync parents intentionally exited. No retained exact reaper/exit receipt exists; no replacement termination owner was invented.
src/cli/update-cli/update-command-executor.test.ts:905 vi.waitFor(candidate group extinction); 2s Unchanged deferred B These are finally-only checks after test-issued TERM; spawnSync parents intentionally exited. No retained exact reaper/exit receipt exists; no replacement termination owner was invented.
src/cli/update-cli/update-command-handoff.test.ts:142 expect.poll(caller result + helper-exit); 20s Unchanged deferred B Detached helper writes exit trace synchronously in process exit handler; current socket helper cannot guarantee a post-exit/reaping receipt.
src/cli/update-cli/update-command-handoff.test.ts:178 expect.poll(helper-exit in finally); 1s Unchanged deferred C Failure cleanup may lack the normal-body helper completion fact; caller/Gateway close does not join the detached helper.
src/cli/update-cli/update-command-service-custody.test.ts:336 vi.waitFor(receiver tree dead); 5s One 10ms native check, no deadline, bounded by test signal 5 B child-process-tree.ts:10-22 checks the process group; leader close does not join loader descendants. Existing rejection rescue remains, with Fixture tree did not settle on abort.
src/cli/update-cli/update-command-service-maintenance-native.test.ts:258 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/cli/update-cli/update-command-service-maintenance-native.test.ts:454 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/commands/cleanup-utils.handle-exclusion.test.ts:80 IPC readiness + timeout; 10s Existing IPC event and pre-captured close gate, withinTest 1 A Peer sends readiness after DB initialization/open; unexpected close fails fast.
src/commands/cleanup-utils.handle-exclusion.test.ts:154 IPC readiness + timeout; 15s Existing IPC event and pre-captured close gate, withinTest 1 B Peer sends readiness after DB initialization/open; unexpected close fails fast.
src/commands/cleanup-utils.handle-exclusion.test.ts:104 child close + timeout; 10s Pre-registered child close, withinTest 1 B Subscription is captured immediately after spawn, before the existing close request.
src/commands/cleanup-utils.handle-exclusion.test.ts:161 child close + timeout; 10s Pre-registered child close, withinTest 1 B Subscription is captured immediately after spawn, before the existing close request.
src/commands/cleanup-utils.handle-exclusion.test.ts:113 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred C test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/commands/cleanup-utils.handle-exclusion.test.ts:167 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred C test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/commands/cleanup-utils.handle-exclusion.test.ts:73 (adjacent) write reply + timeout; 10s Existing IPC reply and captured close gate, withinTest 1 B Adjacent same-owner reply wait; listener precedes write request; SQLite result assertions are unchanged.
src/commands/doctor-config-preflight.process.test.ts:826 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/commands/doctor-maintenance.serving-owner.test.ts:249 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred B test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/commands/doctor-maintenance.serving-owner.test.ts:286 stopChildProcess; 5s per TERM/KILL Unchanged shared termination owner deferred C test/helpers/stop-child-process.ts:13-35 couples TERM grace and final KILL guard. Removing the final deadline requires a canonical helper change across its consumers; no caller-local terminator was added.
src/commands/triage.test.ts:570 vi.waitFor(headless PID file); 1s Receipt after durable PID, with operation-settlement record check, withinTest 3 A triage.test-support.ts writes process.pid before sendReceipt. Triage cancellation still awaits the real exec result; exec-runner.ts:562-570 joins child plus process cleanup.

Stops, residuals, and deliberately unconverted sites

Evidence

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

Fault and forced-abort probes

Fault Original result Candidate result
Successor parked IPC delayed 6500ms Failed at old 5000ms deadline: Error: timeout 1 passed
Cron native exit delayed 6500ms 3 failures: Cron restart child did not close 3 passed
Legacy SQLite initialization delayed 11000ms Old 10000ms readiness aborted: AbortError: The operation was aborted 1 passed
Headless fixture PID publication delayed 1500ms Old 1000ms wait failed with ENOENT / child.pid 1 passed
Auxiliary installer ready write delayed 6500ms 2 failures at old 5000ms wait: expected false to be true 2 passed
ClawHub fixture startup delayed 6000ms Old nominal 2500ms wait failed: fixture server did not write a port 1 passed

Each delay was applied at the same healthy boundary to original and fixed bytes. Temporary mutations were restored byte-exactly; the final probe batch emitted ALL_PROBES_RESTORED True. Proof recipes and executed results are in [gateway-probes.py], [commands-probes.py], [commands-receipt-abort-probe.py], [update-executor-probes.py], [custody-probes.py], [probes-standalone.log], and [resume-probes-standalone-v2.log].

Forced-abort probes reached first-finally markers and verified exact PID extinction for owned IPC, stdout readiness, product-child receipts, and the residual process-group wait; the latter also verified group absence. The headless receipt probe captured the producer PID before suspension and verified that the existing cancellation result joined before checking PID absence externally.

Two temporary headless-probe instrumentation attempts were inconclusive: the first reread its PID file after Vitest had started temp cleanup, and the second observed a node spawn mock bypassed by the real broker/Execa path. The corrected producer-PID/owner-result probe passed without source changes. Vitest timeout sequencing (node_modules/vitest/dist/chunks/run.C5UmxDPh.js:3273-3275,3879-3904), test/helpers/temp-dir.ts:54,86-90, and src/process/exec-runner.ts:562-570 explain the observation race.

Direct close-wait abort evidence: [close-abort-agentic-cli.log]; temporary recipe [gateway-close-abort-probe.py]. Its success marker and restoration receipt are recorded in that log.

Standalone repetitions (flake-triage bar)

Each command was CI=1 pnpm test <file> --maxWorkers=1. ClawHub ran serially because its E2E preparation owns shared build artifacts; the other files ran up to four different files concurrently, with no overlapping runs of the same file.

File Before wall (s) Candidate smoke wall (s) Final clean runs Final mean / min / max wall (s)
src/cli/gateway-cli/run-loop.test.ts 62.226 71.792 20/20 78.705 / 60.847 / 108.261
src/cli/gateway-cli/run-loop.direct-stop-active-work.process.test.ts 27.835 30.478 20/20 34.684 / 27.025 / 45.394
src/cli/gateway-cli/run-loop.forced-cron.process.test.ts 30.87 33.769 20/20 39.929 / 30.564 / 52.705
src/cli/gateway-cli/run-loop.model-acquisition.process.test.ts 45.115 49.064 20/20 58.472 / 44.714 / 70.272
src/cli/hooks-cli.process.test.ts 37.516 43.391 20/20 44.777 / 34.353 / 63.489
src/cli/plugins-search-command.clawhub.e2e.test.ts 942.814 42.993 20/20 38.937 / 35.828 / 42.109
src/cli/update-cli/update-command-executor-auxiliary.test.ts 28.889 29.725 20/20 36.560 / 27.936 / 52.372
src/cli/update-cli/update-command-executor-native.test.ts 33.519 33.477 20/20 38.572 / 34.215 / 49.997
src/cli/update-cli/update-command-service-custody.test.ts 32.125 30.76 20/20 35.885 / 26.023 / 48.829
src/commands/cleanup-utils.handle-exclusion.test.ts 24.262 22.981 20/20 26.924 / 22.234 / 33.310
src/commands/triage.test.ts 31.725 29.301 20/20 32.728 / 21.597 / 45.726

The ClawHub before measurement includes a cold QA runtime prebuild (14m55s); the candidate smoke reused that verified generation. That difference is not attributed to the conversion. Gateway/model-acquisition suites exercise real startup, native signals, shutdown ordering and the intentional native stop-budget contract; their cost is recorded rather than reduced by weakening those contracts.

Cross-file audit used git grep on every changed basename. There are no emulated test-body consumers requiring context adaptations. The run-loop support registration is covered by run-loop.test.ts. The existing triage support module has nine additional consumers, and the ClawHub server has three script-test consumers; these are included in the payload.

Additional consumer results recorded: 12/12 completed commands (expected 12). See [standalone.sh] and [resume-probes-standalone-v2.log].

Owning CI shard replays

Bundles were derived from createNodeTestShardBundles({ includeReleaseOnlyToolingShards: true, includeProofTests: true }). Their group JSON and runnable payloads are retained beside this report. Each replay uses OPENCLAW_NODE_TEST_GROUPS_JSON=<group> CI=1 node --import tsx scripts/ci-run-node-test-shard.mts. Passed verbose-case receipts must name the touched files; merely listing planned filenames is insufficient. The ClawHub E2E test has no node-bundle owner and is covered by standalone E2E repetitions.

Shard Clean replays Replay walls (s) Result log
agentic-cli 3/3 251.843, 233.618, 236.058 [close-abort-agentic-cli.log]
agentic-cli-process 3/3 1103.765, 1078.065, 1041.295 [agentic-cli-process.log]
agentic-commands-status-tools 3/3 132.517, 127.002, 109.116 [agentic-commands-status-tools.log]
core-tooling-2 3/3 357.39, 259.506, 246.508 [core-tooling-2.log]

agentic-cli test counts in each clean replay:

Test Files  394 passed | 1 skipped (395)
Tests  6668 passed | 31 skipped (6699)

agentic-cli-process test counts in each clean replay:

Test Files  56 passed | 1 skipped (57)
Tests  831 passed | 10 skipped (841)

agentic-commands-status-tools test counts in each clean replay:

Test Files  117 passed (117)
Tests  1552 passed | 1 skipped (1553)

core-tooling-2 test counts in each clean replay:

Test Files  58 passed (58)
Tests  2263 passed (2263)

Types, lint, review

  • Targeted remote types: pnpm tsgo:core:test --changed-paths-json <changed paths> — passed.
  • Local node_modules/.bin/oxfmt --check on final changed files, type-aware oxlint with config/tsconfig/oxlint.core.json and config/tsconfig/oxlint.scripts.json, and git diff --check: passed. [local-final-checks.log] and final ClawHub checks [local-type-fix-checks.log].
  • node --import ./scripts/tsx.mjs scripts/check-test-timeout-race-ratchet.mts --base origin/main: passed, 154 files, 370 grandfathered sites; three rows removed, no increases.
  • scripts/run-opengrep.sh --changed --sarif --error: passed, 106 rules, zero findings. The pinned 1.30.0 binary was downloaded into task scratch after PATH lacked opengrep; no global installation. [opengrep-final-after-type.log].
  • Changed-gate dry run selected coreTests and tooling: [changed-lanes.log].
  • Managed Codex autoreview: authentication blocked, no report. [autoreview-stream-status.json] and [autoreview-stream.log]. No credential-store command or auth repair was attempted.

The acting lead personally inspected sibling Codex codex-rs/hooks/src/engine/command_runner.rs, including shell construction at 428-454, process/stdout ownership at 219-225, and timeout/child settlement at 285-286. That corroborates the existing timeout-owned shell PID contract; no Codex or product runtime behavior was changed.

Coordinator follow-up

  • Rebased onto main 2b7937b, resolving the scripts/e2e/lib/clawhub-fixture-server.cjs conflict toward main's { port } message and updating this lane's consumer. On the rebased head, through node scripts/crabbox-wrapper.mjs: 100/100 standalone runs, 9/9 Node owner-shard replays, Gateway E2E owner 2 clean replays (the third could not be admitted while Testbox was saturated; PR CI runs the changed e2e), targeted tsgo, OpenGrep, type-aware lint, oxfmt, pnpm deadcode:full, base-aware ratchet.
  • Codex autoreview of the rebased branch (P1 threshold): scoped-clean.

CLI, Gateway, updater, and cleanup fixtures polled readiness/PID files or
raced IPC and process-close events against 1s-45s wall-clock deadlines.
Healthy Node startup, lifecycle staging, and native retirement could lose
those races on loaded hosts.

Await owned IPC/stdout events and captured close promises, or fixture
receipts written after durable markers. When an operation can settle before
its independent receipt arrives, consult that durable marker. Bind body
waits to the Vitest abort signal so finally cleanup can run.

Preserve native shutdown duration assertions and TERM/KILL escalation.
Keep one signal-bound, deadline-free process-group check where the owner
has no completion receipt. Remove seven timeout-race baseline references.
Shared termination-helper cutover and unavailable descendant exit receipts
remain documented lane follow-ups.
@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 cli CLI command changes commands Command implementations size: L 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, 6:33 PM ET / 22:33 UTC.

ClawSweeper review

What this changes

The branch replaces timing-sensitive CLI process-test waits with child events, fixture receipts, and test cancellation signals while preserving existing assertions and termination behavior.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR remains useful: current main retains the affected polling deadlines, and the related merged work covers different fixtures. No introduced correctness or security defect was found.

Priority: P2
Reviewed head: 450d937f1c8e9dc176f027eabd12d20179527c50

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture repair with strong fault evidence and preserved contracts, pending the final required owner replay.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Recorded Linux Testbox probes exercise the changed wait owners with real child startup and exit delays, showing original failures, after-fix passes, and forced-abort PID extinction. Final rebased validation is documented, with one remaining owner-shard repetition tracked separately; 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): Recorded Linux Testbox probes exercise the changed wait owners with real child startup and exit delays, showing original failures, after-fix passes, and forced-abort PID extinction. Final rebased validation is documented, with one remaining owner-shard repetition tracked separately; no stored-data contract changes.
Evidence reviewed 12 items Pinned introduced change: Read the merge-base-to-head hunks for all introduced paths. The change is confined to tests, test support, and a shrink-only timeout-race baseline; it does not modify production authority, schemas, dependencies, or workflows.
Still necessary on current main: Current main still wraps helper closure in a 15-second timeout and polls the ClawHub fixture port file. These are concrete paths addressed by this branch.
Latest release comparison: The latest supplied release still contains the hook relay's readiness and PID-extinction polling; this conversion is not already shipped there.
Findings None None.
Security None None.

How this fits together

OpenClaw's CLI process tests launch real child processes to verify Gateway shutdown, updater custody, hook relays, plugin discovery, and cleanup. The changed fixture coordination observes readiness and process settlement before assertions and temporary-state removal.

flowchart TD
  A[CLI process tests] --> B[Real fixture children]
  B --> C[Readiness events and receipts]
  B --> D[Process close events]
  C --> E[Test assertions]
  D --> E
  F[Test cancellation] --> G[Owned cleanup]
  G --> D
  D --> H[Temporary state removal]
Loading

Before merge

  • Complete next step (P2) - Complete and record the third clean Gateway E2E owner-shard replay on the reviewed rebased head to satisfy the repository's flake-triage proof bar.
Agent review details

Security

None.

PR surface

Tests +224, Other -3. Total +221 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 14 457 233 +224
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 3 -3
Total 15 457 236 +221

Review metrics

Metric Value Why it matters
Timeout budgets 0 test timeout increases The repair removes observation races while retaining native shutdown-duration assertions and termination grace.

Technical review

Best possible solution:

Keep fixture observation tied to owned completion signals, with durable ordering checks and existing cleanup owners preserving the process contracts.

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

Yes: current source exposes fixed observation deadlines over healthy child startup and retirement, and the recorded Testbox probes demonstrate matching original failures. This read-only review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes: using existing child events and shared receipt/cancellation helpers repairs fixture coordination without extending deadlines, weakening assertions, or adding production test seams.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This addresses bounded developer and test-runner reliability failures without changing shipped runtime behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. Recorded Linux Testbox probes exercise the changed wait owners with real child startup and exit delays, showing original failures, after-fix passes, and forced-abort PID extinction. Final rebased validation is documented, with one remaining owner-shard repetition tracked separately; no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: This addresses bounded developer and test-runner reliability failures without changing shipped runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded Linux Testbox probes exercise the changed wait owners with real child startup and exit delays, showing original failures, after-fix passes, and forced-abort PID extinction. Final rebased validation is documented, with one remaining owner-shard repetition tracked separately; no stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: Read the merge-base-to-head hunks for all introduced paths. The change is confined to tests, test support, and a shrink-only timeout-race baseline; it does not modify production authority, schemas, dependencies, or workflows. (450d937f1c8e)
  • Still necessary on current main: Current main still wraps helper closure in a 15-second timeout and polls the ClawHub fixture port file. These are concrete paths addressed by this branch. (src/cli/gateway-cli/run-loop-package-helper.test-support.ts, 48f475d65322)
  • Latest release comparison: The latest supplied release still contains the hook relay's readiness and PID-extinction polling; this conversion is not already shipped there. (src/cli/hooks-cli.process.test.ts, c074824a27c9)
  • Cancellation and receipt contracts: The shared withinTest helper releases suspended waits when Vitest aborts. Fixture receipts retain earlier events and explicitly require durable-record reconciliation when another pipe can settle first; the added receipt consumers follow that ordering. (test/helpers/fixture-receipts.ts:8, 450d937f1c8e)
  • Preserved shutdown contract: The model-acquisition tests still assert elapsed shutdown time against the native stop budget, including cooperative and pending cases. Removing the observation timeout does not remove the latency assertion or failure-path SIGKILL. (src/cli/gateway-cli/run-loop.model-acquisition.process.test.ts:90, 450d937f1c8e)
  • Captured proof identity and observations: The REST body matched captured SHA-256 0780c6b65e61f24264030d595d80296795e8d3fd0a3f8b21c223b852e4d619f1. Its inspected evidence records real Testbox delayed-startup/exit probes failing on original bytes and passing after conversion, plus forced-abort PID-extinction observations. The coordinator reports final rebased standalone runs, owner-shard replays, and focused static checks. (450d937f1c8e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • sightingsstellar-beep: 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 owner-shard replay for the rebased head.

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

Third Gateway E2E owner-shard replay on 450d937 (coordinator, Blacksmith Testbox): this branch's changed src/cli/plugins-search-command.clawhub.e2e.test.ts passed, as in the two earlier replays. The replay reported 1 failed | 708 passed | 14 skipped; the single failure was in the untouched test/cli-json-stdout.gateway.e2e.test.ts (routed Gateway health config-failure rendering, AUTOQA_ROUTE_CONFIG_READ_FAILURE), intermittent across replays and unrelated to this change; it is tracked as a separate follow-up.

@steipete
steipete merged commit e1d4dcc into main Oct 1, 2026
120 of 121 checks passed
@steipete
steipete deleted the steipete/poll-w2-cli-process branch October 1, 2026 23:29
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…process tests fail on loaded hosts when fixture children outlast polling deadlines (openclaw#163044)

CLI process tests for the Gateway run loop (package helper/lifecycle, update respawn, direct stop with active work, forced cron, model acquisition), the hooks CLI, ClawHub plugin search, the update command executor (auxiliary/native) and service custody, cleanup-utils handle exclusion, and triage polled trace, PID, and readiness files or raced child close against 5-45 s timers, so a fixture child that outlasted the bound on a loaded host failed the test.

Waits now await registered close promises, existing stdout readiness lines and close gates, fixture receipts with durable-record fallback where the product owns the child, and owned triage callbacks; existing rescue SIGKILLs remain for failure paths. The ClawHub search e2e consumes the fixture server's native { port } IPC readiness from openclaw#162848 instead of adding a second message shape. Twenty sites stay unchanged, mainly waits inside the shared stop-child-process TERM/KILL owner and product-owned scripts without a retained child handle or reap receipt. No product source, product grace, test timeout, or assertion meaning changed.

Part of the polling audit from openclaw#162274. Proof on Blacksmith Testbox: delay and forced-abort probes, 220 standalone runs and 100/100 on the rebased head, Node owner shards 3/3, the Gateway E2E owner shard 3 replays with the changed ClawHub e2e passing in all three (the third replay's single failure was in the untouched test/cli-json-stdout.gateway.e2e.test.ts, tracked separately), targeted tsgo, OpenGrep, deadcode, type-aware lint, 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

cli CLI command changes commands Command implementations size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant