Repository navigation
fix(skills): retain blank-agent remedies in JSON failures - #199910
Leon-SK668 wants to merge 1 commit into
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. |
|
Thanks for the work here. We're closing this one along with the other open per-command |
|
Codex review: blocked before merge. What this changesThis PR preserves the blank-agent error message on stderr when skills commands fail in JSON mode. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR fixes a current diagnostic defect with a minimal change, and no introduced correctness or security defect was found; GitHub Actions approval remains pending. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherSkills commands pass agent options through the shared workspace resolver; classified validation failures propagate through the command wrapper to the root JSON and human-output renderer. flowchart TD
A[Skills CLI arguments] --> B[Shared agent normalization]
B --> C[Expected CLI error]
C --> D[Command runtime wrapper]
D --> E[Root failure renderer]
E --> F[JSON stdout]
E --> G[Actionable stderr and exit 1]
Technical reviewBest possible solution: Keep validation in the shared normalization owner and use the existing expected-error renderer, as this PR does. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the failure path, and supplied native base captures show the generic stderr response; this read-only review executed no target code. Is this the best way to solve the issue? The patch is the smallest complete fix: the refusal must remain actionable through the root renderer, and classifying it at its existing producer satisfies that invariant without adding another output path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2159567b9ffc. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Tests +8. Total +9 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:
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 Reviewed November 15, 2026, 10:20 PM ET / November 16, 2026, 03:20 UTC. |
fix(cli): show the existing failure message for plain errors in --json mode `runCommandWithRuntime` rethrew every plain error in JSON mode, so the root renderer printed only the generic "The CLI command failed." plus the Doctor hint on stderr, while text mode printed the error's own (redacted) message. Contributors had been patching this one command at a time by converting individual throws to expected errors. JSON mode now shows the same redacted message text mode already shows, once in the shared wrapper; the JSON stdout envelope, exit codes and text-mode output are unchanged. Commands that fail outside the wrapper (for example `models auth login` conflicts and `attach` target resolution) are not covered. No new text. Evidence: host, isolated state. 76 CLI runs across eight command flows (including `backup verify`, `backup remote`, `skills list/check/info` and `migrate plan/apply`), twice per side: base prints the generic failure in --json mode, this change prints the existing message; text failure output, JSON stdout and exit codes are identical across 150 comparisons. 156 unit and 124 consumer tests pass; full build and installed packed smoke pass. CI reds are inherited from main (receipt: #199970 (comment)). Supersedes the closed per-command PRs #199891, #199900, #199910 and #199448. Co-authored-by: Ayaan Zaidi <[email protected]>
fix(cli): show the existing failure message for plain errors in --json mode `runCommandWithRuntime` rethrew every plain error in JSON mode, so the root renderer printed only the generic "The CLI command failed." plus the Doctor hint on stderr, while text mode printed the error's own (redacted) message. Contributors had been patching this one command at a time by converting individual throws to expected errors. JSON mode now shows the same redacted message text mode already shows, once in the shared wrapper; the JSON stdout envelope, exit codes and text-mode output are unchanged. Commands that fail outside the wrapper (for example `models auth login` conflicts and `attach` target resolution) are not covered. No new text. Evidence: host, isolated state. 76 CLI runs across eight command flows (including `backup verify`, `backup remote`, `skills list/check/info` and `migrate plan/apply`), twice per side: base prints the generic failure in --json mode, this change prints the existing message; text failure output, JSON stdout and exit codes are identical across 150 comparisons. 156 unit and 124 consumer tests pass; full build and installed packed smoke pass. CI reds are inherited from main (receipt: openclaw#199970 (comment)). Supersedes the closed per-command PRs openclaw#199891, openclaw#199900, openclaw#199910 and openclaw#199448. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw skills list --agent ' ' --jsonexits1 with the correct JSON failure, but stderr only says that the CLI failed and suggestsopenclaw doctor. The same happens forskills checkandskills info. Operators capturing stdout miss the actual remedy:--agent must not be blank.Why This Change Was Made
Classify the existing refusal at
normalizeExplicitAgentId, the shared Skills admission owner. The existing command wrapper propagates classified errors, and the root renderer already owns their JSON envelope, stderr and exit status. No new formatter or broad error passthrough is needed.Existing-solutions preflight: reuse
throwExpectedCliErrorand the root renderer, following accepted diagnostic repairs #199616, #199639 and #199670. The separate system-agent selection proposal #195423 leaves this guard untouched; this PR does not change which configured agent is selected.User Impact
List/check/info JSON failures now include the actionable message on stderr while keeping the same parsed JSON and exit1. Human refusals remain readable. Agent normalization/selection, workspace ownership, Gateway routing, registry behavior, sanitization and defaults are unchanged.
Two files: production +2/-1, tests +8/-0. The only net production growth is an import. One regression uses the existing command fixture; the native proof exercises sibling read commands and the separate verification path. No new config/default, protocol/schema, dependency, persistence, permission or auth surface.
Evidence
e20293d57c5c053801fba0d8b7331b8441cc1839. The captured driver verifies that the native build stamp matches this head.OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/skills-cli.commands.test.ts src/cli/skills-cli.verify.test.ts --maxWorkers=1 --reporter=dot: 44 passed, exit0;141.48s Vitest/153.15s wrapper. Existing selection, unknown-agent, Gateway, cancellation and redaction coverage remains.tsgo, typedoxlint,oxfmt, test-line ratchet andgit diff --check: pass. No baseline/ledger edits.node --import ./scripts/tsx.mjs scripts/build-all.mts sourcePerformance: pass,209.4s.Not tested: successful Gateway or ClawHub calls, skill installation, live model/channel, installed upgrade, Windows/macOS, full repository suite, full release packaging or upstream CI. Native proof covers isolated local refusals and help. AI assistance was used for implementation and validation.
Exact-head proof receipt
Captured native before/after readback
{ "before": { "status": "PASS", "phase": "red", "head": "9e85a1a71795dd067c424923c4e187ab332852dd", "buildCommit": "9e85a1a71795dd067c424923c4e187ab332852dd", "node": "v24.22.1", "capturedAt": "2026-11-16T02:17:29.453Z", "driverSha256": "8feb95783aa643cfa32af2a95bde42999b27d2ea61bb4a810aa65f4e801cebce", "observations": [ { "args": [ "skills", "list", "--agent", " \t ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "[openclaw] The CLI command failed.\n[openclaw] For help, run `openclaw doctor`.\n" }, { "args": [ "skills", "list", "--agent", " \t " ], "exit": 1, "stdout": "", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "check", "--agent", " \t ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "[openclaw] The CLI command failed.\n[openclaw] For help, run `openclaw doctor`.\n" }, { "args": [ "skills", "check", "--agent", " \t " ], "exit": 1, "stdout": "", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "info", "synthetic-skill", "--agent", " \t ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "[openclaw] The CLI command failed.\n[openclaw] For help, run `openclaw doctor`.\n" }, { "args": [ "skills", "info", "synthetic-skill", "--agent", " \t " ], "exit": 1, "stdout": "", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "verify", "synthetic-skill", "--agent", " ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "" }, { "args": [ "skills", "--help" ], "exit": 0, "stdout": "\nOpenClaw 2026.11.3 (9e85a1a) — All your chats, one OpenClaw.\n\nUsage: openclaw skills [options] [command]\n\nList and inspect available skills\n\nOptions:\n --agent <id> Target agent workspace (defaults to cwd-inferred, then default\n agent)\n -h, --help Display help for command\n --json Output as JSON (default: false)\n\nCommands:\n check Check which skills are ready, visible, or missing requirements\n info Show detailed information about a skill\n install Install a skill from ClawHub, git, or a local directory\n library Manage authenticated personal and team skill libraries\n list List all available skills\n search Search ClawHub skills\n update Update ClawHub-installed skills in the active or shared managed\n directory\n verify Verify a ClawHub skill with ClawHub\n\nDocs: https://docs.openclaw.ai/cli/skills\n\n", "stderr": "" } ], "configUnchangedByCommands": true, "limitations": "Isolated Linux built-CLI argument refusal and help. No skill installation, registry request, Gateway service, live model, upgrade or cross-OS result is claimed." }, "after": { "status": "PASS", "phase": "green", "head": "e20293d57c5c053801fba0d8b7331b8441cc1839", "buildCommit": "e20293d57c5c053801fba0d8b7331b8441cc1839", "node": "v24.22.1", "capturedAt": "2026-11-16T02:50:24.210Z", "driverSha256": "8feb95783aa643cfa32af2a95bde42999b27d2ea61bb4a810aa65f4e801cebce", "observations": [ { "args": [ "skills", "list", "--agent", " \t ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "list", "--agent", " \t " ], "exit": 1, "stdout": "", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "check", "--agent", " \t ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "check", "--agent", " \t " ], "exit": 1, "stdout": "", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "info", "synthetic-skill", "--agent", " \t ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "info", "synthetic-skill", "--agent", " \t " ], "exit": 1, "stdout": "", "stderr": "--agent must not be blank\n" }, { "args": [ "skills", "verify", "synthetic-skill", "--agent", " ", "--json" ], "exit": 1, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"--agent must not be blank\"\n }\n}\n", "stderr": "" }, { "args": [ "skills", "--help" ], "exit": 0, "stdout": "\nOpenClaw 2026.11.3 (e20293d) — All your chats, one OpenClaw.\n\nUsage: openclaw skills [options] [command]\n\nList and inspect available skills\n\nOptions:\n --agent <id> Target agent workspace (defaults to cwd-inferred, then default\n agent)\n -h, --help Display help for command\n --json Output as JSON (default: false)\n\nCommands:\n check Check which skills are ready, visible, or missing requirements\n info Show detailed information about a skill\n install Install a skill from ClawHub, git, or a local directory\n library Manage authenticated personal and team skill libraries\n list List all available skills\n search Search ClawHub skills\n update Update ClawHub-installed skills in the active or shared managed\n directory\n verify Verify a ClawHub skill with ClawHub\n\nDocs: https://docs.openclaw.ai/cli/skills\n\n", "stderr": "" } ], "configUnchangedByCommands": true, "limitations": "Isolated Linux built-CLI argument refusal and help. No skill installation, registry request, Gateway service, live model, upgrade or cross-OS result is claimed." } }Frozen native driver (synthetic isolated inputs)