Repository navigation
fix(cli): explain unknown ids in devices reject and remove - #190299
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. |
|
@clawsweeper re-review Head abf985f fixes the assertion-safety ratchet: the moved |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesExplain unknown IDs in devices reject and remove with a specific error and a devices list recovery hint. Example: Run openclaw devices remove does-not-exist against an authorized Gateway.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current CLI diagnostics bug with a focused change, relevant regression coverage, and sufficient real-Gateway proof; no actionable defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherRegistered device CLI commands send pairing RPCs to the Gateway; the command runtime translates matching unknown-ID refusals into human diagnostics or the existing JSON failure envelope. flowchart LR
A[Device CLI command] --> B[Device command runtime]
B --> C[Gateway pairing RPC]
C --> D[Unknown ID refusal]
D --> E[Shared ID classifier]
E --> F[Existing failure output]
Technical reviewBest possible solution: Retain this focused command-boundary fix using the existing classifier and failure-output owner. Do we have a high-confidence way to reproduce the issue? Current-main source shows the precise Gateway refusal reaching generic text rendering, and the contributor supplies matching real-Gateway output; no target code was executed during this review. Is this the best way to solve the issue? The fix preserves Gateway authorization and successful operations, shares the existing approval classifier, and routes refusals through established output handling without new state or configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5e6d9a2781d6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +15, Tests +35, Other 0. Total +50 across 4 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 HistoryReview history (1 earlier review cycle)
Reviewed November 2, 2026, 11:42 PM ET / November 3, 2026, 04:42 UTC (Revision 2). |
…d-reason # Conflicts: # src/cli/devices-cli.runtime.ts
|
@obviyus when you have a moment, this is ClawSweeper 5/5/5 and ready for maintainer look; happy to adjust anything. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…190299) * fix(cli): explain unknown ids in devices reject and remove * test(cli): document the unknown-id gateway error assertion * fix(cli): narrow the unknown-id gateway error without a type assertion * chore(cli): shrink devices runtime assertion baseline --------- Co-authored-by: jerome-queck <[email protected]>
Fixes #190293
What Problem This Solves
openclaw devices reject <id>andopenclaw devices remove <id>with an id the Gateway does not know printed onlyThe CLI command failed.(exit 1). The Gateway'sINVALID_REQUEST unknown requestId/unknown deviceIdreason was lost in text mode, and the JSON envelope carried the bare Gateway string.User Impact
Text and
--jsoncallers now getNo pending device request matches <id>/No paired device matches <id>plus aopenclaw devices listhint, the same wordingdevices approvealready uses. Exit code stays 1. Other Gateway failures still go to the root failure handler unchanged.Why
runDevicesDeleteCommandcalleddevice.pair.reject|removewithout the unknown-id handlingdevices approvehas. The fix catches only the unknown-id refusal for the requested field and routes it through the existingfailDevicesCommand. TheisUnknownRequestIdErrorhelper moves tosrc/cli/devices-cli.unknown-id.tsand takes the field, sodevices-cli.runtime.tsdoes not grow past the line-cap ratchet. The moved helper now narrows withinchecks instead of a type assertion, so the runtime file's assertion-safety baseline shrinks from 9 to 8.Evidence
Linux, isolated HOME, a real local Gateway from this tree (
gateway run --auth token --bind loopback), the same Gateway for both runs.Before (main
devices-cli.runtime.ts):After (head 56ea4f0):
Scoped tests:
vitest run --config test/vitest/vitest.cli.config.ts src/cli/devices-cli.test.ts: 43 passed. The two new unknown-id text cases fail on the main runtime (2 failed | 41 passed). New coverage: text and JSON for both commands, and a non-unknown-id failure that still reaches the root handler.