Repository navigation
fix(cli): exit non-zero when skills info cannot find a skill - #123997
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 12:17 AM ET / 04:17 UTC. ClawSweeper reviewWhat this changesThis PR makes Merge readinessNo blocking correctness or security finding: this is a focused fix for a source-proven CLI contract bug. Keep it open for the maintainer’s land decision after exact-head checks complete. Priority: P2 Review scores
Verification
How this fits togetherThe Skills CLI obtains a workspace status report, resolves a requested skill, writes formatted output, and signals success or failure to shell scripts. This affects local automation that branches on the command’s exit status. flowchart LR
A[CLI arguments] --> B[Skills info command]
B --> C[Workspace status report]
C --> D[Canonical skill lookup]
D --> E[Human or JSON output]
D --> F[Shell exit status]
Decision needed
Why: Repository policy keeps maintainer-authored and Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +36. Total +40 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the focused status fix after exact-head CI passes, retaining the separate canonical lookup because changing the exported string-only formatter contract would broaden the public surface for no functional gain. Do we have a high-confidence way to reproduce the issue? Yes — source-reproducible with high confidence: current main formats a missing skill as output but does not request a non-zero exit. Local execution could not start in the read-only environment because Corepack requires a writable cache. Is this the best way to solve the issue? Yes — the command derives status from the same canonical resolver already used for output, matching the Hooks CLI separation without widening the formatter’s exported string-only contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 622eec9c364f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
110e45d to
506e140
Compare
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where
openclaw skills info <missing>printed a clear not-found result but exited0, so shell conditionals and machine consumers treated a missing skill as present.The human and JSON payloads were already correct; only the process status contradicted them.
Why This Change Was Made
The command action now resolves the requested skill with the same canonical resolver used by the formatter, writes the existing formatter output unchanged, and exits
1when resolution fails. This keeps the exportedformatSkillInfostring contract intact instead of widening it with command-status metadata.The direct structural sibling,
hooks info, follows the same separation: format output first, then derive the command status independently from the report.User Impact
Scripts can safely use
openclaw skills info NAME && ..., and machine consumers can trust a non-zero status for missing skills. Existing skills still exit0. Human text and JSON keys are unchanged.Evidence
Before
Reproduced with the packaged CLI before the patch:
Sibling behavior at the same boundary:
cron show <bogus>approvals resolve <bogus>config get <missing path>agents delete <bogus>hooks info <bogus>skills info <bogus>before this patchhooks info --jsonreturns{ "error": "not found", "hook": NAME }and exits1;skills info --jsonkeeps its parallel{ "error": "not found", "skill": NAME }shape and now also exits1.After: built CLI, isolated state
Built the exact branch, then ran with a fresh
OPENCLAW_STATE_DIRandOPENCLAW_SKIP_CHANNELS=1:skills info nope-not-real --agent mainskills info nope-not-real --agent main --jsonskills info skill-creator --agent mainskills info skill-creator --agent main --jsonhooks info nope-not-real --agent mainhooks info nope-not-real --agent main --jsonconfig get nope.not.real --jsonagents delete nope-not-real --forceThe missing human text and pretty-printed JSON were byte-identical to the baseline payloads. The existing JSON still reported
"name": "skill-creator".Skills surface sweep
listinfochecksearchinstallupdate--all: intentional no-op 0verifystatuspin/unpin/restorelistinspectand mutationsRepo-wide
src/cli/**search found only two formatter-returned top-level{ error: "not found" }payloads: skills and hooks. Hooks was already correct. Other direct JSON error writers checked (config, directory, system, webhooks, node/gateway status, doctor, and database) already exit non-zero.Named follow-up: define
plugins doctorexit semantics when its report hasok: false. Its report mixes hard load errors with warnings, so changing that broader diagnostic contract needs a separate product-policy decision rather than riding this focused not-found fix.Validation
node scripts/run-vitest.mjs src/cli/skills-cli.commands.test.ts src/cli/skills-cli.test.ts src/cli/skills-cli.formatting.test.ts src/cli/hooks-cli.test.ts— 123 passed.node scripts/check-changed.mjs -- src/cli/skills-cli.ts src/cli/skills-cli.commands.test.ts— passed on Blacksmith Testbox (types, lint, formatting, dead-code and boundary guards).pnpm buildon Blacksmith Testbox — passed..agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output— clean; no accepted/actionable findings.AI-assisted: implementation, sweep, and validation were performed with Codex; the behavior and diff were reviewed directly.