fix(plugins): repair managed npm openclaw peers#78291
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. source-reproducible with high confidence from #77959 logs plus current-main code: the reported Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the lifecycle repair, but scrub every root manifest dependency field that can name Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence from #77959 logs plus current-main code: the reported Is this the best way to solve the issue? No, not yet. The lifecycle location is the right narrow fix, but the implementation should cover all stale root manifest fields and the PR still needs real behavior proof before it is the best merge candidate. Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 98cbf7f11c35. |
8258ed8 to
ddd8c4a
Compare
cae1401 to
0668a23
Compare
0668a23 to
b083d85
Compare
Remove stale managed-root openclaw manifests, locks, hidden locks, and installed copies before npm plugin installs. Relink plugin-local openclaw peer symlinks after shared-root npm install, rollback, update, and uninstall mutations so SDK-using plugins keep resolving openclaw/plugin-sdk/*. Force safe npm commands out of inherited legacy/strict peer-dependency modes. Co-authored-by: Vincent Koc <vincentkoc@ieee.org> Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
b083d85 to
21abcc9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21abcc9a07
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await rollbackManagedNpmPluginInstall({ | ||
| npmRoot, | ||
| packageName: parsedSpec.name, | ||
| targetDir: installRoot, | ||
| timeoutMs, | ||
| logger, | ||
| }); |
There was a problem hiding this comment.
Keep existing plugin files when npm update install fails
Calling rollbackManagedNpmPluginInstall on a non-zero npm install now removes targetDir and runs npm uninstall, which deletes the currently installed package when this path is hit during mode: "update" failures (for example, transient registry/network errors). In update.ts, failed installs are treated as “update failed, keep existing record,” so deleting the existing on-disk package turns a failed update into an unintended uninstall and leaves the recorded install path broken.
Useful? React with 👍 / 👎.
|
Landed via squash onto main.
Thanks @vincentkoc and @Patrick-Erichsen for the original repair direction and coverage. |
Summary
openclawmanifest, lockfile, hidden lock, installed package state, and fallback bin shims before and after npm plugin installs, carrying forward fix(plugins): repair stale managed openclaw peers #78251 and fix(plugins): clear hidden npm lock during peer repair #78265 without globally omitting peersnode_modules/openclawpeer links after shared-root npm install, rollback, update, and uninstall mutations, so one plugin operation does not break already-installed SDK-using pluginsFixes #77959.
Supersedes #78251.
Supersedes #78265.
Related: #77412, #77544.
Real behavior proof
node_modules/openclaw, and later npm mutations could prune plugin-localnode_modules/openclawSDK peer links.tbx_01kqxzepj0hyhgz0aep7s41v0m, Nodev24.13.0, npm11.6.2, synced PR branch.pnpm crabbox:run -- --provider blacksmith-testbox --blacksmith-org openclaw --blacksmith-workflow .github/workflows/ci-check-testbox.yml --blacksmith-job check --blacksmith-ref main --idle-timeout 90m --ttl 240m --timing-json --shell -- "...default suite... && ...inherited legacy/strict peer-deps suite... && git diff --check"legacy-peer-deps=true/strict-peer-deps=trueenvironments passed; required peer root materialization was scrubbed, sibling peer links were relinked after later installs, stale root state/bin/hidden lock cleanup passed, and rollback/update/uninstall relink coverage passed.Verification
pnpm exec oxfmt --check --threads=1 src/plugins/install.ts src/plugins/install.npm-spec.e2e.test.ts src/plugins/install.npm-spec.test.tspnpm exec oxlint src/plugins/install.ts src/plugins/install.npm-spec.e2e.test.ts src/plugins/install.npm-spec.test.tspnpm test src/plugins/install.npm-spec.test.ts src/plugins/install.npm-spec.e2e.test.ts src/infra/npm-managed-root.test.ts src/plugins/uninstall.test.tspnpm test src/infra/safe-package-install.test.ts src/plugins/update.test.ts src/plugins/install.npm-spec.test.ts src/plugins/install.npm-spec.e2e.test.ts src/infra/npm-managed-root.test.ts src/plugins/uninstall.test.tsgit diff --checktbx_01kqxytnvc6na979wskbmxx4cz:env NODE_OPTIONS=--max-old-space-size=4096 OPENCLAW_VITEST_MAX_WORKERS=1 pnpm check:changedtbx_01kqxzepj0hyhgz0aep7s41v0m: default + inheritedlegacy-peer-deps=true/strict-peer-deps=trueall-conditions suite passed, including stale root scrub, bin/hidden-lock cleanup, required peer root materialization scrub, sibling peer relink after later install, rollback, update, uninstall, safe npm env, andgit diff --check