Skip to content

fix(plugins): invalid feature ids leave directories and block retries - #193100

Merged
obviyus merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/cli-boundary-c
Nov 5, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/cli-boundary-c

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

plugins init Invalid_ID --type feature creates a partial target directory before rejecting the feature ID. Correcting the ID and retrying in that same directory then fails with “Refusing to overwrite existing path.” The initial rejection also hides the existing ID requirements behind a generic CLI error.

User Impact

Rejected feature IDs leave the target untouched and display the existing validator error. Plugin authors can correct the ID and retry immediately. This also preserves existing entries and marker bytes when the invalid attempt uses --force. Accepted tool, provider and feature scaffolds are unchanged.

Why This Change Was Made

Keep the existing feature validator in the feature writer, and create its source directory only after validation succeeds. The command's earlier mkdir remains for tool/provider scaffolds only. Route the existing feature error through throwExpectedCliError; no new validation rule, message, API or configuration.

Original fix by @zhangguiping-xydt; original commit retained. Consolidated the regression and neighboring metadata coverage to net -2 test lines, with no allocation file. Necessary production growth is +4 lines (8 gross changed lines).

Evidence

Final-head built Linux CLI proof, main 658e3db2a464336f399704c201dda521ed4fac33 versus candidate 163e683b8610c90edeb6b2349bd782a997f06147, once each in isolated Node 24.22.1 Docker:

  • Main leaves src after the invalid ID and blocks the corrected retry. Candidate creates nothing, shows the existing ID requirements, and the corrected retry succeeds.
  • Invalid --force attempt leaves candidate directory entries and marker bytes unchanged.
  • Accepted feature, tool and provider scaffolds all succeed, with identical recursive file inventories and generated-file hashes across refs.
  • Consolidated regression fails on main at the leftover-directory assertion. Candidate: 34 tests across the two focused files pass; changed-file lint and formatting pass. Setup corrections are disclosed in the evidence.

Merge Danger

Two-way door: a revert restores the earlier behavior; no migration or persisted contract changes. Blast radius is feature scaffold rejection and directory creation ordering. Valid scaffold contents, overwrite policy, tool/provider generation and credential handling are unchanged.

@clawsweeper

clawsweeper Bot commented Nov 5, 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 docs Improvements or additions to documentation cli CLI command changes size: XS labels Nov 5, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Validate feature plugin IDs before creating directories and display the existing validation error through the CLI error handler.

Example: Run plugins init Invalid_ID --type feature --directory ./draft-plugin, then retry with valid-feature.

  • Before: The rejected attempt leaves src behind, and the corrected retry refuses to overwrite the directory.
  • After: The rejected attempt leaves the target absent, explains the ID requirements, and the corrected retry succeeds.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused owner-level repair with exact-head shipped CLI evidence, a demonstrated red-to-green regression, and no actionable findings; broad CI remains pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The final-head built CLI trace exercises invalid feature rejection and corrected retry in isolated Linux Docker, confirms existing entries and marker bytes survive invalid --force input, and compares valid feature/tool/provider outputs across refs; inspected historical UI screenshots are unrelated to this repair.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A rejected feature ID leaves a partial directory that blocks a corrected retry and hides the actionable validation message.
Reason: The patch restores rejection without writes while preserving accepted inputs, generated contents, overwrite policy, and existing validation rules.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current plugin-authoring bug with a focused change and no actionable findings.

Priority: P2
Reviewed head: 163e683b8610c90edeb6b2349bd782a997f06147

Before merge

None.

Findings

None.

Agent review details

How this fits together

The plugins init command resolves scaffold options and delegates feature generation to the feature writer, which validates the ID and writes project files.

flowchart TD
  A[Plugin author] --> B[plugins init]
  B --> C[Resolve options and overwrite policy]
  C --> D[Feature writer validates ID]
  D --> E[Expected CLI error]
  D --> F[Create directory and scaffold files]
Loading

Technical review

Best possible solution:

Keep validation in the feature writer, create its directory only after acceptance, and reuse the existing CLI error renderer.

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

Current-main source establishes the mkdir-before-validation failure, corroborated by the supplied built-CLI reproduction; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete repair using existing owners: preserve the validator, move the feature mkdir behind it, and classify its existing error for normal CLI presentation.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Feature ID validation keeps the original intent (6a97159: The feature-plugin scaffold introduced a restricted ID format for generated feature identifiers; this PR preserves that format and message.)
  • Directory creation before scaffold dispatch changes intended behavior with a stated reason (3144172: The localization refactor carried forward shared directory creation while preserving generated scaffolds; this PR explicitly corrects its interaction with feature validation.)
  • Expected CLI input-error presentation keeps the original intent (8ae07c5: Existing plugin authoring guards use ExpectedCliError so the root renderer displays their specific reasons without debug output.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +4, Tests -2, Docs +2. Total +4 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 6 2 +4
Tests 1 18 20 -2
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 27 23 +4

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +6/-2; tests +18/-20 Four net production lines preserve validation ownership and specific errors; consolidated existing coverage offsets the focused regression.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Invalid feature IDs block a plugin author's corrected retry in the same directory, 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 (2 earlier review cycles)
  • reviewed 2026-11-05T01:22:14.341Z sha a79fa5e :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-05T01:34:03.350Z sha a79fa5e :: needs maintainer review before merge. :: none

Reviewed November 4, 2026, 9:21 PM ET / November 5, 2026, 02:21 UTC (Revision 3).

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 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. 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 rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
@obviyus

obviyus commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Built Linux CLI proof on the final head

Candidate: 163e683b8610c90edeb6b2349bd782a997f06147. Pinned main: 658e3db2a464336f399704c201dda521ed4fac33. Original fix by @zhangguiping-xydt, commit a79fa5e6207d73bffc1fc374971b4047afedbeed, retained.

Ran main once and candidate once through their built dist/entry.js in secretless Node 24.22.1 Linux Docker. Explicit isolated profiles/config/state were resolved by each actual binary, including its session DB path. No host product code, live configuration or provider credentials were used.

plugins init Invalid_ID --type feature --directory <new-target>
main: exit 1; generic "The CLI command failed"; target exists with [src]
candidate: exit 1; target absent; prints:
Feature plugin ids must start with a lowercase letter and contain lowercase letters, digits, or hyphens.

plugins init valid-feature --type feature --directory <same-target>
main: exit 1; Refusing to overwrite existing path
candidate: exit 0; Created <same-target>

Controls on both refs:

  • Invalid feature ID with --force against an existing directory: marker bytes are unchanged on both. Main adds src; candidate leaves the entry list exactly [keep.txt], with no extra directory or file, and shows the existing validator message.
  • Accepted feature, tool and provider IDs: all exit 0. Recursive file inventories and SHA-256 hashes are identical between main and candidate for every generated file, without content normalization.

Focused regression: on pinned main, the consolidated case fails specifically at expect(fs.existsSync(projectDir)).toBe(false) (received true; one failure, 30 skipped). On the candidate, both selected files pass: 34 tests, including all authoring cases and tool/provider/feature compilation controls. Runner 9.96 seconds. Changed-file formatting and lint pass on the final source.

The allocation file is removed. Test delta +18/-20 = -2: kept the invalid-ID/corrected-retry regression; moved the standalone append-entry example into its existing table and moved package-name/setupEntry preservation into the real build/install test. No assertion contract was dropped. Production +6/-2 = +4 (8 gross changed lines); docs +3/-1.

Setup corrections disclosed: one proof invocation was queued before the baseline build completed and stopped at missing dist/entry.js; the dependency-ordered invocation above then ran the built product. An initial consolidation fixture set a nonexistent TypeScript setup entry and was correctly refused by package installation; the fixture now uses an existing compiled entry, after which all 34 tests passed. Neither setup failure is counted as product proof.

@obviyus

obviyus commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 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. 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 5, 2026
@obviyus
obviyus merged commit 7510612 into openclaw:main Nov 5, 2026
125 of 127 checks passed
@obviyus

obviyus commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Landed in 7510612. Thanks @zhangguiping-xydt. plugins init no longer leaves a partial directory after a bad feature id.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
…openclaw#193100)

fix(plugins): validate the feature id before plugins init creates files

`openclaw plugins init` for a feature scaffold created directories before running the existing feature-ID check. A bad ID therefore left a partial `src` directory behind, hid the validation error, and blocked a corrected retry. The existing check now runs before the first directory is created, and its existing error is shown. Accepted feature, tool and provider scaffolds and the `--force` marker behavior are unchanged.

Evidence: built Linux CLI. With a bad feature ID, main left `src` behind, hid the error and blocked the corrected retry. With this change nothing is created, the existing error is shown, and the corrected retry succeeds. An invalid `--force` keeps the marker bytes and entries, and accepted scaffold files are byte-identical across refs. Details: openclaw#193100 (comment).

Thanks @zhangguiping-xydt.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 5, 2026
Raise the shared scalar by exactly 93 lines, from 6326473 to 6326566, under explicit maintainer approval for this baseline exception. Do not change tests, allocations, or checker policy.

Main crossed the ceiling at #193101 (+83 against 32 available). Subsequent net debt: #193100 -2, #187104 +17 beyond its allocation, #128175 +25, #193123 -5, #188344 +8, and #193162 -1. The resulting inherited debt is exactly 93 lines; #192587 adds 73 lines with its own matching grant.

At parent 2270152 the canonical LF scanner measured 6479093 test lines against ceiling 6479000. After correction the ceiling equals 6479093 with zero slack. Per-change allocations remain bounded by actual added lines.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
Raise the shared scalar by exactly 93 lines, from 6326473 to 6326566, under explicit maintainer approval for this baseline exception. Do not change tests, allocations, or checker policy.

Main crossed the ceiling at openclaw#193101 (+83 against 32 available). Subsequent net debt: openclaw#193100 -2, openclaw#187104 +17 beyond its allocation, openclaw#128175 +25, openclaw#193123 -5, openclaw#188344 +8, and openclaw#193162 -1. The resulting inherited debt is exactly 93 lines; openclaw#192587 adds 73 lines with its own matching grant.

At parent 21ac250 the canonical LF scanner measured 6479093 test lines against ceiling 6479000. After correction the ceiling equals 6479093 with zero slack. Per-change allocations remain bounded by actual added lines.
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