Repository navigation
perf(test): trigger restart probe timeout deterministically - #126664
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready maintainer proof for head The restart-health regression still crosses a real TCP/WebSocket boundary, receives the connect challenge, authenticates, reads the matching Gateway version, sends a genuine detail RPC, and executes the actual production probe implementation. Only the timeout variant observes the already-armed real 3,000 ms timer and triggers its callback after the server receives that real detail request; the ECONNRESET variant still sends a real WebSocket error response. Restart error redaction, diagnostics, and cleanup remain covered. Validation on the reviewed head:
Controlled same-worker Blacksmith benchmark, one excluded warmup and two retained before/after samples with distinct caches and Fault proof: temporarily suppressing the owner ClawSweeper has acknowledged this PR but has not published a substantive review or rank-up moves; no actionable review finding or skipped artifact request is present, and no redundant re-review was requested. |
|
Merged via squash.
|
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
The real Gateway restart-health regression test for a matching-version detail RPC timeout idles for the full production 3,000 ms deadline on every run, slowing the CLI test lane without adding behavioral coverage.
Why This Change Was Made
Observe the real production timer only in the timeout variant and invoke its already-armed 3,000 ms callback after the real WebSocket server receives the genuine non-connect detail request. The TCP/socket boundary, connect challenge, authenticated hello and version, detail RPC, production Gateway probe implementation, error redaction, restart diagnostics, socket cleanup, and independent ECONNRESET response all remain real. Explicitly assert that the restart owner requests
includeDetails: trueandtimeoutMs: 3000.User Impact
No product behavior changes. Developers and maintainers retain the same real-boundary restart-health regression protection while the measured test file runs 28.7% faster and the timeout case runs 66.7% faster.
Evidence
Controlled Blacksmith benchmark: one excluded warmup plus two retained before/after samples, one worker, distinct caches, import diagnostics, and
/usr/bin/time -v; benchmark leasetbx_01m0fgq0wz6d9q7pvc7p4cbd3vstopped after measurement.11.545s -> 8.235s(-3.310s,-28.7%); individual samples before9.51s / 13.58s, after9.25s / 7.22s.5.3515s -> 1.7825s(-3.569s,-66.7%); every retained before/after comparison improves by more than0.5s.684,832 KiB -> 680,552 KiB(directional only).probeErrorfails both timeout and ECONNRESET cases; changing the owner timeout from3000to250fails the exact timeout assertion. Both injected faults were restored.node scripts/run-vitest.mjs src/cli/daemon-cli/restart-health-probe.test.ts src/cli/daemon-cli/restart-health-external.test.ts src/cli/daemon-cli/restart-health.test.ts src/cli/daemon-cli/restart-health-wait.test.ts src/gateway/probe.test.tspassed both Gateway and CLI shards: six collected files,128/128tests.node scripts/check-changed.mjs -- src/cli/daemon-cli/restart-health-probe.test.tspassed all guards, formatting, dead-export scans, full sharded core-test typechecking, and changed-file lint (0 warnings,0 errors) on Blacksmith Testbox leasetbx_01m0fhs16pczbp5xwgbbeg1ass, which stopped automatically after success. Hosted session: https://github.com/openclaw/openclaw/actions/runs/32368236954 (the delegated backing workflow may show cancelled after Blacksmith stops a successful one-shot lease; the wrapper exit code and timing JSON are the authoritative result).origin/main: no accepted/actionable findings; confidence0.99.git diff --check origin/main...HEADpassed. Production LOC:+0/-0; tests:+8/-1in one file.AI-assisted; reviewed and validated by the maintainer.