Skip to content

perf(test): trigger restart probe timeout deterministically - #126664

Merged
steipete merged 1 commit into
mainfrom
perf/test-restart-health-probe-timeout
Aug 20, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/test-restart-health-probe-timeout

Conversation

@steipete

Copy link
Copy Markdown
Contributor
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: true and timeoutMs: 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 lease tbx_01m0fgq0wz6d9q7pvc7p4cbd3v stopped after measurement.

  • Retained file-wall mean: 11.545s -> 8.235s (-3.310s, -28.7%); individual samples before 9.51s / 13.58s, after 9.25s / 7.22s.
  • Retained timeout-case mean: 5.3515s -> 1.7825s (-3.569s, -66.7%); every retained before/after comparison improves by more than 0.5s.
  • Peak RSS: 684,832 KiB -> 680,552 KiB (directional only).
  • Fault injection: temporarily suppressing owner probeError fails both timeout and ECONNRESET cases; changing the owner timeout from 3000 to 250 fails the exact timeout assertion. Both injected faults were restored.
  • Fresh focused owner and sibling proof: 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.ts passed both Gateway and CLI shards: six collected files, 128/128 tests.
  • Fresh complete changed core-test gate: node scripts/check-changed.mjs -- src/cli/daemon-cli/restart-health-probe.test.ts passed all guards, formatting, dead-export scans, full sharded core-test typechecking, and changed-file lint (0 warnings, 0 errors) on Blacksmith Testbox lease tbx_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).
  • Fresh structured branch autoreview against origin/main: no accepted/actionable findings; confidence 0.99.
  • git diff --check origin/main...HEAD passed. Production LOC: +0/-0; tests: +8/-1 in one file.
  • No UI change or screenshots; no changelog, dependency, baseline, snapshot, protocol, SQLite, release, or production changes.

AI-assisted; reviewed and validated by the maintainer.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS maintainer Maintainer-authored PR labels Aug 20, 2026
@steipete
steipete marked this pull request as ready for review August 20, 2026 12:33
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready maintainer proof for head 218a274bf636ee0ff797254f2c6cd2dd60e42b3a:

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 /usr/bin/time -v: file-wall mean 11.545s → 8.235s (−3.310s / −28.7%); timeout case 5.3515s → 1.7825s (−3.569s / −66.7%). Every retained comparison improves by more than 0.5s. RSS 684,832 KiB → 680,552 KiB is directional only. Benchmark lease tbx_01m0fgq0wz6d9q7pvc7p4cbd3v was stopped.

Fault proof: temporarily suppressing the owner probeError fails both real-boundary cases; changing the owner timeout from 3000 to 250 fails the new exact contract assertion. Both faults were restored. Production LOC +0/−0; tests +8/−1 in one file. No UI-visible change, so screenshots/video do not apply; no changelog, dependency, baseline, snapshot, protocol, SQLite, release, or production change.

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.

@steipete
steipete merged commit cbe0700 into main Aug 20, 2026
172 checks passed
@steipete
steipete deleted the perf/test-restart-health-probe-timeout branch August 20, 2026 12:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant