Repository navigation
fix(plugins): uninstall fully removes isolated npm plugin files - #123973
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 14, 2026, 11:59 PM ET / August 15, 2026, 03:59 UTC. ClawSweeper reviewWhat this changesThe PR changes npm-managed plugin uninstall so a validated isolated per-plugin npm project, including its package artifacts and dependencies, is removed as one lifecycle-owned unit. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-authored PR open: it fixes the reported isolated-project leak, but the new recursive root target is not restricted to a canonical OpenClaw project root. Priority: P2 Review scores
Verification
How this fits togetherPlugin installation creates isolated npm project roots below OpenClaw state, and the management service uses the uninstall planner for ordinary removal and persistence-failure compensation. The planner selects a filesystem target, then npm cleanup and directory removal remove package artifacts before the plugin registry refreshes. flowchart LR
A[Plugin install record] --> B[Uninstall planner]
B --> C{Owned isolated project?}
C -->|yes| D[Remove project root]
C -->|no| E[Remove package directory only]
D --> F[Registry refresh]
E --> F
Before merge
Findings
Agent review detailsSecurityNeeds attention: The widened recursive deletion target lacks a complete ownership check. PR surfaceSource +9, Tests +60, Other +8. Total +77 across 6 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Require the selected root to equal the canonical ordinary project directory for the package or a package-prefixed generation root, then prove a noncanonical sibling remains untouched. Do we have a high-confidence way to reproduce the issue? Yes, from source: a record at npm/projects/<noncanonical>/node_modules/<package> passes the final-head leaf check and selects <noncanonical> for recursive removal. Is this the best way to solve the issue? No; project-root cleanup is the right boundary for canonical isolated projects, but the current guard proves only package-leaf shape rather than OpenClaw ownership of that root. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 103e1a4cc9de. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Ordinary uninstall now removes the whole owner-managed per-plugin npm project, including packed archives and transitive dependency debris, while shared roots and retained update generations keep their existing lifecycle behavior.
Allow persistence-failure compensation to remove only a planner-validated isolated npm project root, while continuing to reject shared or ambiguous cleanup targets.
78ec8a8 to
c5b6291
Compare
|
Addressed the actionable ClawSweeper finding on final head Failed-install compensation now accepts the wider cleanup target only when the real uninstall plan identifies npm cleanup, the planned target exactly equals that cleanup's npm root, and the newly installed package directory is contained within it. Shared and ambiguous targets remain refused. The new regression uses the real planner, injects a persistence conflict after an npm install, and proves the isolated project root plus cached pack archive are removed. Final proof: 126 focused tests, full six-file changed gate, source-absent packed Docker plugin lifecycle with |
|
Merged via squash.
|
…claw#123973) * fix(plugins): remove isolated npm projects on uninstall Ordinary uninstall now removes the whole owner-managed per-plugin npm project, including packed archives and transitive dependency debris, while shared roots and retained update generations keep their existing lifecycle behavior. * fix(plugins): preserve failed install cleanup Allow persistence-failure compensation to remove only a planner-validated isolated npm project root, while continuing to reject shared or ambiguous cleanup targets.
) * fix(plugins): remove isolated npm projects on uninstall Ordinary uninstall now removes the whole owner-managed per-plugin npm project, including packed archives and transitive dependency debris, while shared roots and retained update generations keep their existing lifecycle behavior. * fix(plugins): preserve failed install cleanup Allow persistence-failure compensation to remove only a planner-validated isolated npm project root, while continuing to reject shared or ambiguous cleanup targets. (cherry picked from commit d6e6d67)
Closes #123972
What Problem This Solves
Fixes an issue where users who normally uninstalled an npm-managed plugin would still have its isolated OpenClaw npm project left on disk, including cached pack archives, package metadata, and transitive dependency debris.
Why This Change Was Made
The uninstall owner now treats an exactly validated per-plugin npm project as the removal target, while shared legacy npm roots continue to remove only the selected package. The package-path equality check prevents ambiguous or nested records from widening deletion, and replaced npm generations continue to retain the original package path for running-process safety.
This is the canonical lifecycle-owner cleanup: no fallback, compatibility shim, config key, public API/Plugin SDK surface, protocol, dependency, security boundary, persistence contract, or schema changes.
Failed-install compensation consumes the same uninstall plan. When persistence fails after an npm install, it now accepts the wider project target only when the planner identifies npm cleanup, the target exactly equals that cleanup's npm root, and the newly installed package is contained within it. Shared or ambiguous targets remain refused.
User Impact
Ordinary plugin uninstall now removes all OpenClaw-owned files for that isolated npm plugin project. Shared roots remain intact, and
--keep-filesplus retained update generations keep their existing behavior.Evidence
Before the fix, the focused regression failed because the per-plugin project root still existed after uninstall.
node scripts/run-vitest.mjs src/plugins/management-service.test.ts src/plugins/management-service.install-compensation.test.ts src/plugins/uninstall.test.ts src/plugins/install-record-commit.test.ts src/plugins/install-record-commit.retention.test.ts— 126 tests passed, including a real-planner persistence-conflict regression that removes the isolated project and cached pack archive.node_modules/.bin/oxfmt --check --no-error-on-unmatched-pattern -- scripts/e2e/lib/plugins/assertions.mjs src/plugins/install-record-commit.ts src/plugins/management-service.install-compensation.test.ts src/plugins/management-service.ts src/plugins/uninstall.test.ts src/plugins/uninstall.tsandgit diff --check origin/main...HEAD— passed.node scripts/check-changed.mjs -- scripts/e2e/lib/plugins/assertions.mjs src/plugins/install-record-commit.ts src/plugins/management-service.install-compensation.test.ts src/plugins/management-service.ts src/plugins/uninstall.test.ts src/plugins/uninstall.ts— full changed gate passed. Theci-fastremote route had no ready provider, so the wrapper used its explicit trusted local fallback.OPENCLAW_PLUGINS_E2E_CLAWHUB=0 pnpm test:docker:plugins— passed against the exact rebased commit. The lane built and validated the OpenClaw tarball, installed it source-absent in Docker withnpm install --omit=dev, exercised plugin install/runtime/update/keep-files/reinstall, and proved ordinary uninstall removes the isolated project root and dependency debris..agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main— TruffleHog clean; one complete Codex pass over the final six-file branch; no accepted/actionable findings.ClawSweeper's P2 failed-install compensation finding was accepted and repaired. Its rank-up moves are applied: compensation recognizes only the validated isolated npm target, and the new regression uses the real planner and proves the project root is removed.
Production LOC: +19/-10 (net +9). The bounded growth is the exact package-path ownership guard plus the compensation check that preserves cleanup only for the planner-validated isolated npm root.
Tests and E2E support: +69/-1 (net +68).
No
CHANGELOG.mdedit. AI-assisted and maintainer-approved for landing.