Skip to content

fix(plugins): prevent ambiguous uninstall targets - #117406

Merged
steipete merged 1 commit into
mainfrom
codex/qa400-plugin-uninstall-canonical-target
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa400-plugin-uninstall-canonical-target

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users uninstalling a plugin by its exact ID could silently remove a different plugin when an earlier plugin used that ID as its display name. Duplicate display names or package, marketplace, and ClawHub aliases could likewise select and remove the first matching plugin without warning.

Why This Change Was Made

The canonical uninstall selector now prioritizes authoritative plugin IDs from the registry, installed-plugin index, stale configuration entries, allow/deny lists, and memory/context-engine slots before considering aliases. It deduplicates all aliases by owner and returns an actionable failure for ambiguous matches; the sole uninstall caller stops before planning or mutation. Existing unique aliases, force/confirmation lease ordering, stale-reference cleanup, hooks, and ClawHub compatibility remain intact.

User Impact

An exact plugin ID always targets that plugin, regardless of colliding display names. Ambiguous uninstall requests explain which IDs matched and make no configuration, installed-index, channel, or filesystem changes.

Evidence

  • Genuine Commander RED: plugins uninstall calendar --force --keep-files planned unrelated-plugin instead of calendar; a duplicate display-name request incorrectly succeeded.
  • Genuine Commander GREEN: node scripts/run-vitest.mjs src/cli/plugins-cli.uninstall.test.ts — 14/14 passed; collision and ambiguity regressions prove correct targeting and zero plan/prompt/config/index/files/refresh side effects.
  • Canonical selector GREEN: node scripts/run-vitest.mjs src/cli/plugins-uninstall-selection.test.ts — 13/13 passed, covering exact IDs, installed records, stale entries, allow/deny lists, slots, display/npm/ClawHub ambiguity, same-owner alias deduplication, and existing ClawHub aliases.
  • Hosted-rule type-aware lint: actual installed oxlint with --type-aware --config .oxlintrc.json --tsconfig config/tsconfig/oxlint.core.json --report-unused-disable-directives-severity error on all four files exited 0 with no findings. The repository wrapper separately encounters an unrelated, unchanged-main boundary-DTS preflight packages/terminal-core/src/ansi.ts:194 TS2554 caused by stale hoisted string-width declarations; it is not reported as green.
  • Independent review: five hostile source reviews clean; genuine gpt-5.6-sol / high / P3 autoreview, TruffleHog 3.96 clean, zero findings, confidence 0.97. Immutable head: e0fcb85f51cbcf6b519d9a14a32d45907073e270.

Authentic configured CLI proof — frozen head e0fcb85f51cbcf6b519d9a14a32d45907073e270

Executed on hosted Blacksmith Testbox tbx_01kyys40m1dtrpvkj25sdsxkya after a successful full production pnpm build; all commands used the actual built CLI and isolated real plugin manifests, config, linked files, and discovered shared SQLite state.

  1. Real pnpm openclaw plugins install --link ... --force installed unrelated-plugin with display name calendar, followed by the actual plugin ID calendar. Real pnpm openclaw plugins uninstall calendar --force removed only plugin calendar and its config/install record; subsequent actual pnpm openclaw plugins list --json retained unrelated-plugin. Linked plugin file-tree hash remained 26ab4c610a54f7150ff86e3d4b26cf85f85b9c7cbb539c2789578c3e8c7ad27f.
  2. Installed real plugins calendar-one and calendar-two, both with display name calendar. Real pnpm openclaw plugins uninstall calendar failed with exit 1: Plugin uninstall target "calendar" is ambiguous; matches: calendar-one, calendar-two. Use an exact plugin id. Both actual plugin IDs remained. Before and after hashes were byte-identical:
    • config: 94338a428d77ba6e7ebfbfd9a7121f4cc4c82455346ec8d45433dd47cc885c71
    • SQLite installed_plugin_index: 2852636a4a5c9fc4627f9682622a450a15d31c3d6568260a5ac5d4dc78daa493
    • both linked plugin file trees: 5d203c2bb4e0e27e89a27b953822eec51042f02c82c5c0e7fec79c3cafff964f

Final authenticated hosted result: RESULT AUTHENTIC CONFIGURED CLI PROOF PASS, CLI_PROOF_EXIT 0; Blacksmith timing commandMs=17967, totalMs=18003, exitCode=0. Proof script SHA-256 602ff195c54e2ec36cbe1bf25028a589f9c39869e1e273888a042002274d1861; proof log SHA-256 e9cbb9a23b113a3425c9e710b270d62dc6015b950b13b8fdc330c0941552acb4.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 12:52
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 10:17 AM ET / 14:17 UTC.

ClawSweeper review

What this changes

The PR changes plugin uninstall so exact canonical IDs take precedence over aliases and ambiguous aliases return an actionable error before any plugin mutation occurs.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This is a correct, narrowly scoped repair for a real uninstall-selection defect. The PR includes strong head-pinned built-CLI proof and regression coverage; it stays open for an explicit maintainer decision because ambiguous aliases will intentionally change from unsafe first-match selection to a fail-closed exact-ID requirement.

Priority: P2
Reviewed head: e0fcb85f51cbcf6b519d9a14a32d45907073e270
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong built-CLI proof, focused regression coverage, and a narrow canonical owner-boundary repair support a high-quality patch; only explicit compatibility acceptance remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body contains head-pinned hosted built-CLI proof of correct exact-ID removal and ambiguity rejection with unchanged configuration, SQLite index, and linked files.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body contains head-pinned hosted built-CLI proof of correct exact-ID removal and ambiguity rejection with unchanged configuration, SQLite index, and linked files.
Evidence reviewed 7 items Current-main defect: Current main selects the first registry record whose ID or display name matches, so an earlier display-name collision can win over a later exact plugin ID.
Canonical selection repair: The PR checks exact registry IDs and canonical config keys before aggregating aliases; multiple owners return a sorted actionable ambiguity error.
Mutation boundary: The selector’s only production caller exits before it constructs an uninstall plan when target selection reports an error.
Findings None None.
Security None None.

How this fits together

OpenClaw’s plugin CLI converts an operator’s uninstall argument into a canonical plugin ID, then passes that ID to the uninstall planner and mutation flow. The changed selector runs before planning, confirmation, configuration writes, installed-index updates, registry refresh, and file removal.

flowchart LR
  A[Uninstall argument] --> B[Plugin CLI]
  B --> C[Canonical target selection]
  C --> D{Exact or unique match?}
  D -->|Yes| E[Uninstall planner]
  D -->|No| F[Actionable no-mutation error]
  E --> G[Config index registry and files]
Loading

Decision needed

Question Recommendation
Should OpenClaw adopt the safer compatibility rule that ambiguous uninstall aliases fail with an exact-ID instruction rather than continue first-match removal? Adopt fail-closed selection: Merge the PR so exact plugin IDs are authoritative and any ambiguous alias exits without mutation.

Why: The patch and hosted CLI proof support the repair, but existing automation using an ambiguous alias will intentionally stop rather than silently select one plugin.

Before merge

  • Resolve merge risk (P1) - Ambiguous alias invocations that previously selected the first matching plugin will now exit safely and require an exact plugin ID; this avoids destructive targeting but can interrupt scripts that relied on an alias.
Agent review details

Security

None.

PR surface

Source +30, Tests +208. Total +238 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 40 10 +30
Tests 2 212 4 +208
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 252 14 +238

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Merge with the fail-closed compatibility change (recommended)
    Accept exact plugin IDs as authoritative and require an exact ID when an alias identifies multiple installed plugins.
  2. Pause for legacy-script policy
    Keep the PR open only if maintainers need a different documented migration path for scripts that intentionally use ambiguous aliases.

Technical review

Best possible solution:

Accept the explicit fail-closed compatibility behavior and land the canonical selector, retaining unique aliases while requiring exact IDs for collisions.

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

Yes, by source and supplied real proof: current main’s first matching display name can override a later exact ID, and the PR body records a built-CLI reproduction and after-fix run on the immutable head. This read-only review did not execute the path locally.

Is this the best way to solve the issue?

Yes, subject to the explicit compatibility decision: resolving canonical IDs before aliases and rejecting multiple alias owners repairs the selector before the sole planner and mutation caller.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a172857acc75.

Labels

Label justifications:

  • P2: This corrects a bounded but potentially destructive plugin-management CLI defect.
  • merge-risk: 🚨 compatibility: Ambiguous alias invocations that formerly selected a first match will now exit safely and require an exact ID.
  • 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. Sufficient (terminal): The PR body contains head-pinned hosted built-CLI proof of correct exact-ID removal and ambiguity rejection with unchanged configuration, SQLite index, and linked files.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains head-pinned hosted built-CLI proof of correct exact-ID removal and ambiguity rejection with unchanged configuration, SQLite index, and linked files.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Blame assigns the current selector to his recent refactor commit, and he authored this focused follow-up. (role: current selector-path author and recent area contributor; confidence: high; commits: edfeec49e7a7, e0fcb85f51cb; files: src/cli/plugins-uninstall-selection.ts, src/cli/plugins-uninstall-command.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-01T13:27:27.619Z sha e0fcb85 :: needs real behavior proof before merge. :: none

@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision: accept fail-closed handling of ambiguous uninstall aliases. Exact plugin IDs remain authoritative, and requiring an exact ID for ambiguous aliases intentionally prevents destructive first-match removal; the head-pinned built-CLI proof verifies zero config, SQLite-index, or file mutations on ambiguity.

@steipete
steipete merged commit 40cc08e into main Aug 1, 2026
201 of 217 checks passed
@steipete
steipete deleted the codex/qa400-plugin-uninstall-canonical-target branch August 1, 2026 14:38
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

wingwkyuen pushed a commit to tcgoidc/openclaw that referenced this pull request Aug 1, 2026
…up-ownership-20260801

* origin/main:
  fix(gateway): trim audit.list exact-match filter ids (openclaw#110847)
  fix: harden plugin import-boundary guards and remove dead scanner (openclaw#117386)
  fix(ci): keep PTY tests observable and wait for completed turns (openclaw#117405)
  fix(plugins): resolve marketplace aliases without recursive cycles (openclaw#117440)
  fix: break command recovery import cycle (openclaw#116947)
  fix: clear offscreen command recovery
  fix: fence command recovery ownership
  fix: scope failed command recovery
  fix(plugins): fail closed on ambiguous uninstall targets (openclaw#117406)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
…up-ownership-20260801

* origin/main:
  fix(gateway): trim audit.list exact-match filter ids (openclaw#110847)
  fix: harden plugin import-boundary guards and remove dead scanner (openclaw#117386)
  fix(ci): keep PTY tests observable and wait for completed turns (openclaw#117405)
  fix(plugins): resolve marketplace aliases without recursive cycles (openclaw#117440)
  fix: break command recovery import cycle (openclaw#116947)
  fix: clear offscreen command recovery
  fix: fence command recovery ownership
  fix: scope failed command recovery
  fix(plugins): fail closed on ambiguous uninstall targets (openclaw#117406)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: M 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.

1 participant