Repository navigation
fix(cli): show the reason for invalid numeric flag values - #189993
Conversation
|
🦞👀 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 changesClassify existing numeric-option and pairing input errors as expected CLI failures so their explanations reach users. Example: Run openclaw logs --limit abc.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes current CLI diagnostic failures with relevant shipped-CLI proof and no identified code defects; required CI remains unresolved. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCLI validators turn command arguments into values or errors, and the shared root renderer converts those errors into human diagnostics and JSON failure envelopes. flowchart TD
A[CLI arguments] --> B[Existing validators]
B --> C[Valid command dispatch]
B --> D[Expected CLI error]
D --> E[Shared root renderer]
E --> F[Stderr guidance and JSON output]
Technical reviewBest possible solution: Land the producer-side classification repair using the shared dependency-light error constructor and the explicitly approved re-export. Do we have a high-confidence way to reproduce the issue? Current-main validators and root rendering establish the failure mechanism, corroborated by supplied built-CLI before/after output; this read-only review executed no target code. Is this the best way to solve the issue? The smallest complete fix classifies known failures at existing producers, preserves parsing and authority checks, and extracts the unchanged error type to satisfy the bootstrap import boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6842bb579adb. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests -2, Docs +7. Total +11 across 62 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 (3 earlier review cycles)
Reviewed November 1, 2026, 8:55 PM ET / November 2, 2026, 01:55 UTC (Revision 4). |
Built CLI comparisonMain Each command/value combination below ran twice on each ref: Actual candidate stderr examples: Valid controls were built CLI log reads with limit 2 / max-bytes 10000 / interval 1000; device and channel reads with timeout 10000; and model status with fractional probe timeout 1.5, concurrency 2 and max tokens 8. All exited zero and retained their expected JSON/JSONL formats. Gateway-backed controls used a real isolated built Gateway, not a transport stub. No model inference, paid provider or live account was involved. Review-scope correction: at this pinned main, text-mode channels/models status also reproduced generic stderr. A debug-only diagnostic capture showed the shipped Build/import proof: the full candidate build passed, including native declarations, the CLI bootstrap import guard and Plugin SDK export checks. An initial import of the full failure renderer from the timeout parser correctly tripped the native-hook-relay guard on AI diagnostics. The final fix moves the unchanged expected-error constructor/helper to a runtime-dependency-free module and migrates creators, without widening the guard or retaining a compatibility re-export. The probe parser stays inline; duplicate helper-only tests were consolidated into existing owners. Focused checks: 171 passing tests across numeric classification, root formatting, CLI process exits, bootstrap/native relay behavior, plugin CLI error identity and lazy command policy. Changed-file lint/format passed. The producer regressions replayed against main gave 8 intended classification failures / 47 passes. Whole-PR delta: production +3, tests −2, documentation +4. The reporter's original commit is preserved. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
fix(cli): show existing specific errors instead of the generic CLI failure Some CLI commands already had a specific error reason, but the root CLI replaced it with the generic "The CLI command failed." output. These existing diagnostics are now raised as `ExpectedCliError`, the same way as #189993, so users see the specific reason. The message text and the exit code (1) are unchanged, and success and JSON output are unchanged. This sweep includes #191225 and #191219, with yxshee's commits kept for credit. Evidence: built CLI in secretless Node 24.22.1 Docker. All six failure paths showed the generic failure on main twice and the existing specific reason with this change twice, with exit code 1. Six success and JSON controls were unchanged. Details: #191295 (comment). Thanks @yxshee. Co-authored-by: yxshee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Align the capability command fixtures with ExpectedCliError propagation after openclaw#189993. Keep exact human and machine diagnostics and all pre-dispatch rejection checks. Retain blank video duration in the existing duration table. The original Bun replay fails three assertions. The repaired complete file passes all 102 tests on pinned Bun 1.4.4 and Node 24.22.1; the real CLI exits 1 with canonical diagnostics for all three invalid inputs. Five additional assertion lines preserve the error boundary contract.
The ExpectedCliError migration in openclaw#189993 intentionally prints the invalid timeout reason to stderr. Align the five real status/health CLI cases with that diagnostic while preserving exact JSON, exit status, flag ordering, forced Commander, and TTY restoration checks. Reproduced all five obsolete assertions on the base. Fixed full-file proof: 29 passed on Node 24.22.1 (28.97s Vitest, 45.618s wall). Targeted typecheck, lint, format, and diff checks pass. No production changes or test-line growth. Failure evidence: https://github.com/openclaw/openclaw/actions/runs/41383453205/job/125080813156
…law#191295) fix(cli): show existing specific errors instead of the generic CLI failure Some CLI commands already had a specific error reason, but the root CLI replaced it with the generic "The CLI command failed." output. These existing diagnostics are now raised as `ExpectedCliError`, the same way as openclaw#189993, so users see the specific reason. The message text and the exit code (1) are unchanged, and success and JSON output are unchanged. This sweep includes openclaw#191225 and openclaw#191219, with yxshee's commits kept for credit. Evidence: built CLI in secretless Node 24.22.1 Docker. All six failure paths showed the generic failure on main twice and the existing specific reason with this change twice, with exit code 1. Six success and JSON controls were unchanged. Details: openclaw#191295 (comment). Thanks @yxshee. Co-authored-by: yxshee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
… when the flag comes before the subcommand (#190366) fix(cli): show existing hooks validation errors instead of the generic failure Two `hooks` command validations already had specific error messages, but the root CLI replaced them with the generic "The CLI command failed." output. These validations now raise `ExpectedCliError`, the same way as #189993 and #191295, so users see the specific reason. The message text, exit code (1) and JSON envelopes are unchanged. Evidence: built CLI in secretless Node 24.22.1 Docker. Both validations showed the generic failure on main twice and the specific reason with this change twice, with exit code 1. Valid parent and leaf invocations, JSON output and the existing leaf diagnostic were unchanged. Details: #190366 (comment). Thanks @yxshee. Co-authored-by: Ayaan Zaidi <[email protected]>
… when the flag comes before the subcommand (openclaw#190366) fix(cli): show existing hooks validation errors instead of the generic failure Two `hooks` command validations already had specific error messages, but the root CLI replaced them with the generic "The CLI command failed." output. These validations now raise `ExpectedCliError`, the same way as openclaw#189993 and openclaw#191295, so users see the specific reason. The message text, exit code (1) and JSON envelopes are unchanged. Evidence: built CLI in secretless Node 24.22.1 Docker. Both validations showed the generic failure on main twice and the specific reason with this change twice, with exit code 1. Valid parent and leaf invocations, JSON output and the existing leaf diagnostic were unchanged. Details: openclaw#190366 (comment). Thanks @yxshee. Co-authored-by: Ayaan Zaidi <[email protected]>
…ain is configured (#192127) fix(dns): show existing errors from dns setup guards `openclaw dns setup` guards threw plain errors, so their existing messages were hidden behind a generic CLI failure. They now use the existing expected-CLI-error path and show the same messages, as #189993 did for other commands. Exit codes are unchanged, and there is no change to DNS domains, defaults, zones or subprocesses. Evidence: built Linux CLI, twice per ref. For a missing domain, an invalid domain, and `--apply` on Linux, main printed generic failures; with this change the existing messages are printed with exit 1. Plan-only output is unchanged, with no brew or sudo calls, zone creation, CoreDNS installation or config rewrites. The macOS tailnet guard is covered by unit tests only. Details: #192127 (comment). Thanks @yxshee. Co-authored-by: Ayaan Zaidi <[email protected]>
…ain is configured (openclaw#192127) fix(dns): show existing errors from dns setup guards `openclaw dns setup` guards threw plain errors, so their existing messages were hidden behind a generic CLI failure. They now use the existing expected-CLI-error path and show the same messages, as openclaw#189993 did for other commands. Exit codes are unchanged, and there is no change to DNS domains, defaults, zones or subprocesses. Evidence: built Linux CLI, twice per ref. For a missing domain, an invalid domain, and `--apply` on Linux, main printed generic failures; with this change the existing messages are printed with exit 1. Plan-only output is unchanged, with no brew or sudo calls, zone creation, CoreDNS installation or config rewrites. The macOS tailnet guard is covered by unit tests only. Details: openclaw#192127 (comment). Thanks @yxshee. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes #189962. Includes the diagnostic-only fix from #190053, preserving yxshee's original commit and credit alongside Jerome's original #189993 work.
Existing numeric-option validation and rejected pairing inputs lose their specific explanations behind the root CLI's generic failure output. Classify those already-authored diagnostics as
ExpectedCliError, without changing accepted inputs, parsing, messages, defaults, JSON payloads or approval behavior.Why This Change Was Made
Move the unchanged error class/helper into a dependency-light owner and migrate production callers, preserving the native CLI bootstrap import boundary. Keep the probe parser in its existing owner and repair the root-dispatch regression expectation. No new flags, public API, model-facing behavior, pairing approval logic, permissions or credential handling changes.
Explicitly approved internal re-export exception
Retain the contributor's one-line
ExpectedCliErrorre-export insrc/cli/failure-output.tsfor the unchangedsrc/cli/plugins-cli.marketplace-entries.test.tsimport. Ayaan explicitly approved this shim as an exception to the usual complete-cutover rule. All production constructor consumers use the dependency-light owner directly; this re-export preserves the same constructor identity and adds no wrapper or alternative implementation.This is necessary because the ClawSweeper input scanner stages the complete merge-base and head blobs of changed paths, plus their patch; it does not scan only added lines. The marketplace test contains a pre-existing credential-shaped synthetic URL fixture. Its blob is identical on the PR and current main (
9b890becdad73b93cd4ffb5e3bcd63c5952aacae). Touching its import brings that complete base blob into the scan and caused the documented refusals. Rebasing or merging current main would not remove that fixture, and splitting or renaming the file still includes its old base blob because scanner collection disables rename detection.The retained re-export keeps this unrelated fixture-bearing test outside the introduced diff. No fixture assertions are removed, and no scanner, scanner policy, allowlist or ClawSweeper code is changed. The contributor's export-only adjustment is retained through the current-main refresh; no history rewrite was used.
Evidence
Current head
8df5698fb6a632b09f05774f77ea8b15f3dcf9d1merges freshly fetched maind0177edd6c8dc3307721f0abd7f41eef7a13dd9f. Fresh merged-head proof: full candidate build, 116 passing focused tests across six files, and a shippedlogs --limit abccheck that prints the specific reason and exits 1. The stale exec-policy, update-helper and model-status callers all retain imports from the dependency-light error owner.Retained original before-and-after matrix:
Secretless
node:24.22.1Docker; shipped built CLI on main1f4a08f7925f2a7267fe9e1a69dccb6d53428830and candidate9acff964347cddb0a2d459c7560b89f0dd07ff56, explicit isolated profiles/config/state. Each invalid case runs twice on each ref.Numeric JSON payloads unchanged in 10 comparisons; pairing JSON unchanged in four comparisons after profile-name normalization. All rejected cases exit 1. Pairing fixtures seed no pending requests and perform no successful approvals; rejected calls leave config unchanged.
The previous contributor head
52898b70f83af97c489080f2fefaec66615d1606added only the retained re-export and corresponding test-import restoration to that proved candidate. It received a fresh 5/6 review with no findings after the explicit shim exception and literal-only discussion redaction. The current merge preserves those commits; the new candidate check above is separate from, and does not claim to replay, the full original matrix.200 focused checks pass across 12 files in the retained proof. Counterfactual main runs reproduce eight numeric classification failures and one pairing classification failure. The full candidate build includes the CLI bootstrap guard. The earlier pushed CI failure was the stale root-dispatch expectation; the corrected file passes all 17 tests.
Detailed built-CLI capture. Historical scanner refusal. This does not claim to fix the separate live pairing approval timeout issue.
Net production lines +6, tests -2, docs +7 against the merge base. No CHANGELOG edits.
Merge Danger
Two-way door: reverting restores the previous diagnostic presentation. No persisted-state migration, approval-policy change or accepted-input change. Blast radius is expected-error rendering for the existing CLI validators; the retained internal re-export points to the same constructor.