Skip to content

fix(plugins): plugins init prints only "The CLI command failed." for an existing directory, unknown --type, or blank id - #191986

Closed
yxshee wants to merge 2 commits into
openclaw:mainfrom
yxshee:fix/plugins-init-reason
Closed

yxshee wants to merge 2 commits into
openclaw:mainfrom
yxshee:fix/plugins-init-reason

Conversation

@yxshee

@yxshee yxshee commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: openclaw plugins init prints only "The CLI command failed. For help, run openclaw doctor." when the target directory already exists, when --type isn't one of tool/provider/feature, or when the id or --name is blank. These are the most likely mistakes when starting a plugin, and none of them is a broken install.

User Impact

User impact: the command now prints the reason, for example Refusing to overwrite existing path: <dir> or Unsupported plugin scaffold type "bogus". Supported types: tool, provider, feature. Exit code is unchanged and nothing is written.

Why This Change Was Made

The three input checks threw plain Error, which the root failure renderer replaces with the generic line. They now use the existing throwExpectedCliError helper. Messages are unchanged.

Evidence

Built from main at b018452 on Linux, Node 24.22.2, fresh state directory (paths shortened).

Before:

$ openclaw plugins init demo --directory <existing dir>
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
$ openclaw plugins init demo --type bogus
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
$ openclaw plugins init ' '
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.

After:

$ openclaw plugins init demo --directory <existing dir>
Refusing to overwrite existing path: <existing dir>
$ openclaw plugins init demo --type bogus
Unsupported plugin scaffold type "bogus". Supported types: tool, provider, feature.
$ openclaw plugins init ' '
Plugin id is required.

All exit 1, as before.

Tests:

  • pnpm test src/cli/plugins-authoring-command.test.ts --maxWorkers=1: 31 passed.

  • New test "explains rejected init input instead of failing generically" covers the three cases, checks for ExpectedCliError and the formatCliFailureLines output, and checks nothing was written. It fails on main and passes with the fix.

  • oxfmt --check and oxlint --type-aware on both files: clean.

  • Test-line budget: the regression tests add 34 net lines, recorded in config/test-lines-allocations/plugins-init-reason.txt. Rebased on current main.

@clawsweeper

clawsweeper Bot commented Nov 3, 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 3, 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes plugin initialization display specific input-rejection reasons instead of a generic CLI failure.

Example: Run openclaw plugins init demo --type bogus.

  • Before: The CLI reports a generic failure and suggests running Doctor.
  • After: It reports Unsupported plugin scaffold type "bogus". Supported types: tool, provider, feature. and exits with status 1.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal producer-side correction, relevant regression coverage, and shipped-CLI before/after evidence support merging.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Supplied built-CLI terminal traces exercise initialization validation on Linux with Node 24.22.2 and fresh state, showing specific diagnostics for all three changed rejection sites and unchanged exit status 1.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Plugin authors receive an unrelated Doctor suggestion instead of the reason their initialization arguments were rejected.
Reason: Specific diagnostics restore understandable rejection behavior through an established CLI contract without changing defaults or adding options.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still hides these input errors, and this PR provides a focused, proven fix with no actionable findings.

Priority: P2
Reviewed head: f14fbe1af2233a0b1c2d47698ebd13a7d1c826c5

Before merge

None.

Findings

None.

Agent review details

How this fits together

The plugin-authoring CLI validates initialization arguments before creating scaffold files; rejected inputs propagate to the shared root failure renderer.

flowchart LR
A[Plugin init command] --> B[Authoring validation]
B --> C[Expected CLI error]
C --> D[Root failure renderer]
D --> E[Specific diagnostic and exit 1]
B --> F[Valid scaffold creation]
Loading

Technical review

Best possible solution:

Use the existing expected-error helper at the validation producers while preserving accepted inputs, overwrite protection, scaffold output, and exit codes.

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

Current-main validation, command registration, and root-renderer source establish the failure path, corroborated by the contributor's built-CLI traces; no target code was executed during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete fix: classify expected input failures at their existing producer and reuse the shared renderer without adding policy or another output path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 352e51e78c69.

Provenance checked

  • Required plugin text validation keeps the original intent (808c227: Provider scaffolding added nonblank id and display-name validation; ae602ac consolidated the equivalent checks.)
  • Scaffold type and overwrite rejection changes intended behavior with a stated reason (3144172: The refactor moved existing single-consumer validation into initialization while preserving its checks and messages; this PR explains why those existing messages should reach users through the expected-error contract.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

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

View PR surface stats
Area Files Added Removed Net
Source 1 4 3 +1
Tests 1 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 3 40 3 +37

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Misleading diagnostics impede plugin authors, with limited impact and unchanged command safety.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-03T15:06:59.174Z sha 6083c13f76cb526051a7658e572c301262c7eee1 :: needs maintainer review before merge. :: none

Reviewed November 4, 2026, 9:40 AM ET / 14:40 UTC (Revision 2).

@yxshee
yxshee force-pushed the fix/plugins-init-reason branch from 6083c13 to f14fbe1 Compare November 3, 2026 18:16
@yxshee

yxshee commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 4, 2026
obviyus added a commit that referenced this pull request Nov 4, 2026
fix(plugins): show existing errors from plugin init, build and validate

`openclaw plugins init`, `build` and `validate` threw plain errors for their existing guards (for example init into a non-empty directory, or an invalid or missing manifest), so the specific message was hidden behind a generic failure. They now use the existing expected-CLI-error path, so the existing message is shown. Messages, exit codes and the no-write behavior are unchanged; successful runs are unchanged.

Sweep of #191979 and #191986; both contributor commits are kept. #191991 (pack) is related but not included, because it adds new wording.

Evidence: built CLI, twice per ref. All 26 rejected commands kept exit 1 and left the project unchanged; main printed generic errors and this change prints the existing specific messages. Successful init, build and validate output is identical. Details: #192857.

Thanks @yxshee.

Co-authored-by: yxshee <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks @yxshee. Your commit landed as part of sweep #192857 (8ae07c5), together with the related plugin CLI error fix. Closing this one as included.

@obviyus obviyus closed this Nov 4, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
fix(plugins): show existing errors from plugin init, build and validate

`openclaw plugins init`, `build` and `validate` threw plain errors for their existing guards (for example init into a non-empty directory, or an invalid or missing manifest), so the specific message was hidden behind a generic failure. They now use the existing expected-CLI-error path, so the existing message is shown. Messages, exit codes and the no-write behavior are unchanged; successful runs are unchanged.

Sweep of openclaw#191979 and openclaw#191986; both contributor commits are kept. openclaw#191991 (pack) is related but not included, because it adds new wording.

Evidence: built CLI, twice per ref. All 26 rejected commands kept exit 1 and left the project unchanged; main printed generic errors and this change prints the existing specific messages. Successful init, build and validate output is identical. Details: openclaw#192857.

Thanks @yxshee.

Co-authored-by: yxshee <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants