Skip to content

fix(nodes): nodes approve and reject print "The CLI command failed." for an unknown request id - #198329

Closed
yxshee wants to merge 1 commit into
openclaw:mainfrom
yxshee:fix/nodes-approve-unknown-request-reason
Closed

yxshee wants to merge 1 commit into
openclaw:mainfrom
yxshee:fix/nodes-approve-unknown-request-reason

Conversation

@yxshee

@yxshee yxshee commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: openclaw nodes approve REQUEST_ID and openclaw nodes reject REQUEST_ID print only [openclaw] The CLI command failed. and a pointer to openclaw doctor on stderr when the request id is not pending. The explanation that was written for this case (unknown id, the pending ids, run openclaw nodes pending) only appears inside the JSON envelope on stdout.

User Impact

User impact: stderr now shows the reason and the next step, in the same form as the other refusals of these commands. The JSON envelope on stdout and the exit code are unchanged.

Why This Change Was Made

nodes approve and nodes reject own machine output, so their errors are rendered by the root error path and not by the nodes error handler. That path prints the text of an expected error and hides a plain Error behind the generic line. The two unknown-request refusals were plain errors, so the explanation written for this case never reached the terminal in the real CLI. They are now raised with throwExpectedCliError, as the unknown worktree id case is. The existing tests read the message from the nodes error handler, which the real commands do not reach, so they now assert the error that the root path renders.

Evidence

From source on main at 3a194b5, Linux, Node 24.22.2, fresh state directory, with a local Gateway running and no pending pairing requests.

Before:

$ openclaw nodes approve zz-nope
{
  "ok": false,
  "error": {
    "type": "cli_error",
    "message": "Unknown node pairing requestId: zz-nope\nNo pending node pairing requests are currently visible.\nRun openclaw nodes pending to inspect current requests."
  }
}
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
exit=1
$ openclaw nodes reject zz-nope
{
  "ok": false,
  "error": {
    "type": "cli_error",
    "message": "Unknown node pairing requestId: zz-nope\nRun openclaw nodes pending to inspect current requests."
  }
}
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
exit=1

After:

$ openclaw nodes approve zz-nope
{
  "ok": false,
  "error": {
    "type": "cli_error",
    "message": "Unknown node pairing requestId: zz-nope\nNo pending node pairing requests are currently visible.\nRun openclaw nodes pending to inspect current requests."
  }
}
Unknown node pairing requestId: zz-nope
No pending node pairing requests are currently visible.
Run openclaw nodes pending to inspect current requests.
exit=1
$ openclaw nodes reject zz-nope
{
  "ok": false,
  "error": {
    "type": "cli_error",
    "message": "Unknown node pairing requestId: zz-nope\nRun openclaw nodes pending to inspect current requests."
  }
}
Unknown node pairing requestId: zz-nope
Run openclaw nodes pending to inspect current requests.
exit=1

Tests:

  • pnpm test src/cli/nodes-cli.coverage.test.ts: 31 passed. pnpm test src/cli/nodes-cli: 74 passed.
  • The three "explains ..." cases for approve and reject now require an expected CLI error that carries the explanation. They fail on main (the commands exit through the nodes handler with a plain error) and pass with the fix. They still check the pending ids, the connection flag reminder, and that the URL and token are not echoed.
  • pnpm check:test-lines-ratchet --staged, pnpm check:line-cap-ratchet, pnpm tsgo:core, oxfmt --check and oxlint --type-aware on both files: clean.

@clawsweeper

clawsweeper Bot commented Nov 13, 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 13, 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR makes unknown node pairing request errors display their explanation and recovery command on stderr.

Example: Run openclaw nodes approve zz-nope with no pending pairing requests.

  • Before: Stderr reports “The CLI command failed” and suggests Doctor.
  • After: Stderr identifies zz-nope as unknown and recommends openclaw nodes pending; JSON output and exit code 1 are preserved.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, correct repair with real CLI evidence and updated regressions; hosted validation remains behind workflow authorization.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied Linux terminal traces exercise the real approve and reject CLI commands against a local Gateway with an unknown ID and show actionable stderr after the fix, unchanged JSON output, and exit code 1.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators receive a generic failure and an unrelated Doctor suggestion instead of the existing explanation for an unknown pairing request.
Reason: Restores actionable guidance already intended by the pairing CLI without introducing options, changing authority, or altering successful operations.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR fixes a current CLI diagnostic bug with a focused change, and no introduced defects were found; required workflows still await authorization.

Priority: P2
Reviewed head: 2b0a19873657f1cd8eb1299399de2b9dfa72cbe1

Before merge

  • Await maintainer action - Authorize the workflows awaiting approval for head 2b0a198 and let required CI complete.

Findings

None.

Agent review details

How this fits together

The nodes CLI sends pairing requests to the Gateway and passes failures to the root CLI renderer, which produces JSON stdout and human-readable stderr.

flowchart LR
  A[Nodes approve or reject] --> B[Pairing CLI]
  B --> C[Gateway pairing RPC]
  C --> B
  B --> D[Expected CLI error]
  D --> E[Root failure renderer]
  E --> F[JSON stdout and guidance stderr]
Loading

Technical review

Best possible solution:

Use the existing expected-error mechanism at both pairing refusal sites so the root renderer displays the established recovery guidance.

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

Current-main source establishes the failure path, and the contributor supplies matching before/after real CLI output; no target code was executed during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete repair: reuse the established error type at the two producers and update existing regressions without adding another renderer or changing pairing policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 273a81799689.

Provenance checked

  • Unknown pairing request guidance keeps the original intent (deb0ffd: Explain stale node approval requests with pending IDs and the registered recovery command.)
  • Shared approve and reject failure branch keeps the original intent (fe493b8: Collapse duplicated command plumbing while preserving output and error contracts.)
  • Existing pairing regression tests keeps the original intent (38fa2ef: Consolidate fixtures and remove low-value duplication while retaining behavioral regressions.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • mushuiyu886: Raw commit deb0ffd adds src/cli/nodes-cli/register.pairing.ts:102 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: deb0ffdcdf92; files: src/cli/nodes-cli/register.pairing.ts)

PR surface

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

View PR surface stats
Area Files Added Removed Net
Source 1 5 4 +1
Tests 1 14 12 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 19 16 +3

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:

No label changes.

Label justifications:

  • P2: Incorrect stderr guidance adds recovery friction to a bounded operator CLI workflow while the detailed JSON error remains available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • 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 November 13, 2026, 10:24 AM ET / 15:24 UTC.

@obviyus

obviyus commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the work here. We're closing this along with the author's other open PRs: the series splits one kind of change across many commands or call sites, and much of it is backed only by issues filed by the same author. Please open one issue per root cause with a reproduction from a real affected setup; maintainers will decide scope and fix it once at the shared owner.

@obviyus obviyus closed this Nov 16, 2026
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants