Skip to content

fix(cli): show the --probe/--plain option conflict in models status - #196094

Merged
obviyus merged 2 commits into
openclaw:mainfrom
wangmiao0668000666:fix/models-status-probe-plain
Nov 9, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
wangmiao0668000666:fix/models-status-probe-plain

Conversation

@wangmiao0668000666

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: openclaw models status --probe --plain prints only The CLI command failed. For help, run openclaw doctor. instead of the option-conflict reason. The real message (--probe cannot be used with --plain output.) was hidden from human output.

User Impact

User impact: models status now prints --probe cannot be used with --plain output. with the same exit code 1. --json output and the exit code are unchanged; no new wording.

Why This Change Was Made

modelsStatusCommand rejects the conflicting --probe --plain combination by throwing a bare Error, which the CLI failure handler classifies as unexpected and replaces with the generic line in human output. Throwing an ExpectedCliError instead lets the human output carry the option-conflict reason, matching the throwExpectedCliError usage already present in the same module for the --probe option value validation.

Evidence

Discriminating regression (src/commands/models/list.status.test.ts): a new case asserts the conflicting --probe --plain selection rejects with an ExpectedCliError carrying the option message.

  • BASE (throw new Error(...)): test fails — rejection is a plain Error, not an ExpectedCliError.
  • HEAD (this change): test passes.

Real CLI proof (source entry via node --import tsx src/index.ts, Node 24, isolated HOME), same build with only the throw changed:

Before (base):

$ openclaw models status --probe --plain
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.

After (head):

$ openclaw models status --probe --plain
--probe cannot be used with --plain output.

Test-line budget: 9 added lines, allocated in config/test-lines-allocations/models-status-probe-plain.txt.

Maintainer options

Scope and alternatives

Narrow single-line change plus its regression test; JSON schema and exit codes unchanged.

Alternatives considered:

  • Keeping the bare throw: leaves the option-conflict reason hidden in human output.
  • Wrapping at the CLI boundary: the ExpectedCliError contract already exists and is already used in this module.

models status rejects --probe with --plain output by throwing a bare Error,
which the CLI failure handler replaces with the generic "The CLI command
failed." line. Throw an ExpectedCliError instead so the human output carries
the option-conflict message, matching the existing throwExpectedCliError
usage in the same module.
@clawsweeper

clawsweeper Bot commented Nov 9, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes models status display the existing explanation when --probe and --plain are used together.

Example: Run openclaw models status --probe --plain.

  • Before: The CLI prints a generic failure and Doctor hint, then exits 1.
  • After: The CLI prints '--probe cannot be used with --plain output.' and exits 1.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal, useful diagnostic repair with shipped-entry-point proof, a discriminating regression, and no findings; pending CI remains a normal merge gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): obviyus exercised the built CLI through node openclaw.mjs in secretless Docker with isolated state, showing the corrected conflict message and unchanged exit code 1; five controls retained their outputs, and the reviewed head changes only test consolidation after that proven production revision.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users receive a generic command failure instead of the explanation for incompatible flags.
Reason: The change restores an existing diagnostic through an established mechanism without changing accepted inputs, defaults, or public APIs.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current CLI diagnostic bug with a minimal change, sufficient built-CLI proof, and no actionable findings; CI remains pending.

Priority: P3
Reviewed head: a428bb7cc29ca0a57732b74435d11dfc2dbad32a

Before merge

None.

Findings

None.

Agent review details

How this fits together

The models CLI passes parsed options to modelsStatusCommand, which rejects incompatible flags before loading configuration; the shared CLI failure renderer turns the resulting error into human or JSON output.

flowchart LR
  A[CLI arguments] --> B[Models status command]
  B --> C[Flag compatibility check]
  C --> D[Expected CLI error]
  D --> E[Shared failure renderer]
  E --> F[Diagnostic and exit code]
Loading

Technical review

Best possible solution:

Use the existing expected-error helper at the rejection site and retain the consolidated regression test.

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

Current-main source retains the misclassified rejection, and the supplied built-CLI comparison demonstrates the failure; this read-only review ran no target code.

Is this the best way to solve the issue?

This is the smallest complete fix: preserve the incompatible-option invariant while using the module's existing expected-error owner to expose its explanation.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Probe/plain rejection keeps the original intent (40181af: Auth probes were introduced with an explicit rejection of plain output; this PR retains that rejection and its message.)
  • Option rejection regression table keeps the original intent (fix(cli): show the reason for invalid numeric flag values #189993: The table protects expected-error classification for invalid numeric probe options; both cases remain while the conflict case joins them.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 40181af adds src/commands/models/list.status-command.ts:60 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 40181afdedb0; files: src/commands/models/list.status-command.ts)
  • Jerome: Raw commit bc097bf adds src/commands/models/list.status-command.ts:164 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bc097bf6404f; files: src/commands/models/list.status-command.ts)
  • Ayaan Zaidi: Raw commit 76dc66f adds src/commands/models/list.status-command.ts:111 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 76dc66f5fa5d; files: src/commands/models/list.status-command.ts)

PR surface

Source 0, Tests -2. Total -2 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 6 8 -2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 7 9 -2

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P3: This is a focused diagnostic improvement for an invalid combination of advanced CLI flags; normal model workflows remain available.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-09T16:19:49.871Z sha 2d914b0 :: needs maintainer review before merge. :: none

Reviewed November 9, 2026, 12:17 PM ET / 17:17 UTC (Revision 2).

@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Proof on built CLIs (pnpm build, node openclaw.mjs), node 24.22.1 in Docker, no secrets, isolated HOME and state dir. main fae16ca4 vs this PR's fix (2d914b0d), each run once.

openclaw models status --probe --plain

main, exit 1:

[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw --profile p196094base doctor`.

this PR, exit 1:

--probe cannot be used with --plain output.

Controls: stdout, stderr and exit code were byte-identical on main and on this PR (after normalizing paths and pids) for:

  • models status --json (exit 0)
  • models status --plain (exit 0)
  • models status --probe (exit 0)
  • models status --probe --probe-timeout abc (exit 1, --probe-timeout must be a positive number., the existing expected-error path)
  • models status --json --plain (exit 1, same JSON error on stdout)

Tests: I removed the allocation file and folded the regression into the existing option-rejection table in list.status.test.ts, so net test lines are -2. The file passes (24/24). With the production line reverted, the new {"json":false,"plain":true} row fails.

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 9, 2026
@obviyus
obviyus merged commit a0e1046 into openclaw:main Nov 9, 2026
97 checks passed
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Landed in a0e1046. Thanks @wangmiao0668000666. models status now shows the real --probe/--plain conflict message.

obviyus added a commit that referenced this pull request Nov 10, 2026
fix(cli): show the invalid --agent option error in status

openclaw status --agent <id> without --usage threw a plain Error, so the CLI showed only the generic "The CLI command failed." line instead of the existing message "--agent is only valid with --usage". The option checks now use the existing throwExpectedCliError, as #196094 did for models status. The exit code and the JSON on stdout are unchanged, and no text is new.

Evidence: built CLIs on node:24.22.1 in secretless Docker with an isolated HOME. status --agent beta printed only the generic failure line on main (exit 1) and the existing option message with this change (exit 1). With --json, stdout and the exit code are the same on both; stderr now carries the option message instead of the generic line. Blank --agent cases, status --usage --agent main and plain status are identical on both. Details: #196081 (comment).

Thanks @wangmiao0668000666.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 10, 2026
…or (#196382)

fix(models): surface the --json/--plain conflict as an ExpectedCliError

openclaw models list --json --plain and models status --json --plain threw a plain Error, so the CLI showed only the generic "The CLI command failed." line instead of the existing message "Choose either --json or --plain, not both." The shared option check now uses ExpectedCliError, as #196094 and #196081 did for related checks. The exit code and the JSON error on stdout are unchanged, and no text is new.

Evidence: built CLIs on node 24.22.1 in secretless Docker with an isolated HOME. Both commands with --json --plain printed only the generic failure line on main (exit 1) and the existing conflict message with this change (exit 1); the JSON error on stdout is byte-identical. list --json, list --plain, status --json, status --plain and status --probe --plain are identical on both. Details: #196382 (comment).

Thanks @wangmiao0668000666.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…penclaw#196094)

fix(cli): show the --probe/--plain option conflict in models status

openclaw models status --probe --plain threw a plain Error, so the human output showed only the generic "The CLI command failed." line and the doctor hint instead of the existing message "--probe cannot be used with --plain output." The check now uses the existing throwExpectedCliError, as the --probe-timeout check in the same file already does. The exit code and --json output are unchanged, and no text is new.

Evidence: built CLIs on node 24.22.1 in a secretless Docker container with an isolated HOME and state dir. On main, --probe --plain printed only the generic failure line (exit 1). With this change it prints the existing conflict message (exit 1). --json, --plain, --probe, the existing --probe-timeout error and --json --plain give byte-identical output and exit codes on both. Details: openclaw#196094 (comment).

Thanks @wangmiao0668000666.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…96081)

fix(cli): show the invalid --agent option error in status

openclaw status --agent <id> without --usage threw a plain Error, so the CLI showed only the generic "The CLI command failed." line instead of the existing message "--agent is only valid with --usage". The option checks now use the existing throwExpectedCliError, as openclaw#196094 did for models status. The exit code and the JSON on stdout are unchanged, and no text is new.

Evidence: built CLIs on node:24.22.1 in secretless Docker with an isolated HOME. status --agent beta printed only the generic failure line on main (exit 1) and the existing option message with this change (exit 1). With --json, stdout and the exit code are the same on both; stderr now carries the option message instead of the generic line. Blank --agent cases, status --usage --agent main and plain status are identical on both. Details: openclaw#196081 (comment).

Thanks @wangmiao0668000666.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…or (openclaw#196382)

fix(models): surface the --json/--plain conflict as an ExpectedCliError

openclaw models list --json --plain and models status --json --plain threw a plain Error, so the CLI showed only the generic "The CLI command failed." line instead of the existing message "Choose either --json or --plain, not both." The shared option check now uses ExpectedCliError, as openclaw#196094 and openclaw#196081 did for related checks. The exit code and the JSON error on stdout are unchanged, and no text is new.

Evidence: built CLIs on node 24.22.1 in secretless Docker with an isolated HOME. Both commands with --json --plain printed only the generic failure line on main (exit 1) and the existing conflict message with this change (exit 1); the JSON error on stdout is byte-identical. list --json, list --plain, status --json, status --plain and status --probe --plain are identical on both. Details: openclaw#196382 (comment).

Thanks @wangmiao0668000666.

Co-authored-by: Ayaan Zaidi <[email protected]>
@wangmiao0668000666
wangmiao0668000666 deleted the fix/models-status-probe-plain branch November 11, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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.

2 participants