fix(plugins): repair missing openclaw peer links on update#77544
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Source inspection shows current main can return unchanged for a matching npm install before installPluginFromNpmSpec reaches installPluginFromInstalledPackageDir and linkOpenClawPeerDependencies; I did not mutate a local install for a live reproduction because this sweep was read-only. Next step before merge Security Review detailsBest possible solution: Merge this PR after normal maintainer review while preserving the changelog entry and regression coverage around the unchanged npm-plugin update path. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main can return unchanged for a matching npm install before installPluginFromNpmSpec reaches installPluginFromInstalledPackageDir and linkOpenClawPeerDependencies; I did not mutate a local install for a live reproduction because this sweep was read-only. Is this the best way to solve the issue? Yes. Reusing the existing installer/linker path only when an installed package declares an OpenClaw host peer and lacks a usable local link is the narrow maintainable fix, and the force-pushed changelog entry resolves the earlier process blocker. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 43b5df729593. |
0bddca5 to
0f05114
Compare
|
Adding a real-world repro/validation point from a live macOS install, since this matches the failure mode I hit today. Environment:
Symptoms before repair: This affected interactive, heartbeat, Telegram topic, and cron lanes. The gateway stayed up, but Codex-backed turns failed before reply, which made the system feel like it was hanging/stopped responding. Local state after manual workaround: The workaround was to install So the important upstream behavior is exactly what this PR is targeting: an unchanged/current managed npm plugin should not be considered healthy when its |
0f05114 to
cdf2018
Compare
|
Landed via rebase onto main.
Thanks @ProspectOre! |
Summary
Repair npm-installed plugins that declare
peerDependencies.openclawwhen their plugin-localnode_modules/openclawlink is missing or dangling.The npm update path already skips reinstalling unchanged artifacts when version and integrity match. That skip is correct only if the installed plugin runtime graph is complete. This change bypasses the skip for packages that declare the OpenClaw host peer but cannot resolve
node_modules/openclaw, allowing the existing installer/linker path to repair the install.Root Cause
@openclaw/codeximportsopenclaw/plugin-sdk/*through its published bundle and declaresopenclawas a peer dependency. Fresh OpenClaw-managed installs already create the plugin-local peer link. Existing installs missing that link can remain broken across OTA becauseupdateNpmInstalledPlugins()returnsunchangedbefore invoking the installer when the package version and integrity still match.That leaves the plugin installed but unable to import
openclaw/plugin-sdk/*, producingERR_MODULE_NOT_FOUNDeven though the installed package version is current.Validation
npx --yes pnpm@10.33.2 node scripts/test-projects.mjs src/plugins/update.test.ts(64 passed)npx --yes pnpm@10.33.2 tsgo:corenpx --yes pnpm@10.33.2 exec oxlint src/infra/package-update-utils.ts src/plugins/update.ts src/plugins/update.test.tsnpx --yes pnpm@10.33.2 exec oxfmt --check src/infra/package-update-utils.ts src/plugins/update.ts src/plugins/update.test.ts@openclaw/codex@2026.5.3install without@openclaw/codex/node_modules/openclaw; updater repaired the link and reported the plugin unchanged at2026.5.3.