Repository navigation
fix(update): avoid per-Node npm prefixes during self-update - #93650
Merged
Merged
Conversation
Co-authored-by: Soham Patankar <[email protected]>
8 tasks done
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jun 17, 2026
…#93650) Co-authored-by: openclaw-clownfish[bot] <280122609+openclaw-clownfish[bot]@users.noreply.github.com> Co-authored-by: Soham Patankar <[email protected]>
steipete
pushed a commit
to buddyh/openclaw
that referenced
this pull request
Jul 7, 2026
Package self-updates resolved their install target from `npm root -g`
even when the running install's package root was already known. In an
environment where PATH's npm does not belong to the running install's
Node tree (a launchd/systemd service PATH, or mixed Homebrew + nvm
setups), the probe points at a different global root — or derives a
brand-new one — so the update installs there, reports success, and
leaves the running install stale.
Observed in the wild: a gateway-managed `openclaw update --yes` on
2026.5.28 ran nvm's npm under Homebrew's node, npm derived its default
prefix from the realpathed execPath, and the update installed a full
copy into /opt/homebrew/Cellar/node/26.3.1/lib/node_modules/openclaw
("before": null — a tree that had never existed) while the running nvm
install stayed on the old version until a manual shell update.
resolveGlobalInstallTarget now prefers the package root's own global
root for npm targets; the `npm root -g` probe only decides the target
when no package root is known, and an ephemeral per-Node probe result
(Homebrew Cellar, nvm/n/asdf/volta version dirs — the same set
openclaw#93650 filters npm commands against) is never adopted.
steipete
added a commit
that referenced
this pull request
Jul 7, 2026
…101228) * fix(update): keep self-updates on the running install's global root Package self-updates resolved their install target from `npm root -g` even when the running install's package root was already known. In an environment where PATH's npm does not belong to the running install's Node tree (a launchd/systemd service PATH, or mixed Homebrew + nvm setups), the probe points at a different global root — or derives a brand-new one — so the update installs there, reports success, and leaves the running install stale. Observed in the wild: a gateway-managed `openclaw update --yes` on 2026.5.28 ran nvm's npm under Homebrew's node, npm derived its default prefix from the realpathed execPath, and the update installed a full copy into /opt/homebrew/Cellar/node/26.3.1/lib/node_modules/openclaw ("before": null — a tree that had never existed) while the running nvm install stayed on the old version until a manual shell update. resolveGlobalInstallTarget now prefers the package root's own global root for npm targets; the `npm root -g` probe only decides the target when no package root is known, and an ephemeral per-Node probe result (Homebrew Cellar, nvm/n/asdf/volta version dirs — the same set #93650 filters npm commands against) is never adopted. * fix(update): infer global roots for scoped package roots The running-root fallback missed scoped installs because inferGlobalRootFromPackageRoot only accepted an immediate node_modules parent. Hop over an @scope segment so node_modules/@scope/name resolves to the same global root. Regression test: scoped package root with an ephemeral probe now falls back to the running root. * fix(update): scope running-root selection * docs(changelog): note npm self-update root fix * chore(changelog): defer release note --------- Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 7, 2026
…penclaw#101228) * fix(update): keep self-updates on the running install's global root Package self-updates resolved their install target from `npm root -g` even when the running install's package root was already known. In an environment where PATH's npm does not belong to the running install's Node tree (a launchd/systemd service PATH, or mixed Homebrew + nvm setups), the probe points at a different global root — or derives a brand-new one — so the update installs there, reports success, and leaves the running install stale. Observed in the wild: a gateway-managed `openclaw update --yes` on 2026.5.28 ran nvm's npm under Homebrew's node, npm derived its default prefix from the realpathed execPath, and the update installed a full copy into /opt/homebrew/Cellar/node/26.3.1/lib/node_modules/openclaw ("before": null — a tree that had never existed) while the running nvm install stayed on the old version until a manual shell update. resolveGlobalInstallTarget now prefers the package root's own global root for npm targets; the `npm root -g` probe only decides the target when no package root is known, and an ephemeral per-Node probe result (Homebrew Cellar, nvm/n/asdf/volta version dirs — the same set openclaw#93650 filters npm commands against) is never adopted. * fix(update): infer global roots for scoped package roots The running-root fallback missed scoped installs because inferGlobalRootFromPackageRoot only accepted an immediate node_modules parent. Hop over an @scope segment so node_modules/@scope/name resolves to the same global root. Regression test: scoped package root with an ephemeral probe now falls back to the running root. * fix(update): scope running-root selection * docs(changelog): note npm self-update root fix * chore(changelog): defer release note --------- Co-authored-by: Peter Steinberger <[email protected]>
sheyanmin
pushed a commit
to sheyanmin/openclaw
that referenced
this pull request
Jul 8, 2026
…penclaw#101228) * fix(update): keep self-updates on the running install's global root Package self-updates resolved their install target from `npm root -g` even when the running install's package root was already known. In an environment where PATH's npm does not belong to the running install's Node tree (a launchd/systemd service PATH, or mixed Homebrew + nvm setups), the probe points at a different global root — or derives a brand-new one — so the update installs there, reports success, and leaves the running install stale. Observed in the wild: a gateway-managed `openclaw update --yes` on 2026.5.28 ran nvm's npm under Homebrew's node, npm derived its default prefix from the realpathed execPath, and the update installed a full copy into /opt/homebrew/Cellar/node/26.3.1/lib/node_modules/openclaw ("before": null — a tree that had never existed) while the running nvm install stayed on the old version until a manual shell update. resolveGlobalInstallTarget now prefers the package root's own global root for npm targets; the `npm root -g` probe only decides the target when no package root is known, and an ephemeral per-Node probe result (Homebrew Cellar, nvm/n/asdf/volta version dirs — the same set openclaw#93650 filters npm commands against) is never adopted. * fix(update): infer global roots for scoped package roots The running-root fallback missed scoped installs because inferGlobalRootFromPackageRoot only accepted an immediate node_modules parent. Hop over an @scope segment so node_modules/@scope/name resolves to the same global root. Regression test: scoped package root with an ephemeral probe now falls back to the running root. * fix(update): scope running-root selection * docs(changelog): note npm self-update root fix * chore(changelog): defer release note --------- Co-authored-by: Peter Steinberger <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #80387 by repairing the existing contributor PR #80386 from @yaanfpv.
This keeps the same narrow behavior: OpenClaw should still detect npm ownership for the current global install, but the reinstall command should avoid Homebrew Cellar and version-manager per-Node npm prefixes so a later Node major upgrade does not delete the command shim target. Stable npm global prefixes should continue to resolve as before.
Repair checklist for Clownfish:
pnpm -s vitest run src/infra/update-global.test.tsandpnpm check:changed./reviewand address every finding before merge preflight.Clownfish 🐠 replacement reef notes:
fish notes: model gpt-5.5, reasoning medium; reviewed against 82c8b7c.