test(gateway): harden watch regression diagnostics#95473
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 23, 2026, 9:04 PM ET / 01:04 UTC. Summary PR surface: Tests +287, Other +111. Total +398 across 2 files. Reproducibility: yes. Source inspection shows current main only races spawn errors through the watch phases, while a normal child exit can still collapse into generic readiness/timing failures; the PR adds focused synthetic coverage for pre-ready and post-ready exits. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the script-owned diagnostic hardening through normal maintainer review with the current-head terminal proof and relevant CI checks visible. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main only races spawn errors through the watch phases, while a normal child exit can still collapse into generic readiness/timing failures; the PR adds focused synthetic coverage for pre-ready and post-ready exits. Is this the best way to solve the issue? Yes. The guard script is the right owner boundary for this diagnostic behavior; moving it into AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d9298a74be69. Label changesLabel justifications:
Evidence reviewedPR surface: Tests +287, Other +111. Total +398 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
4ea42a5 to
b34c5fc
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
b34c5fc to
95c34b9
Compare
95c34b9 to
18ecdc6
Compare
|
Maintainer verification complete; ready to land.
Current mainline drift was checked separately before merge; it does not overlap this PR or touch merge-critical infrastructure. |
|
Merged via squash.
|
Co-authored-by: kklouzal <[email protected]>
Co-authored-by: kklouzal <[email protected]>
Summary
This PR hardens the
check-gateway-watch-regressionrelease/runtime guard so failures are easier to diagnose and short-lived gateway-watch exits are reported accurately.The change is intentionally narrow. It only touches the gateway watch regression script and its focused tests.
What Problem This Solves
The watch regression guard currently has a few sharp edges that make release/runtime failures harder to reason about:
/bin/sh, but CI/bootstrap environments may inject shell hooks that assume bash semantics. That can add noisy stderr output or delay gateway readiness before the idle window.What changed
/bin/shfallback.PATHfor the isolated watch process.gateway:watch exited before ready (...)when the child exits before readiness.Evidence
Rebase/squash proof — 2026-06-23 UTC
Latest pushed commit after same-base rebase and squash:
4ea42a587047d35cb4f54814488f0ded22524eb7.All six coordinated PR branches in this batch were rebased onto the same pinned upstream base commit:
Post-rebase local verification included conflict-marker/diff hygiene plus focused branch-specific gates. Final proof marker for this PR:
Local validation run from
/home/kklouzal/.openclaw/workspace/repos/openclaw:Result:
Additional checks:
Result: all passed.
Real Behavior Proof
Redacted terminal output from a real gateway-watch guard invocation on this PR head:
Notes:
dfbc96e4178989869ebfc06da80d7519fd199f7e.<repo>.readyBeforeWindow: true,exitedBeforeReady: false, no dist-runtime growth, and bounded stdout/stderr artifact paths.Synthetic Failure-Path Proof
Redacted terminal output from a synthetic failure-path invocation on the same PR head. This intentionally lowers the CPU failure threshold to
0so the guard exits non-zero and prints the new bounded failure diagnostics without needing to break the gateway:Notes:
dfbc96e4178989869ebfc06da80d7519fd199f7e.<repo>.--cpu-fail-ms 0; the transcript demonstrates the failure reporting path, including the bounded stdout artifact tail and empty-stderr warning.Synthetic Early-Exit Proof
Redacted synthetic transcript exercising the new
gateway:watch exited before readyfinding path directly. This uses the PR script's exportedcollectGatewayWatchFindingshelper with a synthetic pre-ready child exit result, so the failure text is produced by the same finding collector used by the full regression command:Notes:
dfbc96e4178989869ebfc06da80d7519fd199f7e.readyBeforeWindow: false,exitedBeforeReady: true, andexit: { code: 1, signal: null }.Current-Head Post-Ready-Exit Proof
Redacted proof from current PR head
19ff518eb0ee305bf21812ed19423290dd41ea9d, covering the latest post-ready-exit repair. The focused test file now includes the ready-then-exit cases for both the settle window and the idle window, plus the collector-level failure text assertion.Synthetic collector transcript from the same current head showing the new post-ready unplanned-exit failure text directly:
Notes:
readyBeforeWindow: true) and then exited before the expected stop phase (exitedBeforeStop: true,exit: { code: 0, signal: null }).<repo>./tmp/openclaw-pr-proof/pr-95473-current-head-post-ready-exit.redacted.logand/tmp/openclaw-pr-proof/pr-95473-current-head-finding-proof.redacted.log.Current-Head Full Guard Proof
Redacted terminal output from current PR head
19ff518eb0ee305bf21812ed19423290dd41ea9dshowing a full guard invocation, not just focused tests or a synthetic collector path:Notes:
node scripts/check-gateway-watch-regression.mjs --skip-buildguard run from current head19ff518eb0ee305bf21812ed19423290dd41ea9d.<repo>.watchExit.code: 143, while the current-head lifecycle repair reportsexitedBeforeReady: falseandexitedBeforeStop: false./tmp/openclaw-pr-proof/pr-95473-current-head-full-guard.redacted.log.Current-Head Full Guard Proof Refresh — 2026-06-23
Redacted terminal output from current PR head
b34c5fc8e29b19dbaa43e248e7bfc1467f054abfshowing the full guard invocation ClawSweeper requested:Notes:
node scripts/build-all.mjs gatewayWatch, because the worktree initially had nodistordist-runtimeartifacts.<repo>./tmp/openclaw-pr-proof/pr-95473-b34c5fc-full-guard.raw.logand/tmp/openclaw-pr-proof/pr-95473-b34c5fc-full-guard.redacted.log.Risk
Low to moderate. This changes release/runtime diagnostic behavior, not production gateway behavior. The highest-impact runtime-adjacent change is using bash for the timed watch command when available; fallback behavior remains
/bin/shif bash is unavailable.The failure output becomes more verbose only when the watch guard fails, and stdout/stderr tails are bounded.
PR/Commit Surface Breakdown
Source: 1 files, +124 / -13
Tests: 1 files, +287 / -0
Total: 2 files, +411 / -13
Rebase / Proof Refresh (2026-06-23)
654544b6b7c49d78afbacacd4861bcc830172780b34c5fc8e29b19dbaa43e248e7bfc1467f054abfOPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-vitest-cache-pr95473 node scripts/run-vitest.mjs test/scripts/check-gateway-watch-regression.test.ts-> passed, 1 file / 18 tests.kklouzal/openclaw:extract/gateway-watch-regression-hardeningcompleted.