Repository navigation
fix(plugins): repair stale host packages after OpenClaw upgrades - #118304
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 8:43 PM ET / August 3, 2026, 00:43 UTC. ClawSweeper reviewWhat this changesRepairs stale nested Merge readinessKeep open. Current main repairs host links only inside managed npm project roots, while this PR adds the missing registered legacy Priority: P1 Review scores
Verification
How this fits togetherOpenClaw stores installed-plugin records in its state index and loads plugin packages from managed roots. Doctor and update convergence inspect those records, repair a stale plugin-local host package when the installation is proven to be OpenClaw-managed, then run payload checks before the gateway uses the plugin. flowchart TD
A[Installed plugin index] --> B[Registered npm install record]
B --> C[Exact extensions-root and realpath checks]
C --> D[Inspect package host dependency]
D --> E[Repair stale nested OpenClaw host link]
E --> F[Doctor or update convergence]
F --> G[Payload smoke check]
G --> H[Gateway loads healthy plugin]
Decision needed
Why: The patch performs destructive repair of user-local plugin directories; source review shows the requested narrowing, but repository policy reserves larger ownership and security-boundary changes for maintainer judgment, and Codex-specific source validation could not be completed locally. Before merge
Agent review detailsSecurityNone. PR surfaceSource +250, Tests +734. Total +984 across 17 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: 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:
Technical reviewBest possible solution: Land the canonical SQLite-record and exact-realpath repair only after a maintainer confirms that registered npm installs at the exact Do we have a high-confidence way to reproduce the issue? Yes, source reproducibly shows the gap: current main repairs managed npm project roots but not registered legacy npm installs under the extensions root; the PR adds focused filesystem regressions for that state. Is this the best way to solve the issue? Yes, subject to the maintainer ownership decision: routing all legacy repair paths through the SQLite-record-derived exact-root reconciler is safer than the earlier arbitrary install-path loop and keeps developer-owned installs out of scope. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 18c9f27e2de3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…nclaw#118304) * fix(plugins): repair stale registered host package links * refactor(plugins): isolate authoritative host-link repair owners * fix(plugins): constrain host repair to registered install roots
Closes #108705
What Problem This Solves
Fixes an issue where users upgrading OpenClaw with an older npm-installed plugin could see the Codex plugin and other providers fail with missing host exports because a stale nested
node_modules/openclawcopy continued loading an obsolete OpenClaw runtime.Why This Change Was Made
The authoritative SQLite plugin-install registry now owns detection and repair of stale managed npm plugin host links. Doctor inspections report the exact problem without modifying files;
doctor --fix, unchanged-version plugin updates, and post-core-update repair replace the obsolete nested host with the current canonical host for both peer and direct dependencies. Developer/path/git/ClawHub/marketplace installations, unknown manifests, out-of-root symlinks, and ambiguous ownership remain untouched.User Impact
Upgraded installations recover broken provider plugins at the existing doctor/update repair boundaries without reinstalling plugins, changing runtime fallback behavior, or risking developer-owned plugin directories.
Evidence
~/.openclaw/extensions/email/node_modules/openclawpackage against the authoritative installed-plugin SQLite index; current main does not repair it.7951bf9ad511dfe5c8c2bbc944d73758258b0875: 11 complete affected suites / 471 tests passed, including the already-landed fix(auth): retain the selected account when migrating Codex sessions #118205 selected-account OAuth, SQLite-session, and actual/statusmigration regressions.corepack pnpm check:changedpassed: production and core-test typechecks, 17-file format, every changed-core lint shard (zero warnings/errors), plugin SDK/boundary guards, dead-export checks, database-first guards, and import-cycle checks.Follow-up security and ownership correction
A fresh ClawSweeper review correctly identified that the inherited post-installer repair loop trusted an arbitrary configured npm install path. The follow-up removes that destructive path entirely: every post-update host repair now flows through the same canonical SQLite-derived registered-install owner, accepting only an npm record at its exact managed
state/extensions/<pluginId>root and canonical realpath. Real filesystem regressions prove external packages, out-of-root aliases, in-root developer aliases, developer/path installs, Marketplace packages, and ClawHub packages are never modified; malformed sibling packages and broken links do not block valid siblings. Modern managed npm project repair remains owned by its existing installer.The follow-up also reads bounded package manifests through the existing
src/infra/json-files.tspolicy owner, fixing the previously failing hostedfs-safe-import-boundaryshard without suppressing its check.Exact follow-up validation: 578/578 tests across 14 complete affected suites, 2/2 real packaged npm installs against a real local HTTP registry, and a fresh full unbypassed
pnpm check:changed(production/core-test typechecks, all lint shards with zero warnings, formatting, SDK/plugin boundaries, Knip, SQLite/schema guards, and runtime import cycles). Fresh independent xhigh autoreview inspected the complete effective 17-file PR plus the security correction and found zero P0/P1/P2 findings.