Skip to content

test: gateway and CLI process-test hygiene - #118042

Merged
steipete merged 2 commits into
mainfrom
test/gateway-cli-test-hygiene
Aug 2, 2026
Merged

steipete merged 2 commits into
mainfrom
test/gateway-cli-test-hygiene

Conversation

@steipete

@steipete steipete commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Three test-hygiene defects observed during the plugin-lifecycle series (#117236…#117852):

  1. src/gateway/server-startup-model-runtime.event-loop.test.ts still passed the deferConfiguredChannelFullLoadUntilAfterListen fixture key removed end-to-end by refactor(gateway): remove deferred channel load flag; 503 plugin routes until runtime ready #117852 — dead data readers silently ignore.
  2. src/gateway/server.startup-websocket-race.test.ts binds 127.0.0.2, which default macOS lo0 doesn't alias — the test fails locally on Macs (EADDRNOTAVAIL, observed on unrelated branches) while passing on Linux CI.
  3. src/cli/help-exit.process.test.ts intermittently reported exit code null on loaded CI runners: its subprocess helper used fixed-window waits, so a slow spawn looked like a missing exit.

Why This Change Was Made

Dead key deleted (the intentional tolerant-parse regression in installed-plugin-index-store.test.ts is untouched). The alias-specific race test now runtime-probes 127.0.0.2 bindability and skips with a clear reason where absent — the #117261 macOS-hygiene precedent — leaving Linux assertions intact. The CLI subprocess helper awaits exit and stream completion with a bounded 240s hard cap; the exit-code 2 assertion stays exact, and sibling process suites were checked (distinct harnesses — one-file fix, not a class).

User Impact

None at runtime — test-only. macOS contributors get green local runs for these suites; CI loses a flake source.

Evidence

  • Focused: 3 files, 58 passed + 1 expected skip on macOS (Darwin 27); pnpm tsgo:test clean; changed-file oxlint, formatting, git diff --check clean; structured autoreview clean.
  • Production delta: 0 bytes (git diff --numstat: test files only).

🤖 Generated with Claude Code

Review correction + transcript (added post-review)

Deadline ordering made structural: ordinary callers 100s (derived from the shared 120s Vitest constant), slow dotenv case paired 240s/250s; all 41 invocations verified. After-fix terminal transcript (alias skip with reason, exact exit-code-2 pass through the event-based harness): see the proof comment.

@steipete
steipete marked this pull request as ready for review August 2, 2026 16:13
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 1:05 PM ET / 17:05 UTC.

ClawSweeper review

What this changes

The branch removes obsolete gateway test fixture data, skips an alias-dependent WebSocket test on hosts that cannot bind 127.0.0.2, and makes CLI process tests wait for child exit and output-stream completion.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness or security finding surfaced. This test-only PR remains necessary because current main still contains the stale gateway fixture field and the fixed-window CLI child-process helper; the final head replaces those narrow test-hygiene defects and includes direct after-fix terminal proof.

Priority: P2
Reviewed head: 84e50fc4baa500422dac009ef0716908817c3a23

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused real terminal evidence, a bounded test-only patch, and the corrected deadline ordering support a normal mergeable-quality rating.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The author supplied an exact-head terminal transcript showing the intended macOS alias skip and exact CLI exit-code-2 behavior after the harness change; it is direct, redacted test behavior proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The author supplied an exact-head terminal transcript showing the intended macOS alias skip and exact CLI exit-code-2 behavior after the harness change; it is direct, redacted test behavior proof.
Evidence reviewed 6 items Current main still has the obsolete fixture field: Current main passes deferConfiguredChannelFullLoadUntilAfterListen in the startup metadata fixture even though the related gateway lifecycle refactor removed that runtime field; deleting this dead fixture data is still useful and is not already implemented on main.
Current main uses the fixed-window process helper: The existing CLI test helper delegates to execFile with a fixed 100-second timeout, while the proposed helper records stdout/stderr and awaits the child exit plus both output streams before asserting the exit result.
Alias probe uses the existing owner helper: The gateway test reuses tryListenOnPort, whose contract opens and immediately closes a temporary listener; that directly tests whether this host can bind the address without leaving a competing listener behind.
Findings None None.
Security None None.

How this fits together

Gateway startup tests verify that the server is ready before clients connect and that configured bind addresses work; CLI process tests launch the command-line entry point and assert its diagnostics and exit status. These paths feed local contributor runs and CI, not shipped runtime behavior.

flowchart LR
  Cases[Gateway and CLI test cases] --> Gateway[Gateway startup suite]
  Cases --> Cli[CLI process suite]
  Gateway --> AliasProbe[Loopback alias availability probe]
  Cli --> ProcessWait[Child exit and stream completion]
  AliasProbe --> Outcome[Test pass or explicit host skip]
  ProcessWait --> Outcome
Loading

Before merge

  • Resolve merge risk (P1) - Required CI jobs were still in progress in the supplied review state, so merge should wait for the normal checks on the final head; this is a validation gate, not a patch defect.
  • Complete next step (P2) - No repair lane is needed because the reviewed final head has no discrete actionable defect; the remaining action is ordinary maintainer merge and CI handling.
Agent review details

Security

None.

PR surface

Tests +67. Total +67 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 107 40 +67
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 107 40 +67

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the three narrowly scoped test repairs, retaining the existing port-probe helper and the derived timeout ordering so macOS capability differences produce an explicit skip while genuine gateway and CLI regressions still fail.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the three narrowly scoped test repairs, retaining the existing port-probe helper and the derived timeout ordering so macOS capability differences produce an explicit skip while genuine gateway and CLI regressions still fail.

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

Yes, source-reproducible: current main still contains the stale fixture and fixed-window helper, and the final-head terminal transcript directly exercises the repaired alias-skip and exit-code path. I did not execute the suites in this read-only review.

Is this the best way to solve the issue?

Yes. The patch repairs each defect at its owning test boundary: it deletes dead fixture input, probes host capability rather than weakening the Linux assertion, and makes the local CLI helper observe the process lifecycle instead of guessing with a fixed wait.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 059a98ebfd16.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The author supplied an exact-head terminal transcript showing the intended macOS alias skip and exact CLI exit-code-2 behavior after the harness change; it is direct, redacted test behavior proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The author supplied an exact-head terminal transcript showing the intended macOS alias skip and exact CLI exit-code-2 behavior after the harness change; it is direct, redacted test behavior proof.
  • remove rating: 🦪 silver shellfish: 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: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This focused test-infrastructure repair reduces contributor and CI flakiness without changing shipped runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The author supplied an exact-head terminal transcript showing the intended macOS alias skip and exact CLI exit-code-2 behavior after the harness change; it is direct, redacted test behavior proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The author supplied an exact-head terminal transcript showing the intended macOS alias skip and exact CLI exit-code-2 behavior after the harness change; it is direct, redacted test behavior proof.

Evidence

What I checked:

  • Current main still has the obsolete fixture field: Current main passes deferConfiguredChannelFullLoadUntilAfterListen in the startup metadata fixture even though the related gateway lifecycle refactor removed that runtime field; deleting this dead fixture data is still useful and is not already implemented on main. (src/gateway/server-startup-model-runtime.event-loop.test.ts:153, 4133fe925fab)
  • Current main uses the fixed-window process helper: The existing CLI test helper delegates to execFile with a fixed 100-second timeout, while the proposed helper records stdout/stderr and awaits the child exit plus both output streams before asserting the exit result. (src/cli/help-exit.process.test.ts:156, 4133fe925fab)
  • Alias probe uses the existing owner helper: The gateway test reuses tryListenOnPort, whose contract opens and immediately closes a temporary listener; that directly tests whether this host can bind the address without leaving a competing listener behind. (src/infra/ports-probe.ts:9, 4133fe925fab)
  • Prior timeout-ordering finding is addressed at final head: The final branch derives the ordinary child guard from the shared 120-second Vitest constant, yielding 100 seconds, and pairs the intentionally slow dotenv case's 240-second process guard with a 250-second test deadline. (src/cli/help-exit.process.test.ts:20, 84e50fc4baa5)
  • Related lifecycle provenance: The removed field traces to the merged gateway lifecycle cleanup, which is present on current main; this PR only removes its now-stale test fixture residue rather than changing the runtime policy again. (src/gateway/server-startup-model-runtime.event-loop.test.ts:153, 1e9a620a28d6)
  • After-fix real behavior proof: The author’s exact-head terminal transcript shows the explicit non-bindable-alias skip, the gateway startup suite passing, and the dotenv diagnostic test observing exact exit code 2; it reports 58 passes and one expected macOS skip. (src/cli/help-exit.process.test.ts:652, 84e50fc4baa5)

Likely related people:

  • Peter Steinberger: Authored the merged gateway lifecycle refactor that removed the stale startup field and authored the final timeout-diagnostics commit on this branch. (role: related lifecycle feature owner and recent area contributor; confidence: high; commits: 1e9a620a28d6, 84e50fc4baa5; files: src/gateway/server-startup-model-runtime.event-loop.test.ts, src/cli/help-exit.process.test.ts)
  • Dallin Romney: Current-main blame attributes the existing WebSocket alias case and CLI execFile helper to this recent test-path history, making this person a useful routing contact for adjacent suite conventions. (role: recent test-path contributor; confidence: medium; commits: 652b0b96e20d; files: src/gateway/server.startup-websocket-race.test.ts, src/cli/help-exit.process.test.ts)

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-08-02T16:50:30.111Z sha 258418d :: needs real behavior proof before merge. :: [P2] Keep the shared deadline below default test timeouts

@steipete steipete self-assigned this Aug 2, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

After-fix transcript + deadline-ordering repair (exact head 84e50fc4baa)

Review finding fixed: the shared runCliProcess deadline now derives from the same 120s constant Vitest consumes — ordinary callers get 100s (guard fires with diagnostics before the framework timeout), and only the known slow dotenv case opts into the paired 240s/250s configuration. All 32 call sites / 41 effective invocations verified ordered (helper < test timeout); no other caller files exist.

Terminal transcript (this macOS host, trimmed):

 ↓ server.startup-websocket-race > serves a specific IPv4 bind and its required loopback alias 4ms
   [127.0.0.2 is not bindable on this host]
 ✓ server-startup-model-runtime.event-loop > keeps health probes responsive … 296ms
 Test Files  2 passed (2) — Tests 4 passed | 1 skipped

 ✓ help-exit.process > captures exact exit code 2 after loading dotenv for entry validation diagnostics 656ms
 Test Files  1 passed (1) — Tests 54 passed
 Duration 103.35s — Process exit code: 0

The alias-dependent test skips with its explicit reason where 127.0.0.2 isn't bindable (Linux CI still runs it); the reworked harness captures the exact exit code through event-based waiting. 58 passed + 1 expected skip; tsgo:test, format, diff-check clean; autoreview clean.

🤖 Generated with Claude Code

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 2, 2026
@steipete
steipete merged commit 6e87d3b into main Aug 2, 2026
134 of 144 checks passed
@steipete
steipete deleted the test/gateway-cli-test-hygiene branch August 2, 2026 17:12
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* test: gateway and CLI process-test hygiene

* test: preserve CLI process timeout diagnostics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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