Skip to content

fix(plugins): remove stale load paths during uninstall - #118930

Merged
vincentkoc merged 3 commits into
mainfrom
qa-clawhub-marketplace-lifecycle
Aug 3, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
qa-clawhub-marketplace-lifecycle

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where uninstalling a marketplace, npm, or other managed plugin could delete its managed directory but leave an exact matching plugins.load.paths entry behind. The stale config could keep pointing plugin discovery at a path that no longer exists.

Why This Change Was Made

Uninstall already owns the canonical install record, so load-path cleanup now matches that record's installPath for every install source and retains the existing linked-path sourcePath cleanup. Matching is exact or realpath-equivalent only; parent directories, child paths, prefixes, and unrelated operator paths are preserved.

The package-installed marketplace scenario now proves the full lifecycle: v1 install state, non-mutating plugin-ID dry run, persisted v2 update, then uninstall cleanup across config, SQLite index/install records, allow/deny policy, the exact load path, managed files, and CLI registration while unrelated sentinels remain.

User Impact

Operators no longer retain a stale exact load path after uninstalling a managed plugin. Explicit non-exact paths remain untouched.

Maintainer Decision

Accepted: uninstall owns cleanup of an exact or realpath-equivalent load path recorded as the managed plugin's installPath. This is intentional persisted-config behavior; non-exact operator paths remain preserved.

Evidence

  • node scripts/run-vitest.mjs src/plugins/uninstall.test.ts test/scripts/release-plugin-marketplace-lifecycle.test.ts (65 uninstall tests and 4 lifecycle-helper tests passed)
  • node scripts/run-node.mjs qa coverage --match clawhub.update-by-plugin-id (one primary scenario match)
  • node scripts/run-node.mjs qa coverage --match clawhub.uninstall-config-index-policy-file-cleanup (one primary scenario match)
  • bash -n scripts/e2e/lib/release-plugin-marketplace/scenario.sh
  • ./node_modules/.bin/oxfmt --check on all touched formatted files
  • git diff --check
  • Blacksmith Testbox baseline Docker lane passed on pre-fix commit 5d30ff9e5a7 (lease tbx_01kz4mqbxszrpndpm4dym0askf, run https://github.com/openclaw/openclaw/actions/runs/30849990176)
  • Blacksmith Testbox release marketplace Docker E2E passed on runtime head 4af47fffb8527738288d5931556c7ca0f6f326ff (lease tbx_01kz4n7g0s48q81pjx74fsspnc)
  • Blacksmith Testbox private QA suite passed on runtime head 4af47fffb8527738288d5931556c7ca0f6f326ff for clawhub-marketplace-list; schema-v2 evidence recorded one passing entry at .artifacts/qa-e2e/clawhub-marketplace-lifecycle-4af47ff-1785790175/qa-evidence.json
  • Blacksmith Testbox pnpm check:changed passed on runtime head 4af47fffb8527738288d5931556c7ca0f6f326ff, including typecheck, lint, and runtime import-cycle checks
  • Final head 2d46f7cb77d adds only the Knip executable-root declaration and owner-test routing required by the initial ready-for-review CI run
  • Final-head pnpm deadcode:dependencies and pnpm deadcode:unused-files passed with zero entries
  • Final-head focused owner routing, lifecycle-helper, and uninstall tests passed
  • Final-head Sol autoreview passed with no actionable findings; patch correctness confidence 0.99

Production delta: src/plugins/uninstall.ts is +14/-8, net +6 lines.

@vincentkoc vincentkoc self-assigned this Aug 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts extensions: qa-lab size: M maintainer Maintainer-authored PR labels Aug 3, 2026
@vincentkoc vincentkoc changed the title improve(qa): prove marketplace plugin update lifecycle fix(plugins): remove stale load paths during uninstall Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 5:14 PM ET / 21:14 UTC.

ClawSweeper review

What this changes

This PR makes plugin uninstall remove plugins.load.paths entries that exactly resolve to a managed plugin’s recorded install path, with unit, release-marketplace lifecycle, QA-scenario, and CLI-documentation updates.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this draft open for maintainer review. The current uninstall owner removes a linked path install’s recorded sourcePath but leaves the managed installPath for marketplace and npm installs; the patch extends that same owner-boundary cleanup to exact, realpath-equivalent recorded install paths while preserving parent, child, prefix, and unrelated paths. The change is technically coherent, but it intentionally changes persisted plugins.load.paths during upgrades and is labeled maintainer, so it needs explicit maintainer acceptance plus exact-head lifecycle validation before merge.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The runtime patch is small, owner-boundary aligned, and regression-covered, with remaining confidence centered on exact-head lifecycle and upgrade validation.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-authored draft PR, so the external-contributor real-behavior gate does not apply; its exact-head lifecycle validation is still an important merge-readiness check.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored draft PR, so the external-contributor real-behavior gate does not apply; its exact-head lifecycle validation is still an important merge-readiness check.
Evidence reviewed 6 items Current-main behavior: Current main limits plugins.load.paths cleanup to source === "path" records with sourcePath, so marketplace and npm records can retain an exact load path after their managed directory is deleted.
Owner-boundary patch: The PR updates the pure removePluginFromConfig owner to compare every recorded installPath, retaining the linked-path sourcePath comparison and filtering only exact or realpath-equivalent values.
Caller and cleanup sequencing: planPluginUninstall reads the install record before calling removePluginFromConfig, then carries the resulting configuration action into directory-removal planning; this is the correct place to remove a stale path before persistence and file cleanup.
Findings None None.
Security None None.

How this fits together

The plugin installer records where managed plugins live, and plugin discovery later consumes configured load paths. During uninstall, the plugin subsystem removes configuration, index metadata, policy entries, and managed files; this change also removes the exact stale discovery path that points at the deleted managed install.

flowchart LR
  A[Plugin install record] --> B[Uninstall planning]
  C[Plugin configuration] --> B
  B --> D[Exact resolved-path comparison]
  D --> E[Cleaned load-path configuration]
  B --> F[Plugin index and policy cleanup]
  B --> G[Managed directory removal]
  E --> H[Plugin discovery avoids deleted path]
Loading

Decision needed

Question Recommendation
Should OpenClaw accept the intentional upgrade behavior that uninstall removes an operator-configured load path when it exactly resolves to the recorded managed install path? Accept exact-record cleanup: Approve the documented behavior after exact-head lifecycle validation confirms only record-owned exact paths are removed.

Why: The patch is narrowly implemented at the uninstall owner, but it changes persisted configuration for existing managed marketplace and npm installs; the protected maintainer label requires an explicit human decision before merge.

Before merge

  • Resolve merge risk (P1) - Merging changes persisted user configuration during uninstall: any plugins.load.paths value exactly resolving to a recorded managed install path will now be removed. That is the intended stale-path repair, but upgrade semantics need explicit maintainer acceptance and exact-head lifecycle proof.
  • Resolve merge risk (P1) - The PR is still a draft and its body says exact-head Testbox Docker, QA evidence, and changed-gate validation remain pending; the body’s listed focused tests are useful supplemental evidence but do not replace current-head lifecycle confirmation.
  • Complete next step (P2) - The patch has no discrete mechanical defect to dispatch, but the maintainer label and persisted-config compatibility choice require human acceptance before merge.
Agent review details

Security

None.

PR surface

Source +6, Tests +319, Docs +1, Other +277. Total +603 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 1 14 8 +6
Tests 2 319 0 +319
Docs 2 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 3 280 3 +277
Total 8 615 12 +603

Review metrics

Metric Value Why it matters
Uninstall configuration policy 1 changed cleanup rule The uninstall path now removes exact record-owned managed paths for additional install sources, which can alter persisted operator configuration on upgrade.
Production versus test delta production +290/-8, tests +319 Most production growth is bounded QA/lifecycle assertion support; the runtime implementation itself is +14/-8 and needs the stated lifecycle proof.

Stored data model

Persistent data-model change detected: database schema: test/scripts/release-plugin-marketplace-lifecycle.test.ts, serialized state: scripts/e2e/lib/release-plugin-marketplace/lifecycle-assertions.mjs, vector/embedding metadata: qa/scenarios/plugins/clawhub-marketplace-list.yaml. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Validate and accept record-owned path cleanup (recommended)
    Run the exact-head marketplace lifecycle and confirm upgrade behavior removes only exact record-owned paths before marking the draft ready.
  2. Preserve managed install-path entries
    Reject the broader cleanup if maintainers decide explicitly configured managed paths must survive uninstall despite becoming stale.

Technical review

Best possible solution:

Land one canonical uninstall policy: remove only exact resolved paths owned by the saved install record, preserve all non-exact operator paths, and retain focused unit plus current-head marketplace lifecycle proof for install, dry-run, update, and uninstall.

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

Yes, from source: current main removes load paths only for linked path installs, while marketplace and npm install records still carry an installPath that can exactly match a stale load-path entry after managed-file deletion. The included unit scenarios define a focused regression path, but this read-only review did not execute it.

Is this the best way to solve the issue?

Yes, subject to the maintainer compatibility decision. Repairing removePluginFromConfig is the narrow canonical owner because uninstall reads the authoritative install record there before it persists config cleanup and removes managed files; a downstream discovery guard would leave stale state behind.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This fixes stale plugin-discovery configuration after uninstall with a bounded but user-visible compatibility surface.
  • add merge-risk: 🚨 compatibility: The PR deliberately changes how existing plugins.load.paths configuration is removed during uninstall.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored draft PR, so the external-contributor real-behavior gate does not apply; its exact-head lifecycle validation is still an important merge-readiness check.

Label justifications:

  • P2: This fixes stale plugin-discovery configuration after uninstall with a bounded but user-visible compatibility surface.
  • merge-risk: 🚨 compatibility: The PR deliberately changes how existing plugins.load.paths configuration is removed during uninstall.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored draft PR, so the external-contributor real-behavior gate does not apply; its exact-head lifecycle validation is still an important merge-readiness check.

Evidence

What I checked:

  • Current-main behavior: Current main limits plugins.load.paths cleanup to source === "path" records with sourcePath, so marketplace and npm records can retain an exact load path after their managed directory is deleted. (src/plugins/uninstall.ts:440, 5b1b1e063225)
  • Owner-boundary patch: The PR updates the pure removePluginFromConfig owner to compare every recorded installPath, retaining the linked-path sourcePath comparison and filtering only exact or realpath-equivalent values. (src/plugins/uninstall.ts:438, 4af47fffb852)
  • Caller and cleanup sequencing: planPluginUninstall reads the install record before calling removePluginFromConfig, then carries the resulting configuration action into directory-removal planning; this is the correct place to remove a stale path before persistence and file cleanup. (src/plugins/uninstall.ts:539, 5b1b1e063225)
  • Regression coverage: The PR adds table-driven coverage for marketplace and npm install paths, absent paths, and non-exact child/prefix paths, matching the intended boundary. (src/plugins/uninstall.test.ts:393, 4af47fffb852)
  • Real lifecycle scenario: The release marketplace scenario installs v1, verifies dry-run non-mutation, updates to v2, seeds policy/load-path sentinels, uninstalls, and asserts the managed path is removed while the unrelated sentinel remains. (scripts/e2e/lib/release-plugin-marketplace/scenario.sh:79, 4af47fffb852)
  • Feature provenance: git blame ties the current linked-path-only cleanup to the recent current-main commit that introduced it; this PR expands that existing cleanup policy rather than creating a parallel uninstall path. (src/plugins/uninstall.ts:440, 5a65c96fc708)

Likely related people:

  • Peter Steinberger: Git blame attributes the current linked-path-only cleanup block to this recent main-branch commit, making him the strongest history-based routing contact for the uninstall-policy boundary. (role: introduced current cleanup behavior; confidence: high; commits: 5a65c96fc708; files: src/plugins/uninstall.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Run and attach the exact-head release-marketplace lifecycle result showing the managed path is removed and the unrelated sentinel survives.
  • Resolve the maintainer decision on whether exact record-owned paths are appropriate uninstall-owned configuration.

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.

@vincentkoc
vincentkoc marked this pull request as ready for review August 3, 2026 21:38
@vincentkoc
vincentkoc enabled auto-merge (squash) August 3, 2026 21:39
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L and removed size: M labels Aug 3, 2026
@vincentkoc
vincentkoc merged commit 1d446ad into main Aug 3, 2026
130 of 132 checks passed
@vincentkoc
vincentkoc deleted the qa-clawhub-marketplace-lifecycle branch August 3, 2026 21:57
vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (90 commits)
  fix(googlechat): recover durable lanes after oversized attachments (#118986)
  test(qa): cover runtime telemetry evidence (#118950)
  fix(gateway): resolve SQLite usage details (#118918)
  test(cron): cover durable scheduler state (#118981)
  test(gateway): cover node exec approval relay (#118825)
  test(qa): add Active Memory recall coverage (#118963)
  test(qa): promote package-backed Docker artifact proof (#118826)
  test(qa): cover diagnostic event boundary (#118844)
  test(gateway): cover WebSocket runtime contracts (#118797)
  fix(signal): drain accepted websocket messages before shutdown (#118975)
  fix(plugins): remove stale load paths during uninstall (#118930)
  test(qa): cover bundled runtime discovery (#118922)
  chore(clawhub): cover plugin release policy contracts (#118971)
  test(qa): cover support export and stability (#118956)
  fix(feishu): enforce exact signed webhook request boundaries (#118758)
  feat(sms): add Twilio MMS support (#118664)
  test(gateway): prove TLS certificate pinning (#118812)
  test(qa): cover tool policy and sandbox gates (#118925)
  fix(cli): keep update dry-run state immutable (#118856)
  fix(scripts): honor last repeated CLI flag value (#118710)
  ...

# Conflicts:
#	pnpm-workspace.yaml
vincentkoc added a commit that referenced this pull request Aug 3, 2026
…r-admin-20260803

* origin/main: (89 commits)
  fix(googlechat): align doctor policy ownership with canonical account configuration (#118972)
  test(tui): prove editor input through PTY (#118982)
  fix(memory): persist trusted owner provenance at canonical transcript boundary (#118987)
  test(qa): cover health monitor and cache boundaries (#118961)
  fix(macos): restore dashboard frame double-click zoom (#118976)
  fix(googlechat): recover durable lanes after oversized attachments (#118986)
  test(qa): cover runtime telemetry evidence (#118950)
  fix(gateway): resolve SQLite usage details (#118918)
  test(cron): cover durable scheduler state (#118981)
  test(gateway): cover node exec approval relay (#118825)
  test(qa): add Active Memory recall coverage (#118963)
  test(qa): promote package-backed Docker artifact proof (#118826)
  test(qa): cover diagnostic event boundary (#118844)
  test(gateway): cover WebSocket runtime contracts (#118797)
  fix(signal): drain accepted websocket messages before shutdown (#118975)
  fix(plugins): remove stale load paths during uninstall (#118930)
  test(qa): cover bundled runtime discovery (#118922)
  chore(clawhub): cover plugin release policy contracts (#118971)
  test(qa): cover support export and stability (#118956)
  fix(feishu): enforce exact signed webhook request boundaries (#118758)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* test(qa): prove marketplace plugin updates

* fix(plugins): clean exact install load paths on uninstall

* fix(ci): register marketplace lifecycle assertions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: qa-lab 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L 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