Skip to content

fix(test): CLI process tests fail after concise Gateway error copy - #163649

Merged
steipete merged 1 commit into
mainfrom
fix/channels-status-transport-copy-test
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/channels-status-transport-copy-test

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #163381, #163637

What Problem This Solves

Fixes: gateway-backed-exit.process.test.ts fails on main for devices commands against an unreachable Gateway and for whitespace --timeout values. It still expects stderr text that #163381 deliberately replaced with shorter copy.

User Impact

No user-visible change. The CLI process lane passes again. The sibling failures with the same cause are already fixed on main: channels.status.command-flow.test.ts by #163637 and gateway-backed-exit-health.process.test.ts by eb978fd. This PR covers the last file.

Why This Change Was Made

#163381 changed the human CLI output for Gateway transport failures. It now opens with "Couldn't connect to OpenClaw." and points to openclaw gateway status. The raw diagnostic only appears with OPENCLAW_DEBUG. It also cut stderr for unexpected failures down to a short title plus a hint. The full reason still goes to the --json stdout envelope. Five cases in this file still expected the old stderr text:

  • devices list/approve/rotate against an unreachable Gateway.
  • Whitespace --timeout for nodes list --json and channels capabilities --json.

The tests now assert the new user-facing contract instead of reverting the product copy. On stderr they check for the connection-failure lead and the status-check next step. For --json runs they check that the Invalid --timeout reason is in the stdout failure envelope.

The timeout cases are not a product regression. These --json runs carry the reason on stdout. In text mode, runCommandWithRuntime still prints the Invalid --timeout message. Other checks are unchanged: the Gateway diagnostic in the JSON envelope, no crash framing, no doctor hint, and Gateway call counts.

Evidence

Reproduced on main before the change:

  • pnpm test src/cli/gateway-backed-exit.process.test.ts --maxWorkers=1: the devices list/approve/rotate and two whitespace-timeout cases failed. Failures included expected 'Couldn't connect to OpenClaw.\nCheck…' to contain 'Gateway not reachable at ws://127.0.0…' and expected '[openclaw] The CLI command failed.\n[…' to contain 'Invalid --timeout'.

After the change, all passing:

  • The process lane with this file: 48 passed, 1 skipped (same skip as on main).
  • -t timeout rerun after the final assertion form: 6/6 passed.
  • Unchanged siblings:
    • gateway-diagnostics-opens.process.test.ts: 2/2 passed.
    • failure-output.test.ts: 23/23 passed.
    • The 9 other test files that mention Gateway not reachable: 321/321 passed.
  • oxlint and oxfmt pass. Codex autoreview was scoped-clean through P2. ClawSweeper review: ready, no findings.

The test file is byte-identical to the tested version. Since then, main has changed only one producer on its path: eb978fd added a Reason: line for InvalidConfigError. These cases never reach it, because transport failures return earlier and Invalid --timeout is a plain Error. These are assertion-only changes. No new tests, timers, or fixtures were added.

@clawsweeper

clawsweeper Bot commented Oct 2, 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: XS labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 4:12 PM ET / 20:12 UTC (Revision 3).

ClawSweeper review

What this changes

This PR updates existing CLI process tests to expect concise Gateway connection guidance on stderr and timeout-error details in JSON stdout.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary: current main still has the stale assertions, and the merged sibling repairs do not cover this file. No actionable correctness finding remains.

Priority: P2
Reviewed head: d639f3ebf05a83eec31853b880244ae80580ec7d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful assertion repair with reported failing-before and passing-after checks and no identified correctness defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer-author context exempts this test-only repair from external-contributor runtime proof. Reported subprocess checks exercise the relevant CLI output boundary; related UI screenshots are not counted as CLI evidence. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer-author context exempts this test-only repair from external-contributor runtime proof. Reported subprocess checks exercise the relevant CLI output boundary; related UI screenshots are not counted as CLI evidence. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: The merge-base-to-head diff changes only three assertion blocks: two whitespace-timeout cases and the three devices connection-failure cases. Exit codes, connection counts, RPC calls, JSON transport diagnostics, and crash-framing exclusions remain intact.
Production output contract: The shared renderer emits concise connection guidance for undispatched Gateway transport failures. JSON failures retain the original error message; JSON-mode command errors are rethrown to the entry handler, which writes that envelope before human stderr output.
Actual CLI entry boundary: The CLI entry failure handler writes formatCliJsonFailure to stdout in JSON mode, renders human failure lines separately, and sets exitCode to 1. This supports moving the timeout assertions to stdout.
Findings None None.
Security None None.

How this fits together

OpenClaw's CLI formats command failures for people on stderr and preserves machine-readable diagnostics on stdout. These process tests check that commands produce the appropriate output and exit cleanly.

flowchart TD
  A[CLI command arguments] --> B[Command validation]
  B --> C[Gateway connection]
  B --> D[Shared failure renderer]
  C --> D
  D --> E[Human stderr guidance]
  D --> F[JSON stdout diagnostics]
  E --> G[Process assertions]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +4. Total +4 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 10 6 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 10 6 +4

Review metrics

None.

Technical review

Best possible solution:

Keep the concise production error contract and preserve process coverage for human guidance, JSON diagnostics, clean exits, and validation before network access.

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

Yes: current-main assertions conflict directly with the inspected output renderer and JSON entry handler, and the captured body reports the corresponding five failures. This review established the mismatch from source without running tests.

Is this the best way to solve the issue?

Yes: updating the existing boundary assertions follows the intentional production contract while preserving failure and network-access checks.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.

Label justifications:

  • P2: This bounded repair restores meaningful CLI process assertions without changing user-facing runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied maintainer-author context exempts this test-only repair from external-contributor runtime proof. Reported subprocess checks exercise the relevant CLI output boundary; related UI screenshots are not counted as CLI evidence. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head diff changes only three assertion blocks: two whitespace-timeout cases and the three devices connection-failure cases. Exit codes, connection counts, RPC calls, JSON transport diagnostics, and crash-framing exclusions remain intact. (src/cli/gateway-backed-exit.process.test.ts:104, d639f3ebf05a)
  • Production output contract: The shared renderer emits concise connection guidance for undispatched Gateway transport failures. JSON failures retain the original error message; JSON-mode command errors are rethrown to the entry handler, which writes that envelope before human stderr output. (src/cli/failure-output.ts:195, d639f3ebf05a)
  • Actual CLI entry boundary: The CLI entry failure handler writes formatCliJsonFailure to stdout in JSON mode, renders human failure lines separately, and sets exitCode to 1. This supports moving the timeout assertions to stdout. (src/entry.ts:353, d639f3ebf05a)
  • Still missing on fetched main: Comparison against fetched main shows all three assertion repairs remain absent there, with no difference in the inspected shared failure renderer. The related merged PRs fix: make common error messages short and helpful #163381 and fix: unblock worker cancellation and recovery checks on main #163637 establish intentional concise copy and a separate sibling repair, respectively. (src/cli/gateway-backed-exit.process.test.ts:104, da1e2a60641e)
  • Verified merge scope: The test-merge commit records the pinned base followed by the exact PR head as parents. Its comparison with that base changes only the process test; the endpoint workflow differences are base work. (de83591a13a2)
  • Validation and review continuity: The captured PR body reports the original five failures, an after-change process lane with 48 passes and one unchanged skip, six passing timeout cases, and passing sibling checks. The prior completed review has no findings or published rank-up moves. Direct comparison with its earlier head failed because the object was unavailable and lazy retrieval returned HTTP 403; this does not invalidate the readable pinned diff. No tests were executed during this read-only review. (src/cli/gateway-backed-exit.process.test.ts, d639f3ebf05a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-10-02T16:59:44.351Z sha a7d166233ecd7a87c995a91e9c676ea2f14943da :: needs changes before merge. :: none
  • reviewed 2026-10-02T17:10:03.294Z sha 539239a :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the fix/channels-status-transport-copy-test branch from a7d1662 to 539239a Compare October 2, 2026 17:03
@openclaw-barnacle openclaw-barnacle Bot removed the commands Command implementations label Oct 2, 2026
@steipete steipete changed the title fix(test): channels status and CLI process tests fail after concise Gateway error copy fix(test): CLI process tests fail after concise Gateway error copy Oct 2, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 2, 2026
#163381 made human CLI output for Gateway transport failures lead with
"Couldn't connect to OpenClaw." plus a status-check command, and made
non-expected human failure lines terse (the reason stays in the --json
stdout envelope). gateway-backed-exit.process.test.ts still asserted the
old stderr text, so devices list/approve/rotate against an unreachable
Gateway and the whitespace --timeout cases for nodes list and channels
capabilities failed on main. #163637 and eb978fd already fixed the
channels status and gateway health siblings.

Assert the new user-facing contract instead: the connection-failure lead
and the `openclaw gateway status` next step on stderr, and the
"Invalid --timeout" reason in the --json failure envelope.
@steipete
steipete force-pushed the fix/channels-status-transport-copy-test branch from 539239a to d639f3e Compare October 2, 2026 20:06
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 2, 2026
@steipete
steipete merged commit d5c6cbf into main Oct 2, 2026
108 checks passed
@steipete
steipete deleted the fix/channels-status-transport-copy-test branch October 2, 2026 20:58
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 2, 2026
* commit '79be075e5aa46be9e42dbd53ed6e30e81469210a': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (#163780)
  fix(ui): gate system information at the shared reader (#160982)
  chore(db): reclassify worker inventory sites with caller evidence (#163754)
  refactor(channels): deslop Slack and Matrix (#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (#129120)
  perf(nodes): load only what a worker turn needs (#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (#163649)
  refactor(discord): deslop discord (#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (#163761)
  test(gateway): add sustained heap retention diagnostics (#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (#163718)
  feat(macos): add a --no-activate launch flag for background automation (#163758)
  fix(agents): preserve host authority across module reloads (#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (#163690)
  fix: keep video widgets scrollable and preload initial frames (#163762)
  feat(memory): add a provider-neutral memory provider runtime (#162175)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…penclaw#163649)

openclaw#163381 made human CLI output for Gateway transport failures lead with
"Couldn't connect to OpenClaw." plus a status-check command, and made
non-expected human failure lines terse (the reason stays in the --json
stdout envelope). gateway-backed-exit.process.test.ts still asserted the
old stderr text, so devices list/approve/rotate against an unreachable
Gateway and the whitespace --timeout cases for nodes list and channels
capabilities failed on main. openclaw#163637 and e4d6b11 already fixed the
channels status and gateway health siblings.

Assert the new user-facing contract instead: the connection-failure lead
and the `openclaw gateway status` next step on stderr, and the
"Invalid --timeout" reason in the --json failure envelope.
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 3, 2026
* commit '1fda703fb4d3630e4633461967b2a2186e8f15fd': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (openclaw#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (openclaw#163780)
  fix(ui): gate system information at the shared reader (openclaw#160982)
  chore(db): reclassify worker inventory sites with caller evidence (openclaw#163754)
  refactor(channels): deslop Slack and Matrix (openclaw#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (openclaw#129120)
  perf(nodes): load only what a worker turn needs (openclaw#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (openclaw#163649)
  refactor(discord): deslop discord (openclaw#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (openclaw#163761)
  test(gateway): add sustained heap retention diagnostics (openclaw#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (openclaw#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (openclaw#163718)
  feat(macos): add a --no-activate launch flag for background automation (openclaw#163758)
  fix(agents): preserve host authority across module reloads (openclaw#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (openclaw#163690)
  fix: keep video widgets scrollable and preload initial frames (openclaw#163762)
  feat(memory): add a provider-neutral memory provider runtime (openclaw#162175)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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