Repository navigation
fix(cli): surface id rebind option remedies instead of a generic failure - #197719
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 changesThis PR makes four OpenClaw ID rebind refusals display their existing remedies through the standard CLI error renderer. Example: Run openclaw id rebind --yes without --kit-stdin.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current CLI diagnostic bug with a focused change and convincing before/after proof; no actionable defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe registered ID command validates recovery options and signs prepared bindings; expected refusals pass to the root CLI renderer for human or JSON output. flowchart TD
A[CLI arguments] --> B[Registered ID command]
B --> C[Option validation]
C --> D[Gateway preparation and kit signing]
C --> E[Expected CLI error]
D --> E
E --> F[Root failure renderer]
F --> G[Actionable output]
Technical reviewBest possible solution: Merge the focused error-classification fix once the existing exact-head CI gate passes. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the plain-error-to-generic-output path, corroborated by supplied before/after CLI evidence; no target code was executed during this read-only review. Is this the best way to solve the issue? Using the existing expected-error owner at the four refusal producers is the smallest complete fix and preserves unexpected-error handling. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7910cd62c6ca. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests -1. Total +2 across 2 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: 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 (2 earlier review cycles)
Reviewed November 12, 2026, 8:47 AM ET / 13:47 UTC (Revision 3). |
registerIdCli's status/rebind/publish .action handlers call runStatus/runRebind, which throw plain Errors for four user-facing option mistakes: --yes needs --kit-stdin, --binding-seq must be a positive whole number, --kit-stdin needs --code, and signature refusal. The root failure renderer only prints the cause for ExpectedCliError, so these remedies were swallowed behind a generic "The CLI command failed" / "For help, run openclaw doctor" message, pointing users at an unrelated command. Promote the four throws to throwExpectedCliError so the existing renderer prints the remedy. No control-flow or exit-code change.
e303f6c to
012adab
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
ClawSweeper status: applying reviewed decision. I am applying the reviewed decision for this pull request: fix(cli): surface id rebind option remedies instead of a generic failure This is item 1/1 in the current shard. Shard 1/1. This transient lease prevents a newer review from overlapping label, comment, or close mutations. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Maintainer proof for head 3e7f6b4 (built CLI, Main
Controls, identical on both arms:
The fourth throw (kit for another claw) needs a live Maintainer edit: the regression is now one compact case ( |
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
Landed in c0f0a42. Thanks @shuisadev and @SunnyShu0925. |
…ure (openclaw#197719) fix(cli): show existing id rebind errors instead of the generic failure openclaw id rebind threw plain errors for its own usage and input checks, so the CLI replaced them with the generic "The CLI command failed." and the user never saw the reason, such as "--yes needs --kit-stdin". Those four throws now use throwExpectedCliError with the same existing text. What rebind accepts, refuses or does is unchanged, and unexpected internal errors still show the generic message. No new text. Evidence: the built CLI in a secretless node:24.22.1 container with an empty config, main once and candidate once. id rebind --yes, --kit-stdin without --code, and a non-positive --binding-seq printed the generic failure on main and print their existing messages with this change, all with exit 1. id rebind --help, a valid rebind without Gateway credentials, and an invalid --url behave the same on both. One compact test case, at -1 net test lines. Details: openclaw#197719 (comment). Thanks @shuisadev and @SunnyShu0925. Co-authored-by: SunnyShu <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Running
openclaw id rebind --yes(without--kit-stdin) — or anid rebindinvocation with a malformed--binding-seq, a missing--codeunder--kit-stdin, or a recovery kit that cannot sign for this claw — reports only the generic two-line failure:The actual remedy (e.g.
--yes needs --kit-stdin: type the recovery kit at the prompt otherwise.) is swallowed, and the user is pointed at an unrelated command. Rebinding keys is an account-recovery path, so the lost guidance is exactly what the user needs.id rebindaction throws plainErrors for four user-facing refusals; the root failure renderer only prints the cause forExpectedCliError, so the remedies are hidden.throwExpectedCliError(...)so the existing renderer prints the remedy.src/cli/id-cli.ts(4 throws) and one regression file,src/cli/id-cli.commands.test.ts, covering all four.Cancelled.user-abort paths.Why This Change Was Made
The canonical owner for surfacing user-facing CLI errors is
throwExpectedCliError(src/cli/expected-cli-error.ts); adjacent command families (agent exec, backup, nodes, gateway, connect, capability) already route through runtime wrappers that map to it. Only theidregistration chain was bare. This change alignsid rebindwith that convention without altering behavior beyond the rendered message.throwExpectedCliErrorkeeps the message identical to the existing human text and requires no new rendering code..actionin a try/catch that rethrows asExpectedCliError— rejected because it would also catch unrelated errors, and the four throws already carry the correct text.User Impact
When
id rebindis invoked with a wrong or missing option, the user now sees the specific remedy (e.g.--yes needs --kit-stdin: ...) instead of a generic failure and an unrelatedopenclaw doctorhint.Evidence
Real CLI, throwaway state dir (
OPENCLAW_STATE_DIR=/tmp/oc-id-proof-*, empty{}config, no Gateway), same commands on both arms.src/cli/id-cli.tsis the only production file this PR changes, and it is identical to the reviewed head.Before/after, same commands on both arms:
openclaw id rebind …origin/main)--yes[openclaw] The CLI command failed.+ doctor hint--yes needs --kit-stdin: type the recovery kit at the prompt otherwise.--kit-stdin--kit-stdin needs --code <link-code> from your OpenClaw ID account.--kit-stdin --yes --code test-link-code --binding-seq 0--binding-seq must be a positive whole number.The fourth refusal (
describeSignRefusal) is only reachable after a liveopenclawId.authorityrebind_prepareanswer, so it has no Gateway-free CLI run; the regression below drives it with that RPC mocked and a kit from another claw.Committed regression, before/after the fix:
Both shapes go through the shipped
registerIdCliregistration andparseAsync, so option parsing and the throwing code path are the real ones.Open PR collision check: searched the latest open PRs' changed-files for
src/cli/id-cli.ts; none touched it. Sibling known entries about gateway lifecycle refusal, attach, models auth login, and plugins pack are different files/functions, so there is no overlap.