Skip to content

fix(plugins): plugins build and validate print only "The CLI command failed." when the entry is not compiled yet - #191979

Closed
yxshee wants to merge 2 commits into
openclaw:mainfrom
yxshee:fix/plugins-build-missing-entry
Closed

yxshee wants to merge 2 commits into
openclaw:mainfrom
yxshee:fix/plugins-build-missing-entry

Conversation

@yxshee

@yxshee yxshee commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: running openclaw plugins build --entry ./dist/index.js or openclaw plugins validate --entry ./dist/index.js before compiling the plugin (the plugin:build script from openclaw plugins init does exactly this after tsc) prints only "The CLI command failed. For help, run openclaw doctor." The author can't tell that the entry file is simply missing. The same generic line hides "package.json not found", "Malformed JSON in package.json", an entry outside the plugin root, and an entry without authoring metadata.

User Impact

User impact: these commands now print the reason, for example plugin entry not found: ./dist/index.js. Exit codes and plugins validate --json output are unchanged.

Why This Change Was Made

The authoring input checks threw plain Error, which the root failure renderer treats as unexpected and replaces with the generic line. They now use the existing throwExpectedCliError helper (and ExpectedCliError with the parse error as cause for malformed JSON). Messages are unchanged. Errors thrown by the plugin's own code while loading still go through the unexpected-error path.

Evidence

Built from main at b018452 on Linux, Node 24.22.2, fresh state directory, in a project created by openclaw plugins init demo (path shortened to <demo>).

Before:

$ openclaw plugins build --root <demo> --entry ./dist/index.js
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.
$ openclaw plugins validate --root <demo> --entry ./dist/index.js
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw doctor`.

After:

$ openclaw plugins build --root <demo> --entry ./dist/index.js
plugin entry not found: ./dist/index.js
$ openclaw plugins validate --root <demo> --entry ./dist/index.js
plugin entry not found: ./dist/index.js
$ openclaw plugins build --root <dir with invalid package.json>
Malformed JSON in <dir>/package.json

All exit 1, as before.

Tests:

  • pnpm test src/cli/plugins-authoring-command.test.ts --maxWorkers=1: 32 passed. plugins-authoring-command.utf8, plugins-authoring-validation and plugins-authoring.process tests also pass.

  • New cases "names the missing entry when build/validate runs before the entry is compiled" check for ExpectedCliError and the formatCliFailureLines output. Both fail on main and pass with the fix.

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

  • Test-line budget: the regression tests add 26 net lines, recorded in config/test-lines-allocations/plugins-build-missing-entry.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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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

Plugin build and validation now display existing input-error diagnostics through the shared expected-error renderer.

Example: Run openclaw plugins build --entry ./dist/index.js before compiling the plugin.

  • Before: The CLI command failed. For help, run openclaw doctor.
  • After: plugin entry not found: ./dist/index.js

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, useful repair with supplied CLI proof and meaningful regression coverage; exact-head CI remains pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The contributor's before/after CLI terminal output exercises the changed authoring checks on Linux with Node 24.22.2 and isolated state, showing specific missing-entry diagnostics for build and validate and a malformed-package diagnostic with exit code 1; inspected linked screenshots belong to the earlier error-rendering PR and supply no additional proof for this change.
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 a generic CLI failure instead of the existing diagnostic identifying their invalid input.
Reason: Restoring documented diagnostics provides clear value through the existing error contract without adding settings, defaults, or APIs.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current-main diagnostic bug with a focused change; the previous allocation finding is resolved, and no new defects were found.

Priority: P2
Reviewed head: c2eae395c1e24690d3eee240ecda108fa1ee9dbe

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin authoring commands read package metadata and load the selected entry, then generate or validate manifests; the root CLI renders thrown failures.

flowchart LR
  A[Plugin author] --> B[Build or validate CLI]
  B --> C[Authoring input checks]
  C --> D[Expected CLI error]
  D --> E[Shared failure renderer]
  E --> F[Specific diagnostic]
Loading

Technical review

Best possible solution:

Use the existing expected-error contract at the authoring input checks, as this PR does.

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

Current-main input checks throw ordinary errors that the shared renderer suppresses; the contributor also records the failing shipped CLI commands, but no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch is the smallest complete fix: classify known input failures at their existing producers, preserve parser causes, and reuse the shared renderer without intercepting plugin execution failures.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 331c1aed9a22.

Provenance checked

  • Plugin authoring input checks keeps the original intent (b17e4ed: The original authoring feature supplied specific diagnostics for invalid package roots, entries, and metadata; the later CLI refactor retained those messages.)
  • Malformed metadata handling keeps the original intent (70c839a: The shared reader protects author-owned metadata and retains parsing causes; this patch preserves those checks and causes while changing presentation classification.)
  • Concise root CLI failures keeps the original intent (fix: make common error messages short and helpful #163381: The merged change makes common errors concise while retaining detailed diagnostics; known authoring input errors fit the existing expected-error path.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Alix-007: Raw commit 70c839a adds src/cli/plugins-authoring-json.ts:13 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 70c839ac6bc8; files: src/cli/plugins-authoring-json.ts)

PR surface

Source +8, Tests +26, Other +2. Total +36 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 13 5 +8
Tests 1 26 0 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 41 5 +36

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Generic failures obscure actionable diagnostics in an advanced plugin-authoring workflow with limited blast radius.
  • 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:02:40.996Z sha 1c108f2aad4b4cc8ee973f1af6e5edac11ef6814 :: needs changes before merge. :: [P3] Allocate the added regression-test lines

Reviewed November 3, 2026, 1:24 PM ET / 18:24 UTC (Revision 2).

@yxshee
yxshee force-pushed the fix/plugins-build-missing-entry branch from 1c108f2 to c2eae39 Compare November 3, 2026 18:16
@yxshee

yxshee commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 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. 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 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