Repository navigation
fix(pairing): pairing list and approve print only "The CLI command failed." instead of the reason - #190053
fix(pairing): pairing list and approve print only "The CLI command failed." instead of the reason#190053yxshee wants to merge 1 commit into
Conversation
The pairing commands threw plain Error for every input problem, which the CLI failure handler treats as unexpected and replaces with the generic "The CLI command failed." line. Users never saw the actionable text, such as the redirect to openclaw devices approve or the unknown-code hint. Throw them as expected CLI errors so the message is printed as-is.
|
🦞👀 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 changesPairing commands classify input failures as expected CLI errors so users see the existing reason and recovery guidance. Example: Run openclaw pairing approve telegram ABC123 when that code has no pending request.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open for landing: this PR fixes a current pairing diagnostic bug with a focused change, supplied CLI proof, and passing head checks; no actionable defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe pairing CLI validates command arguments, routes valid operations through the existing state owner, and passes failures to the shared CLI renderer for human or JSON output. flowchart TD
A[Pairing CLI arguments] --> B[Pairing validation]
B --> C[Existing state owner]
B --> D[Expected CLI error]
C --> D
D --> E[Shared failure renderer]
E --> F[Human guidance or JSON]
Technical reviewBest possible solution: Land the existing expected-error classification fix with its renderer regression while preserving pairing validation and state ownership. Do we have a high-confidence way to reproduce the issue? Current-main pairing errors and the production failure renderer establish the hiding mechanism; the contributor supplies matching before/after CLI output, but this read-only review did not execute it. Is this the best way to solve the issue? Yes: the smallest complete repair classifies known input failures at their producer using the existing shared helper, preserving unexpected-error handling and adding a regression at the previously missed rendering boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b1b0a88900d8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Tests +17. Total +18 across 2 files. Added test files: 0. View PR surface stats
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 Reviewed October 31, 2026, 11:56 PM ET / November 1, 2026, 03:56 UTC. |
fix(cli): show the specific reason for rejected numeric options and pairing inputs Fixes #189962. When a numeric option was invalid or a pairing input was rejected, the CLI already had a specific explanation, but the root CLI replaced it with its generic failure output. These diagnostics are now raised as `ExpectedCliError`, so the user sees the specific reason. Accepted inputs, parsing, messages, defaults, JSON output and approval behavior are unchanged. The error class moved to a dependency-light owner to keep the native CLI bootstrap import boundary; a one-line re-export keeps the previous import path, as an approved exception, because the review scanner blocks edits to a test file that imports it. This includes the diagnostic fix from #190053, with yxshee's commit kept for credit. Evidence: built CLI; the shipped CLI prints the specific invalid-limit reason with this change instead of the generic failure. Details: #189993 (comment). Thanks @jerome-queck and @yxshee. Co-authored-by: yxshee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…89993) fix(cli): show the specific reason for rejected numeric options and pairing inputs Fixes openclaw#189962. When a numeric option was invalid or a pairing input was rejected, the CLI already had a specific explanation, but the root CLI replaced it with its generic failure output. These diagnostics are now raised as `ExpectedCliError`, so the user sees the specific reason. Accepted inputs, parsing, messages, defaults, JSON output and approval behavior are unchanged. The error class moved to a dependency-light owner to keep the native CLI bootstrap import boundary; a one-line re-export keeps the previous import path, as an approved exception, because the review scanner blocks edits to a test file that imports it. This includes the diagnostic fix from openclaw#190053, with yxshee's commit kept for credit. Evidence: built CLI; the shipped CLI prints the specific invalid-limit reason with this change instead of the generic failure. Details: openclaw#189993 (comment). Thanks @jerome-queck and @yxshee. Co-authored-by: yxshee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes:
openclaw pairing listandopenclaw pairing approveprint only "The CLI command failed. For help, runopenclaw doctor." for every input problem, so users never see why, for example when no chat DM pairing channel is configured or a pairing code doesn't match.User Impact
User impact: pairing commands now print the actual reason and the next step, such as "use openclaw devices approve instead" or "No pending pairing request found for code …. Run openclaw pairing list --channel telegram". Exit codes and
--jsonoutput are unchanged.Why This Change Was Made
The pairing command threw plain
Errorfor its input checks. The root failure handler treats plain errors as unexpected and replaces them with the generic line, while--jsonshowed the real message. The checks now use the existingthrowExpectedCliErrorhelper, like logs, devices and exec-approvals, so the message is printed as-is. No wording or behavior changes beyond that.Related: #182614 (pairing approve "fails silently" in Docker). #177999 adds
pairing dismissin the same file with the same helper.Evidence
Before/after output captured on a build of
mainat 7b29a23 on Linux, Node 24.22.2, fresh state directory with no channels configured. Tests were rerun on the new base c1efa8b (no changes to the pairing files between the two).Before:
After (same build plus this change):
All exit 1, as before.
Tests:
pnpm test src/cli/pairing-cli.test.ts --maxWorkers=1: 13 passed.formatCliFailureLinespath. It fails onmain(expected '[openclaw] The CLI command failed.…' to contain 'No chat DM pairing channels are configured.') and passes with the fix. The existing tests only checked the thrown message, which is why they passed while users saw the generic line.oxfmt --checkandoxlint --type-awareon both files: clean.Local review: autoreview / local ClawSweeper not run (not available in this environment). Self-reviewed the diff: only the error type changes; messages, control flow and exit codes are the same.