Skip to content

fix(plugins): show existing scaffold input errors - #192857

Merged
obviyus merged 3 commits into
mainfrom
fix/plugin-scaffold-expected-errors
Nov 4, 2026
Merged

obviyus merged 3 commits into
mainfrom
fix/plugin-scaffold-expected-errors

Conversation

@obviyus

@obviyus obviyus commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

plugins init, plugins build, and plugins validate hide existing input-error messages behind a generic CLI failure, leaving plugin authors unable to tell what to fix.

User Impact

Authors see the existing specific reason for rejected inputs, including a non-empty target directory, unsupported scaffold type, missing entry/package, or malformed metadata. Message strings, exit code 1, guard order and no-write behavior are unchanged.

Why This Change Was Made

Classify these existing guards through the dependency-free ExpectedCliError owner, following #189993. Preserve the malformed-JSON cause and use the existing root failure renderer rather than adding a second presentation path.

Combines @yxshee's #191979 and #191986, preserving both authored commits. Related #191991 is credited as adjacent work only; no pack change or new wording from that PR is included.

Evidence

Built CLI in secretless Node 24.22.1 Docker: main twice and exact candidate twice. All 13 changed guard cases per iteration hide their reasons on main and print the existing specific messages on candidate. Every rejected command exits 1 and leaves the complete project file/mode/content snapshot unchanged. Success controls scaffold a real plugin, build metadata, and validate it twice on each ref, with identical output and exit 0.

Exact-head CLI before/after matrix and no-write receipts.

62 authoring/UTF-8/validation/failure-output cases pass in 33.70 seconds wrapper time. Existing missing-entry regression now checks the human-output contract and fails on main. Formatting/lint pass; broad checks run in hosted CI.

Complete-diff simplification reuses existing error/guard owners and consolidates duplicate formatter tests into the existing owner regression plus actual CLI proof: production +16/-8 (net +8), tests +1/-1 (net 0), docs +5. No test allocation or shared-ceiling change.

Merge Danger

Two-way door: reverting restores generic error presentation. No state migration, dependency, configuration, permission or public API change. Blast radius is plugin authoring input-error classification; incorrect classification could expose the wrong error detail, but guard strings and write behavior are unchanged.

@clawsweeper

clawsweeper Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Built CLI comparison: main ac9af06ff106f00be2959cd6756dee976c9c984c and exact candidate c8d21e7426e0d4a2e3029ff47341a400c4f44910, secretless Node 24.22.1 Docker, explicit separate profiles and checked private home/config/state/database scopes.

Two independent iterations on each ref, naturally triggering all changed guards:

  • init: existing non-empty directory, unsupported type, blank id, blank display name;
  • build and validate: missing root/package.json, malformed package.json, missing compiled entry, entry outside root;
  • build: entry lacking tool/feature authoring metadata.

All 26 rejected commands per ref exit 1. Main shows the generic CLI failure instead of the existing reason. The candidate shows the exact existing reason, with no generic failure. Recursive file/mode/content snapshots are unchanged for every rejected command; no fresh directory appears after rejected init inputs.

Example, normalized only for isolated path:

main stderr:
[openclaw] The CLI command failed.
[openclaw] For help, run `openclaw --profile p191979base doctor`.

candidate stderr:
Refusing to overwrite existing path: <isolated-project>

Success controls on both refs, twice: scaffold a real tool plugin, build its metadata through the normal module loader, then validate it. All exit 0 with identical stdout/stderr. The fixtures use real generated TypeScript and existing installed dependencies inside the isolated volume, not mocked authoring or output formatting. Initial success setup lacked the generated project's typebox dependency; the dependency link was corrected before the recorded matrix.

62 focused cases across authoring command/UTF-8/validation and root failure-output suites pass (33.70s wrapper). The consolidated existing missing-entry regression fails on main because a plain Error lacks the existing humanOutput contract; it passes on candidate. Changed-file formatting/lint pass.

Both yxshee fixes are cherry-picked with contributor authorship preserved: #191979 (8f5221e1ff12d2db7b60caf0684f7f3b62688961) and #191986 (84dbd5251cf0eb9822c77a61895f2227354d2e99). This uses the #189993 ExpectedCliError precedent. #191991 is adjacent credited work only; its pack changes/new wording are not included.

Whole-diff simplification: reuse ExpectedCliError and the current guard owners, preserve all strings and malformed-JSON cause, remove duplicate formatter-echo tests in favor of the existing owner regression and stronger built-CLI matrix. Production +16/-8 (net +8), tests +1/-1 (net 0), docs +5. No allocation, shared ceiling, validation, exit-code, write-policy, permissions or public API changes.

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: XS labels Nov 4, 2026
@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. clawsweeper:intake:needs-repro 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes plugin initialization, build, and validation display their existing input-error messages.

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 repair with supplied shipped-CLI proof, a meaningful regression, preserved existing contracts, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The inspected exact-head proof comment exercises the built authoring CLI in secretless Node Docker, showing specific reasons for all changed guards, exit 1 and unchanged project snapshots on rejection, plus successful scaffold/build/validate controls on both refs.
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 command failure instead of the existing explanation identifying their invalid input.
Reason: The maintainer-authored direction restores useful diagnostics through an established contract without adding options, defaults, APIs, or validation restrictions.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current-main diagnostic bug with a focused change, sufficient exact-head CLI proof, and no actionable findings; hosted checks remain pending.

Priority: P2
Reviewed head: c8d21e7426e0d4a2e3029ff47341a400c4f44910

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin authoring commands consume project paths, metadata, and entry modules; their existing guards now supply typed errors to the shared root CLI renderer.

flowchart LR
  A[Plugin author] --> B[Authoring CLI]
  B --> C[Existing input guards]
  C --> D[Expected CLI error]
  D --> E[Root failure renderer]
  E --> F[Specific diagnostic]
Loading

Technical review

Best possible solution:

Classify known authoring input failures at their existing producers and reuse the shared CLI renderer, as this PR does.

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

Current-main guards and the root renderer show the failure path, corroborated by supplied before/after built-CLI output; this read-only review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: preserve checks, strings, ordering, and parser causes while using the existing expected-error owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Package, entry, and overwrite guards keeps the original intent (b17e4ed: The original authoring feature supplied specific invalid-input diagnostics; later refactors retained their checks and messages.)
  • Scaffold type and required-text validation keeps the original intent (808c227: Provider scaffolding added supported-type and required-text checks; subsequent consolidation preserved their input contracts.)
  • Malformed metadata diagnostics keeps the original intent (66aa2ed: Identify the malformed metadata file while preserving the parser cause; the later UTF-8 reader extraction retained this behavior.)
  • Concise root CLI error presentation keeps the original intent (fix: make common error messages short and helpful #163381: Common failures should explain what happened and provide useful recovery guidance; typed expected errors preserve known author-facing reasons.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b17e4ed adds src/cli/plugins-authoring-command.ts:77 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b17e4ed50cbf; files: src/cli/plugins-authoring-command.ts)
  • Alix-007: Raw commit 70c839a adds src/cli/plugins-authoring-json.ts:4 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)
  • Patrick Erichsen: Raw commit 808c227 adds src/cli/plugins-authoring-command.ts:373 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 808c227edbf7; files: src/cli/plugins-authoring-command.ts)

PR surface

Source +8, Tests 0, Docs +5. Total +13 across 4 files. Added test files: 0.

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

Review metrics

Metric Value Why it matters
Production versus test delta Production +16/-8; tests +1/-1 The small production growth preserves parser causes using the existing error contract; the regression extends an existing test without new scaffolding.

Labels

Label changes:

  • add P2: Generic failures obscure actionable diagnostics in an advanced plugin-authoring workflow with limited blast radius.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • 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.

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.

Reviewed November 4, 2026, 10:51 AM ET / 15:51 UTC.

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

CI classification on exact head c8d21e7426e0d4a2e3029ff47341a400c4f44910: three independent failing jobs, plus consequential ci-gate failures. No repair or repush is needed for these inherited/external cases.

Comparison uses the actual CI merge 854d004017d947c163d6e931e9d223bb1f4f66ed and its exact main parent cf50d4a36629e53f77ec2e65fc3ea815c41e7d2e, frozen-lockfile installs in secretless Node 24.22.1 Docker, CI=true and GITHUB_ACTIONS=true.

  1. Validate provider scaffold: external registry timeout, not changed scaffolding. Hosted generation and TypeScript compilation succeeded; ClawHub validation then failed downloading the OpenClaw npm archive: “Network request failed: the request timed out. OpenClaw npm archive download timed out”. Replayed the exact pnpm test:plugins:init-provider-scaffold command on CI merge and main parent: both exit 0, complete ClawHub validation and pass the generated provider's test. Independently hashed all eight generated authored files (package/manifest/source/test/tsconfig/Vitest/README/workflow): byte-identical between refs. Dependency/build/validation outputs are excluded from that authored-source comparison. The hosted network timeout was not reproduced locally; successful full-step parity and identical scaffolding rule out this sweep changing its output.

  2. checks-fast-baseline-ratchets: inherited mock-exports failures. The failing subcheck reports profiles-view.test.tsx:23 mocking ../../lib/toast.ts and sessions-page-cloud-stop.test.ts:18 mocking ../../components/confirm-dialog.ts. Replayed its exact failing check-test-mock-exports.mts --base refs/remotes/origin/ci-ratchet-base --no-merge-base command on both refs with the actual main-parent base: both exit 1 with precisely these two cases. Other ratchets passed, including net-zero test lines. No mock in the sweep was added or changed.

  3. check-test-types: inherited TS2322, not the earlier en-terminal error. Failing scripts graph reports ui/src/components/browser/browser-panel-render.tsx(149,11): Type 'string | undefined' is not assignable to type 'string'. Replayed the exact failing scripts typecheck (pnpm tsgo:scripts) on both refs: both exit 2 with this identical location/message. That UI file and the scripts typecheck configuration are unchanged by the merge.

All comparisons use the actual CI merge/main parent, not the older runtime baseline. The merge diff contains only the intended four CLI/test/docs files. No unrelated UI fixes, hosted reruns, or repushes were made. Product CI cancelled jobs: 0. Exact-head ClawSweeper review: 5/6, no findings. The supplied built CLI guard/success matrix remains valid.

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: no red comes from this sweep. (1) Validate provider scaffold failed on a hosted npm archive download timeout; the exact command passes on the CI merge and its main parent, with byte-identical scaffold output. (2) The baseline ratchets (two UI mock-export cases) and (3) check-test-types (browser-panel-render.tsx:149 TS2322) fail identically on the exact main parent. Receipts: #192857 (comment)

@obviyus
obviyus merged commit 8ae07c5 into main Nov 4, 2026
132 of 138 checks passed
@obviyus
obviyus deleted the fix/plugin-scaffold-expected-errors branch November 4, 2026 16:30
@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 8ae07c5. Thanks @yxshee. Plugin init, build and validate now show their existing error messages.

github-actions Bot pushed a commit to jonasbkk1188/openclaw 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: openclaw/openclaw#192857.

Thanks @yxshee.

Co-authored-by: yxshee <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 4, 2026
…en the Gateway is not running (#192943)

fix(plugins): show the existing offline error from plugins reload

When no Gateway was running, `openclaw plugins reload` threw a plain error, so its existing message was hidden behind a generic CLI failure. It now uses the existing expected-CLI-error path and shows the same message. The exit code, config and JSON output are unchanged; there is no lifecycle or consent change. This completes the plugin CLI fixes in #192857.

Evidence: built CLI. Offline, both refs exit 1; main printed the generic failure and this change prints the existing message, with config unchanged and byte-identical JSON stdout. With a running Gateway, reload succeeds the same way on both refs. Details: #192943 (comment).

Thanks @yxshee.

Co-authored-by: Ayaan Zaidi <[email protected]>
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
…en the Gateway is not running (openclaw#192943)

fix(plugins): show the existing offline error from plugins reload

When no Gateway was running, `openclaw plugins reload` threw a plain error, so its existing message was hidden behind a generic CLI failure. It now uses the existing expected-CLI-error path and shows the same message. The exit code, config and JSON output are unchanged; there is no lifecycle or consent change. This completes the plugin CLI fixes in openclaw#192857.

Evidence: built CLI. Offline, both refs exit 1; main printed the generic failure and this change prints the existing message, with config unchanged and byte-identical JSON stdout. With a running Gateway, reload succeeds the same way on both refs. Details: openclaw#192943 (comment).

Thanks @yxshee.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 5, 2026
… it refuses to pack (#191991)

fix(plugins): show existing errors from plugins pack

`openclaw plugins pack` guards threw plain errors, so their existing messages were hidden behind a generic CLI failure. They now use the existing expected-CLI-error path, as #192857 did for init, build and validate. Messages, control flow and exit codes are unchanged; no new wording.

Evidence: built Linux CLI, twice per ref. With a missing plugin manifest or an invalid output suffix, main printed a generic failure; with this change it prints the existing specific message, with exit 1, project bytes unchanged and no output created. Valid packs produce byte-identical 647-byte archives across refs, and existing-output handling is unchanged. Details: #191991 (comment).

Thanks @yxshee.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 5, 2026
…193484)

fix(plugins): show the existing install message when esbuild is missing

When esbuild was not installed, the plugin authoring loader threw a plain error, so `openclaw plugins pack` hid the existing install instruction behind a generic CLI failure. It now uses the existing expected-CLI-error path with the same message and cause, as #192857 and #191991 did. No compiler lookup, build or install policy changes.

Evidence: built Linux CLI with esbuild absent before the first lookup. Main printed a generic failure; with this change it prints the existing install instruction. Both exit 1, create no archive and keep project hashes unchanged. With the compiler installed, pack and Solid compilation produce byte-identical archives, and overwrite and invalid-extension handling are unchanged. Details: #193484 (comment).

Thanks @ly85206559.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
… it refuses to pack (openclaw#191991)

fix(plugins): show existing errors from plugins pack

`openclaw plugins pack` guards threw plain errors, so their existing messages were hidden behind a generic CLI failure. They now use the existing expected-CLI-error path, as openclaw#192857 did for init, build and validate. Messages, control flow and exit codes are unchanged; no new wording.

Evidence: built Linux CLI, twice per ref. With a missing plugin manifest or an invalid output suffix, main printed a generic failure; with this change it prints the existing specific message, with exit 1, project bytes unchanged and no output created. Valid packs produce byte-identical 647-byte archives across refs, and existing-output handling is unchanged. Details: openclaw#191991 (comment).

Thanks @yxshee.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…penclaw#193484)

fix(plugins): show the existing install message when esbuild is missing

When esbuild was not installed, the plugin authoring loader threw a plain error, so `openclaw plugins pack` hid the existing install instruction behind a generic CLI failure. It now uses the existing expected-CLI-error path with the same message and cause, as openclaw#192857 and openclaw#191991 did. No compiler lookup, build or install policy changes.

Evidence: built Linux CLI with esbuild absent before the first lookup. Main printed a generic failure; with this change it prints the existing install instruction. Both exit 1, create no archive and keep project hashes unchanged. With the compiler installed, pack and Solid compilation produce byte-identical archives, and overwrite and invalid-extension handling are unchanged. Details: openclaw#193484 (comment).

Thanks @ly85206559.

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 docs Improvements or additions to documentation 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