Repository navigation
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 three channels resolve input failures display their existing remedies on stderr in JSON mode. Example: Run openclaw channels resolve friends --agent " " --json.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current-main diagnostic bug with a minimal change and no actionable findings. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe channels CLI passes arguments to the resolve command, whose rejected errors reach the shared CLI renderer for stderr diagnostics and JSON failure envelopes. flowchart TD
A[CLI arguments] --> B[Channels resolve command]
B --> C[Input guards]
C --> D[Expected CLI error]
D --> E[Shared failure renderer]
E --> F[Stderr remedy and JSON envelope]
B --> G[Channel resolver]
Technical reviewBest possible solution: Use the existing expected-error helper at these three guards while preserving their messages and the shared renderer. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the plain-error rendering path, and supplied base/head terminal runs corroborate all three failures; this review executed no target code. Is this the best way to solve the issue? This is the smallest complete repair: classify expected failures where they originate and reuse the existing rendering owner without adding wrappers or message matching. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7d7d86bb79ca. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests 0. Total +1 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 (1 earlier review cycle)
Reviewed November 15, 2026, 9:18 AM ET / 14:18 UTC (Revision 2). |
|
Verified base Host proof tiers: Ran each command with and without
All three JSON cases previously printed this stderr: The candidate instead prints the corresponding existing message: Controls: all exit codes remain 1; JSON stdout is byte-identical on base and candidate; all text-mode stdout/stderr is identical. Unknown
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 636454e. Thanks @SunnyShu0925. |
…penclaw#199608) fix(cli): report channels resolve input errors through the expected-error path `openclaw channels resolve --json` threw plain errors for three input checks (no usable entries, a blank `--agent`, and a catalog channel whose plugin is not installed), so `--json` stderr showed the generic failure plus the Doctor hint instead of the existing message. The three checks now use throwExpectedCliError with the same messages. All three run before any entry name is resolved; no resolve result, lookup order or wording changes. Evidence: host, isolated state and config, no channel credentials. Vitest-source: three cases fail on base, 12 pass here. Pinned-Bun source: `channels resolve ' ' --json`, `channels resolve x --agent ' ' --json` and `channels resolve x --channel agentmail --json` (real uninstalled catalog plugin): base prints the generic failure and Doctor hint, this change prints the existing message. Text mode, JSON stdout, exit codes and an unknown --channel are identical on both. Receipts: openclaw#199608 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw channels resolve friends --agent " " --jsonanswers with the generic wrapper pair[openclaw] The CLI command failed./[openclaw] For help, run openclaw doctor.on stderr and never shows the actionable--agent must not be blanktext that the same command prints in the human lane, so scripts and agents that drive--jsoncannot tell what to fix without parsing the stdout envelope. The same gap hides the remedies of the other two input guards ofchannels resolve(empty entry list, catalog channel not installed).channelsResolveCommandthrow a plainError, so the structured-output renderer treats them as unexpected crashes instead of expected CLI failures. The remedy text survives only inside the JSON envelope on stdout, while stderr shows the two generic wrapper lines.throwExpectedCliErrorowner so the failures are classified as expected CLI errors; the renderer then prints the same remedy to stderr that the human lane already prints.src/commands/channels/resolve.tsadds one import and replacesthrow new Error(...)withthrowExpectedCliError(...)at the three guard sites, keeping every message byte-for-byte. Regression coverage is folded into three existingitcases insrc/commands/channels.resolve.test.tsby asserting the error category next to the existing message assertions (net 0 test lines, no new test file)."type": "cli_error"), and the unsupported-channel runtime capability error later in the same command, which stays a plainErrorbecause it reports a missing runtime capability rather than invalid operator input.Why This Change Was Made
The CLI already has a single owner for "this failure is expected, show the remedy" (
throwExpectedCliErrorinsrc/cli/expected-cli-error.ts), and the sibling guards converted in recently merged PRs (#198471, #198662, #198861, #198965, #199523) use it. The channels command family is mid-sweep:src/commands/channels/capabilities.tsalready constructsExpectedCliErrorwhileresolve.tsstill threw plain errors, so this completes the family's rendering contract instead of adding a second classification path.channels resolvewith or without--channel,--agent,--kind) shares these three guards and gets the same remedy for free.channels-cli.tsregistration wrapper and rethrowing was rejected — it duplicates the messages in a second place and misses future callers of the command. Special-casing these messages in the JSON renderer was rejected as an over-broad change touching every command, and reclassifying the unsupported-channel capability error was rejected because genuine runtime failures must keep the generic rendering.--jsonstderr now shows the remedy instead of the generic wrapper pair for these three expected, user-input failures; the JSON envelope, exit code, and human lane are byte-identical (see thecmpresults below).User Impact
Operators and automation running
openclaw channels resolve ... --jsonnow see the exact remedy on stderr —At least one entry is required. Example: openclaw channels resolve --channel discord <name-or-id>.,--agent must not be blank, orChannel plugin "discord" is not installed. Run openclaw channels add --channel discord first.— and can correct the invocation without digging into the stdout envelope. Human-output users, the JSON payload, and the exit status are unchanged.Evidence
origin/main,de40bf5)c434c61)channels resolve " " --jsonstderr[openclaw] The CLI command failed.+[openclaw] For help, run \openclaw doctor`.` (remedy missing)At least one entry is required. Example: openclaw channels resolve --channel discord <name-or-id>.channels resolve friends --agent " " --jsonstderr--agent must not be blankchannels resolve friends --channel discord --jsonstderr (catalog channel not installed)Channel plugin "discord" is not installed. Run openclaw channels add --channel discord first.cmp)--jsonstdout envelope{"ok":false,"error":{"type":"cli_error","message":"<remedy>"}}, exit 1cmp), exit 1channels resolve friends --channel definitely-not-a-channel(control, unconverted capability error)cmp)src/commands/channels.resolve.test.tsBoth arms are real
cliStartupbuilds of the same tree, run through the shipped launcher;--versionself-reports the two commits:Each cell is a complete user command in a fresh, isolated scratch
HOME/ state / XDG runtime directory (chmod 700, user bus cut), with no credentials and no mocks. Representative pair,--agent " "guard:The log-append note comes from the scratch environment and is identical on both arms; the only differing line is the remedy. Every cell's stderr was checked to contain its own guard's remedy (or, for the control, the capability message in the envelope), so no cell was short-circuited by an earlier registration-layer rejection.
Unchanged outputs are compared byte for byte across the two builds (3 guards x 2 lanes + control x 2 lanes, 16 runs total, all exit 1):
The built bundles show the executed form (base still throws a plain
Error, head uses the shared owner):Regression test, base production code with the folded assertions kept (RED), then the fixed source (GREEN):
Consumer suites of the touched command and its registration/selector/secret-resolution neighbors all stay green on this head:
oxfmt --checkpasses on both touched files;oxlint(259 rules) reports 0 warnings and 0 errors on them.Open PR collision check: scanned the changed-file lists of all 3576 open pull requests (plus a REST follow-up for every PR whose file list exceeded the API window) and ran keyword searches for
channels resolve,must not be blank,The CLI command failed, andthrowExpectedCliError; no open pull request touchessrc/commands/channels/resolve.tsor its test file, and the eight open PRs undersrc/commands/channels/all own different files (status, remove, dead-letters, start-stop, add-wizard). The only two PRs whose file lists could not be enumerated normally (#144984, #155667) are conflicting September forks reporting ~39.6k changed files as a whole-repo divergence artifact; neither targets the channels resolve guards.What was not tested: the success path of resolving against a real installed channel (the change only reclassifies three failure throws and leaves the resolution flow untouched); the full-graph typecheck is not runnable on this host, but the converted call form is byte-identical to the sibling modules already compiling on
origin/main, and CI's typecheck lanes cover it.