Repository navigation
Description
Environment
- OpenClaw 2026.5.2 (8b2a6e5)
- Raspberry Pi 5, Linux arm64, Node 22.22.2
- Single-user gateway, systemd-managed
Symptom
Running openclaw plugins install <pkgB> after a prior openclaw plugins install <pkgA> removes pkgA's on-disk directory. The install record for pkgA remains in ~/.openclaw/plugins/installs.json, but ~/.openclaw/npm/node_modules/@openclaw/<pkgA> is gone. The gateway then can't load pkgA and emits Config warnings: plugins.entries.<pkgA>: plugin not found: <pkgA> (stale config entry ignored; remove it from plugins config). The same wipe happens on openclaw doctor --fix.
This makes it impossible to have more than one externally-installed @openclaw/* plugin via the CLI — each install resets to a single-plugin state.
Reproduction
Starting from a clean ~/.openclaw/npm/node_modules/@openclaw/ directory:
$ openclaw plugins install @openclaw/discord
Installed plugin: discord
$ ls ~/.openclaw/npm/node_modules/@openclaw/
discord
$ openclaw plugins install @openclaw/acpx@beta
Installed plugin: acpx
$ ls ~/.openclaw/npm/node_modules/@openclaw/
acpx # <-- discord is gone
$ openclaw doctor --fix
Updated ~/.openclaw/openclaw.json
$ ls ~/.openclaw/npm/node_modules/@openclaw/
discord # <-- acpx is gone
$ cat ~/.openclaw/plugins/installs.json | jq '.installRecords | keys'
[
"acpx",
"discord" # <-- both records still tracked, but only one on disk
]
Likely root cause
~/.openclaw/npm/ has no package.json. openclaw plugins install appears to invoke npm install <pkg> (or equivalent) into that directory. With no package.json to anchor a dependency tree, npm treats every package other than the one you're installing as extraneous and removes it. Each subsequent install/repair therefore yields a single-package node_modules. openclaw doctor --fix repeats the same pattern when reconciling the install records.
Workaround
Manually maintain a package.json at ~/.openclaw/npm/ that lists every installed @openclaw/* plugin as a dependency, then run npm install directly:
$ cat > ~/.openclaw/npm/package.json << 'EOF'
{
"name": "openclaw-plugins-install-root",
"version": "0.0.0",
"private": true,
"dependencies": {
"@openclaw/discord": "2026.5.2",
"@openclaw/acpx": "2026.5.2-beta.2"
}
}
EOF
$ cd ~/.openclaw/npm && npm install
$ openclaw plugins enable acpx
$ systemctl --user restart openclaw-gateway.service
After this, both packages coexist and the gateway boots with the full plugin set. The workaround obviously breaks the next time anything calls openclaw plugins install or openclaw doctor --fix, since they presumably overwrite or ignore this package.json.
Suggested fix directions
- Have
openclaw plugins installmaintain apackage.json(or equivalent dep manifest) in~/.openclaw/npm/that reflects all rows ininstalls.jsonbefore running the npm operation, so the targeted package is added but the others stay in the dep tree. - Or invoke npm with
--no-package-lockand--prefer-offlineagainst a synthesized dep tree that includes every previously-installed plugin, so npm doesn't see anything as extraneous. - Or stop using a shared
~/.openclaw/npm/node_modules/for multi-plugin installs, and instead install each plugin into its own directory keyed off the install record.
Related issues
- [Bug]: Discord & Zalo channels removed after upgrade to 2026.5.2 — no migration path #76391 — Discord/Zalo removed from bundled, no installable version on ClawHub. Adjacent but different (this one is about install mechanics, not registry availability).
- [Bug]: Every upgrade nukes QQ Bot — stock plugin removed, npm blocked by security scan #76397 — QQ Bot stock-to-npm transition; closed without resolution.
- Bug: update.run clears plugins.installs, causing all globally-installed plugins to be lost on restart #76430 —
openclaw updateclearsplugins.installsinopenclaw.json. Related but different code path. - v2026.5.2 upgrade fails: "Plugin install payload missing after update" for @openclaw/diffs #76426 — "Plugin install payload missing after update" for
@openclaw/diffs. Same family of issues (post-install package directory missing).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 3, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Current main already fixes the reported npm pruning path by maintaining a managed package.json in the shared plugin npm root before each npm install, and doctor missing-plugin repair uses that same installer.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the managed npm root manifest fix on main and let the next release carry it to users affected by v2026.5.2.
Do we have a high-confidence way to reproduce the issue?
Yes from source inspection: the reported v2026.5.2 behavior follows from npm installs in a shared root without a dependency manifest, and current main now creates and updates that manifest before install. I did not run a live install because this review is read-only.
Is this the best way to solve the issue?
Yes. Maintaining the shared npm root package.json is the narrowest maintainable fix for npm pruning sibling plugin packages, and it also covers the doctor repair path because that path calls the same installer.
Security review:
Security review: Non-PR issue triage; no patch security review applies.
What I checked:
installPluginFromNpmSpecnow callsupsertManagedNpmRootDependencybefore invokingnpm install --prefix, so npm sees existing managed plugins as dependencies instead of extraneous packages. (src/plugins/install.ts:1238, a32fe82bd21b)src/infra/npm-managed-root.ts:48, a32fe82bd21b)@openclaw/feishukeeps the existing@openclaw/discorddependency entry in package.json. (src/infra/npm-managed-root.test.ts:24, a32fe82bd21b)installPluginFromNpmSpec, so the doctor repair path benefits from the managed npm root manifest fix. (src/commands/doctor/shared/missing-configured-plugin-install.ts:417, a32fe82bd21b)fix(plugins): preserve npm plugin installs across repairs, committed at 2026-05-02T18:31:59-07:00. (d7dbf1150432)git tag --contains d7dbf11504326debaa78b0f55df698437e517368returned no tags, whilegit branch --containsshowsmain; this is fixed on current main but not proven shipped in v2026.5.2. (d7dbf1150432)Likely related people:
src/plugins/install.ts,src/infra/npm-managed-root.ts,src/infra/npm-managed-root.test.ts)Codex review notes: model gpt-5.5, reasoning high; reviewed against a32fe82bd21b; fix evidence: commit d7dbf1150432, main fix timestamp 2026-05-02T18:31:59-07:00.