fix(plugins): rebuild missing installs on policy refresh#89882
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 2:48 AM ET / 06:48 UTC. Summary PR surface: Source +378, Tests +966. Total +1344 across 7 files. Reproducibility: yes. Current main and v2026.6.10 can take the policy-changed fast path while only mapping persisted.plugins, which matches the linked issue's state where installRecords contains path/npm plugins missing from plugins[]. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Resolve the dirty base, then land one shared registry-refresh recovery path if maintainers accept the persisted-state rebuild behavior. Do we have a high-confidence way to reproduce the issue? Yes. Current main and v2026.6.10 can take the policy-changed fast path while only mapping persisted.plugins, which matches the linked issue's state where installRecords contains path/npm plugins missing from plugins[]. Is this the best way to solve the issue? Yes, with maintainer acceptance. Fixing the persisted registry refresh guard and sharing recovery logic with snapshot loading repairs the canonical registry view more directly than adding a validator-only fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 56c2d637d940. Label changesLabel justifications:
Evidence reviewedPR surface: Source +378, Tests +966. Total +1344 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
ff3457c to
0f1532e
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
This pull request has been automatically marked as stale due to inactivity. |
Summary
Fixes #89606.
policy-changedregistry refresh can take a persisted fast path that only updates enablement. That is safe only when the persistedplugins[]view is complete. If persisted install records still point at recoverable path/npm plugins that are missing fromplugins[], the fast path preserves the broken view and keeps those plugins invisible.This changes the policy refresh guard to fall back to a source rebuild when recoverable install records are missing from the persisted plugin index. The existing registry snapshot recovery check now shares the same helper, so load-time and refresh-time behavior stay aligned.
Verification
node scripts/run-vitest.mjs src/plugins/installed-plugin-index-store.test.ts src/plugins/plugin-registry-snapshot.test.tsnode scripts/run-vitest.mjs src/plugins/plugin-registry.test.ts src/config/config.plugin-validation.test.tsnode scripts/run-vitest.mjs src/plugins/installed-plugin-index-store.test.ts src/plugins/plugin-registry-snapshot.test.ts src/plugins/plugin-registry.test.ts src/config/config.plugin-validation.test.tscorepack pnpm exec oxfmt --check src/plugins/installed-plugin-index-recovery.ts src/plugins/installed-plugin-index-store.ts src/plugins/plugin-registry-snapshot.ts src/plugins/installed-plugin-index-store.test.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode localReal behavior proof
Behavior addressed:
policy-changedrefresh no longer leaves recoverable path/npm install records stranded outsideplugins[].Real environment tested: Local OpenClaw source checkout on macOS with Node 24.8.0 and pnpm 11.2.2 via Corepack, using a temporary
OPENCLAW_STATE_DIRand the real SQLite-backed plugin registry store.Exact steps or command run after this patch: Ran a live
corepack pnpm exec tsxcommand in this PR checkout that created a temporary OpenClaw state directory, wrote an installed registry with path/npminstallRecordsand an emptyplugins[], then invokedrefreshPersistedInstalledPluginIndexSync({ reason: "policy-changed" })through the production registry refresh path.Evidence after fix: Console output from that live command:
Observed result after fix: The live output shows the broken starting state with
plugins[]empty and bothlocal-plugin/whatsapppresent only ininstallRecords; after thepolicy-changedrefresh, both ids are present inplugins[]and the install records remain present.What was not tested: I did not run the downstream GPU sandbox/NemoClaw image; this proof targets the registry state shape reported in #89606 in a local OpenClaw setup.