Skip to content

fix(plugins): hide uninstalled TGZ plugins from inventory - #131880

Merged
vincentkoc merged 2 commits into
mainfrom
fix/plugin-cache-generation
Aug 28, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/plugin-cache-generation

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where users uninstalling a plugin installed from a TGZ/npm-pack artifact could still see it in managed plugin inventory when the running Gateway had cached the plugin's pre-uninstall filesystem metadata.

Why This Change Was Made

Explicit mutation refreshes now discover plugin state inside a fresh operation-scoped PluginCache generation. This prevents install/uninstall refreshes from inheriting stale package facts while preserving the Gateway's existing boot metadata and cache generation.

Ordered non-isolated plugin tests now start explicit lifecycle generations where filesystem or manifest state changes between observations. Oversized lifecycle suites are split by behavior owner so the cache regressions remain covered without max-lines exceptions.

User Impact

Plugin installs and uninstalls become visible immediately to management inventory. A removed TGZ plugin is no longer rediscovered or republished into the durable installed index, while a running Gateway keeps its boot metadata until its normal lifecycle replaces it.

Evidence

  • Regression test failed before the production fix because the removed TGZ plugin remained in the persisted installed index.
  • Focused mutation suite: 6 files, 47 tests passed.
  • Previously failing lifecycle set: 9 files, 140 tests passed.
  • Full plugin suite: 266 files, 4,188 tests passed, 1 skipped.
  • Final migration-provider lifecycle test: 6 tests passed.
  • Test-split proof: 5 files, 75 tests passed. The 7 install-enablement tests and 4 bundled public-surface tests are byte-identical to their pre-split bodies.
  • Direct core oxlint, formatting, max-lines ratchet, assertion safety, dead-export scan, plugin boundaries, and diff checks passed.
  • Local check:changed passed every reached gate, then tsgo:core:test hit an unrelated shared dependency issue: the linked node_modules lacks pako declarations for ui/vite.config.ts. Worktree policy forbids reinstalling dependencies in place.
  • Hosted exact-head CI is green at 03bce0b; openclaw/ci-gate, lint, core test types, dependencies, and required shards passed.
  • Plugin contracts: 45 files and 1,102 tests passed; one unrelated local package-pin check failed because the linked node_modules contains @anthropic-ai/claude-agent-sdk 0.3.232 while this pinned main commit requires 0.3.238. Worktree policy forbids reinstalling dependencies in place.
  • Fresh autoreview: clean, no accepted/actionable findings; overall patch-correctness confidence 0.99.

Production LOC: +25/-20 (net +5). Tests: +964/-766 (net +198; moved bodies discounted, added scaffolding only). The test-split repair adds no production LOC.

@vincentkoc vincentkoc self-assigned this Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 28, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 28, 2026 15:48
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 12:18 PM ET / 16:18 UTC.

ClawSweeper review

What this changes

Makes install and uninstall registry refreshes use an isolated plugin-metadata cache so removed packaged plugins disappear from management inventory without replacing the running Gateway snapshot.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for explicit maintainer review. The introduced cache boundary matches the documented distinction between stable Gateway metadata and fresh explicit management operations, and no blocking correctness or security defect was found.

Priority: P2
Reviewed head: 03bce0bd27b96ef6ff851877559f1d6c8ec546b6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused cache-lifecycle repair with direct owner-boundary regression coverage; pending exact-head CI and protected maintainer handling remain workflow gates.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: the contributor proof gate does not apply to this member-authored PR; the supplied test results remain supplemental evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: the contributor proof gate does not apply to this member-authored PR; the supplied test results remain supplemental evidence.
Evidence reviewed 6 items Introduced cache boundary: The PR wraps the complete post-mutation install-record read and registry refresh in a newly created operation cache, preventing it from inheriting pre-write process-cache facts.
Uninstall caller and regression coverage: The management uninstall path commits the stripped install records before calling the refreshed registry path; the added test creates an npm-pack TGZ fixture, removes it, verifies it is absent from both persisted inventory and management output, and verifies the boot snapshot remains unchanged.
Documented lifecycle contract: Plugin architecture documentation explicitly specifies that Gateway retains one cache generation while explicit management operations use isolated generations, and that their writes do not replace the running Gateway inventory.
Findings None None.
Security None None.

How this fits together

Plugin management mutations update configuration, installed-package records, and the durable inventory. Gateway runtime readers retain their startup metadata, while explicit install, uninstall, and registry-refresh operations may inspect freshly written package state.

flowchart LR
  A[Plugin install or uninstall] --> B[Config and package write]
  B --> C[Fresh operation cache]
  C --> D[Registry refresh]
  D --> E[Persisted management inventory]
  F[Gateway startup snapshot] --> G[Runtime plugin readers]
  C -. preserves .-> F
Loading

Before merge

  • Resolve merge risk (P2) - This bug fix adds a net five production lines to alter cache lifecycle behavior; the scope is documented and localized, but the maintainer review should confirm it remains limited to explicit mutation refreshes.
  • Complete next step (P2) - No repair job is warranted: the remaining action is protected maintainer review and exact-head CI completion, not a mechanical code defect.
Agent review details

Security

None.

PR surface

Source +5, Tests +198. Total +203 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 1 25 20 +5
Tests 12 964 766 +198
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 989 786 +203

Review metrics

Metric Value Why it matters
Production versus test delta production +25/-20 (net +5); tests +964/-766 (net +198) The production growth is limited to the operation cache boundary; most test churn splits existing coverage and adds lifecycle isolation.

Stored data model

Persistent data-model change detected: persistent cache schema: src/plugins/registry-refresh.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the operation-scoped refresh boundary and land it after exact-head CI and maintainer confirmation that Gateway startup metadata stays process-stable.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the operation-scoped refresh boundary and land it after exact-head CI and maintainer confirmation that Gateway startup metadata stays process-stable.

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

Yes, at source level: the added TGZ fixture establishes a cached Gateway snapshot, uninstalls the package, and observes that the old refresh path would republish stale inventory. It was not executed in this read-only checkout.

Is this the best way to solve the issue?

Yes. The cache scope is applied once at the shared post-mutation registry-refresh owner, covers install and uninstall callers, and preserves the documented Gateway snapshot lifetime.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The fix addresses stale plugin-management inventory after package removal, with limited blast radius and no demonstrated runtime outage.
  • 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: Not applicable: the contributor proof gate does not apply to this member-authored PR; the supplied test results remain supplemental evidence.

Evidence

What I checked:

  • Introduced cache boundary: The PR wraps the complete post-mutation install-record read and registry refresh in a newly created operation cache, preventing it from inheriting pre-write process-cache facts. (src/plugins/registry-refresh.ts:27, 335478f65fc2)
  • Uninstall caller and regression coverage: The management uninstall path commits the stripped install records before calling the refreshed registry path; the added test creates an npm-pack TGZ fixture, removes it, verifies it is absent from both persisted inventory and management output, and verifies the boot snapshot remains unchanged. (src/plugins/management-service.workspace-inventory.test.ts:103, 03bce0bd27b9)
  • Documented lifecycle contract: Plugin architecture documentation explicitly specifies that Gateway retains one cache generation while explicit management operations use isolated generations, and that their writes do not replace the running Gateway inventory. Public docs: docs/plugins/architecture.md. (docs/plugins/architecture.md:141, 03bce0bd27b9)
  • Current-main comparison: The fetched current-main version retains the former refresh body without the operation-scoped cache, so this central fix is not already implemented on main. (src/plugins/registry-refresh.ts:26, 221c89c1a20a)
  • Feature provenance: Current cache ownership dates to the cache-unification commit, while this PR's functional change is the later isolated-registry-refresh commit. (src/plugins/plugin-cache.ts:52, c6c226803443)
  • Dependency scope: The introduced production code uses only OpenClaw's internal plugin-cache and registry-refresh modules; no Codex runtime, protocol, harness, or dependency contract is implicated. (src/plugins/registry-refresh.ts:6, 335478f65fc2)

Likely related people:

  • Peter Steinberger: Authored the current-main cache-unification commit that established the process and operation cache model used by this repair. (role: introduced current cache ownership; confidence: high; commits: c6c226803443, eda219c4c21b; files: src/plugins/plugin-cache.ts, src/plugins/registry-refresh.ts, src/plugins/plugin-metadata-snapshot.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-28T16:00:02.576Z sha 335478f :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc merged commit 0f079c8 into main Aug 28, 2026
248 checks passed
@vincentkoc
vincentkoc deleted the fix/plugin-cache-generation branch August 28, 2026 16:30
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
…31880)

* fix(plugins): isolate registry refresh cache generations

* test(plugins): split cache generation suites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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