Repository navigation
fix(cli): show the gateway health reason in status --deep - #196073
wangmiao0668000666 wants to merge 7 commits into
Conversation
status --deep surfaces the gateway health probe failure by throwing a bare Error, which the CLI failure handler replaces with the generic "The CLI command failed." line and hides the real reason (e.g. "Gateway is unreachable"). Throw an ExpectedCliError instead so the human output carries the health reason, matching the JSON path and the error-classification contract used by other commands.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesShow the Gateway health failure reason and a diagnostic next step when human-readable status --deep fails. Example: Run openclaw status --deep with no Gateway running.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current diagnostic bug with a focused change; no blocking defects remain, and the reviewed head has a successful CI gate. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe status command consumes Gateway scan and health results, then passes expected failures to the shared CLI renderer for human-readable output. flowchart TD
A[Status CLI] --> B[Gateway scan]
B --> C[Runtime health snapshot]
C --> D[Expected CLI error]
D --> E[Shared failure renderer]
E --> F[Reason and diagnostic command]
Technical reviewBest possible solution: Use the existing expected-error renderer to expose the health reason with a target-neutral diagnostic command. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the bare-error path, and the contributor supplies a discriminating before/after shipped CLI transcript; no target code was executed during this review. Is this the best way to solve the issue? The patch restores actionable error reporting through the existing owner and preserves the intentional failure behavior without adding lifecycle policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5ac21026addd. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +12, Tests +59, Other +5. Total +76 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
Reviewed November 10, 2026, 6:42 AM ET / 11:42 UTC (Revision 6). |
ClawSweeper: with no reachable Gateway the expected error's human output must carry a concrete recovery step, not only the health reason. Keep the machine output stable (the probe error alone) while the human output adds the managed gateway start command. Also annotate the new audit mock's isolation.
|
@clawsweeper re-review Addressed all three findings:
|
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Re-review the current head (fd44f20): the recovery hint and audit mock annotation are now committed, and the body's real behavior proof runs through the built shipped launcher (node openclaw.mjs). |
|
🦞👀 Re-review progress:
|
The gateway start instruction only applies to a stopped local managed service; for a remote gateway target it cannot recover the remote host. Keep the probe reason for both cases and condition the start hint on gateway.mode=local, using a target-neutral check for remote targets.
|
@clawsweeper re-review Addressed the P2 finding: the recovery hint is now conditional on gateway.mode. For a local gateway it keeps |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Addressed the remaining local-service finding: the recovery hint now checks the service snapshot. For a local gateway with an installed managed service it recommends |
|
🦞👀 Re-review progress:
|
start/install can be refused by the service owner (for example under an external supervisor), so selecting a lifecycle command from the gateway mode or installation snapshot is not reliable. The recovery hint now recommends the diagnostic `openclaw gateway status --deep` for both local and remote targets, which is never refused and needs no eligibility policy. Consolidates the recovery-hint regression into a local/remote pair and updates the test-line allocation to match.
|
@clawsweeper re-review Addressed the external-supervision finding: the recovery hint no longer derives a lifecycle command from the gateway mode or installation snapshot. start/install can be refused by the service owner (external supervisor, no installed service), so the hint now recommends the diagnostic |
|
🦞👀 Re-review progress:
|
The mock-exports ratchet matches a `// mock-isolation:` annotation only when it is the line immediately above the mock call; the previous multi-line comment did not match and failed the CI ratchet.
The CI ratchet computes a 59-line net growth against its prepared base, so the allocation must match instead of the local-main figure.
|
@clawsweeper re-review The latest head (015da63) only adjusts the test-line allocation file to match the CI ratchet base plus a single-line formatting of the audit mock-isolation annotation — no production behavior change from the last reviewed head (3b51b66, clean review). CI is fully green on this head. Re-review the current head so the durable verdict and readiness labels track it. |
|
🦞👀 Re-review progress:
|
|
Thanks for the work here. We're closing this along with the other open PRs that apply the same change one call site at a time. This series adds diagnostics, console output or terminal sanitization at each call site separately; terminal sanitization is a security-policy decision, and new diagnostic output is a product decision. Please open one issue (or one PR at the shared owner) that covers the whole pattern, with a reproduction of real user-visible harm, instead of separate per-site PRs. Further per-site variants of this pattern will be closed. |
What Problem This Solves
Fixes:
openclaw status --deepprints onlyThe CLI command failed. For help, run openclaw doctor.when the Gateway is unreachable, hiding the actual health reason. The reason (Gateway is unreachable, or the probe error from a failing health check) was only visible with--json.User Impact
User impact:
status --deepnow prints the real health reason plus a diagnostic recovery step (Run openclaw gateway status --deep for gateway diagnostics.) instead of the generic failure line, with the same exit code 1. The step is a diagnostic command that the service owner never refuses and that applies to local and remote targets alike.--jsonoutput keeps the stable probe-error message and the exit code is unchanged; no new wording in machine output.Why This Change Was Made
The deep status path surfaces a failed gateway health probe by throwing a bare
Error, which the CLI failure handler classifies as unexpected and replaces with the generic line in human output. Throwing anExpectedCliErrorinstead lets the human output carry the health reason plus a recovery step, matching the actionable-error contract and what the JSON path already reports. The step is deliberately a diagnostic command rather than a lifecycle command:gateway start/gateway installcan be refused by the service owner (for example under an external supervisor), so deriving eligibility from the gateway mode or installation snapshot would recommend commands that are not reliably available. A diagnostic next step needs no such policy and is never refused.Evidence
Discriminating regression (
src/commands/status.scan-failure.test.ts,status --deep gateway health failures > reports the gateway health reason with a diagnostic recovery step):new Error(health.error)): both local and remote cases fail — rejection is a plainError, not anExpectedCliError.Real CLI proof through the supported shipped launcher (
node openclaw.mjs, built dist, Node 24, isolated HOME, no Gateway running), same build with only the throw changed:Before (base):
After (head):
--jsonmachine output is unchanged (the probe error alone,{ "ok": false, "error": { "type": "cli_error", "message": "Gateway is unreachable" } }).The new first-party audit mock carries a mock-isolation annotation explaining why the real security audit must stay outside this fixture (the deep-status regression only asserts the gateway health failure path).
Test-line budget: 61 added lines, allocated in
config/test-lines-allocations/status-deep-health-reason.txt.Maintainer options
Scope and alternatives
This is a narrow single-file change plus its regression test; the TTL-free behavior, JSON schema, and exit codes are unchanged.
Alternatives considered:
ExpectedCliErrorcontract already exists for exactly this and is what sibling commands use.gateway start/gateway install: rejected because those commands can be refused by the service owner (external supervisor, no installed service), so the hint must not assume either is permitted; a diagnostic command needs no eligibility policy.