Skip to content

fix(pairing): pairing list and approve print only "The CLI command failed." instead of the reason - #190053

Closed
yxshee wants to merge 1 commit into
openclaw:mainfrom
yxshee:fix/pairing-cli-hidden-errors
Closed

yxshee wants to merge 1 commit into
openclaw:mainfrom
yxshee:fix/pairing-cli-hidden-errors

Conversation

@yxshee

@yxshee yxshee commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: openclaw pairing list and openclaw pairing approve print only "The CLI command failed. For help, run openclaw 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 --json output are unchanged.

Why This Change Was Made

The pairing command threw plain Error for its input checks. The root failure handler treats plain errors as unexpected and replaces them with the generic line, while --json showed the real message. The checks now use the existing throwExpectedCliError helper, 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 dismiss in the same file with the same helper.

Evidence

Before/after output captured on a build of main at 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:

$ openclaw pairing list
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
$ openclaw pairing approve ABC123
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
$ openclaw pairing approve telegram ABC123
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
$ openclaw pairing list --json   # the reason was only visible here
{ "ok": false, "error": { "type": "cli_error", "message": "No chat DM pairing channels are configured. To approve a TUI or device request, use openclaw devices approve instead." } }

After (same build plus this change):

$ openclaw pairing list
No chat DM pairing channels are configured. To approve a TUI or device request, use openclaw devices approve instead.
$ openclaw pairing approve ABC123
Usage: openclaw pairing approve <channel> <code> (or: openclaw pairing approve --channel <channel> <code>)
$ openclaw pairing approve telegram ABC123
No pending pairing request found for code "ABC123". Run openclaw pairing list --channel telegram to list pending requests.
$ openclaw pairing list --channel telegram --account ' '
--account must not be blank

All exit 1, as before.

Tests:

  • pnpm test src/cli/pairing-cli.test.ts --maxWorkers=1: 13 passed.
  • New test "shows the devices redirect in human failure output, not a generic failure" runs the real formatCliFailureLines path. It fails on main (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 --check and oxlint --type-aware on 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.

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.
@clawsweeper

clawsweeper Bot commented Nov 1, 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 size: XS labels Nov 1, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Pairing 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.

  • Before: The CLI prints “The CLI command failed.” and suggests running Doctor.
  • After: The CLI names the unmatched code ABC123 and suggests openclaw pairing list --channel telegram.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused repair with relevant shipped CLI output, a distinct renderer regression, passing head gates, and no identified correctness or security defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The contributor's terminal capture exercises the shipped openclaw pairing list and approve entry points on Linux with isolated fresh state, showing specific recovery guidance after the fix for missing channels, usage errors, an unknown code, and a blank account; the regression additionally exercises the real renderer.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Pairing input failures hide their existing explanation and recovery command behind a generic CLI failure.
Reason: Restores deliberately authored operator guidance through the existing renderer without adding options, changing defaults, or altering approval behavior.

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
Reviewed head: 0716dd91a6e7aca02741b104121e1bb32a7772b1

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Channel validation and unknown-code guidance keeps the original intent (938cc36: Make common command errors actionable; the later terminal-guidance commit added a concrete channel example. Existing messages and acceptance rules remain intact.)
  • No-channel device redirect keeps the original intent (44ec758: Redirect operators who confuse chat DM pairing with device approval, as explained in fix(cli): stop pairing list crashing with empty channel enum #98142.)
  • Blank account rejection keeps the original intent (1b90029: Reject explicit blank selectors rather than silently widening account scope; this rejection remains before owner dispatch.)
  • Conflicting pairing targets keeps the original intent (433bb3f: Reject ambiguous CLI targets before dispatch, as documented in fix(cli): make commands, completion, and JSON output reliable #116033; the patch preserves that check.)
  • Pairing operation ownership keeps the original intent (2fcecdb: Route pairing operations through the live owner without local replay after refusal or uncertain acknowledgement; this PR leaves those operations unchanged.)
  • Concise unexpected-error presentation keeps the original intent (d0b48d6: fix: make common error messages short and helpful #163381 keeps internal diagnostics out of ordinary error output while retaining useful recovery guidance; explicitly classifying known pairing input failures follows that distinction.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +1, Tests +17. Total +18 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 15 14 +1
Tests 1 17 0 +17
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 32 14 +18

Labels

Label changes:

  • add P2: Hidden input-error guidance causes avoidable confusion in an operator CLI workflow, with no demonstrated loss of approval functionality.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Hidden input-error guidance causes avoidable confusion in an operator CLI workflow, with no demonstrated loss of approval functionality.
  • 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.

Reviewed October 31, 2026, 11:56 PM ET / November 1, 2026, 03:56 UTC.

obviyus added a commit that referenced this pull request Nov 2, 2026
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]>
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @yxshee! Your fix is included in #189993, which has now landed with your commit kept for credit.

@obviyus obviyus closed this Nov 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
…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]>
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants