Repository navigation
Description
Summary
openclaw update --dry-run --json reports "mode": "npm" for an OpenClaw installation that was created with pnpm 11 globally. The host runs Arch Linux, has pnpm 11 as the only package manager (npm is not installed), and the active OpenClaw package root resolves into pnpm's global virtual store under store/v11/links/.
The defect is in OpenClaw's package-manager ownership detection: it does not recognize pnpm 11's isolated global-package layout and global virtual store paths. When detection fails, the CLI shared helper (resolveGlobalManager in src/cli/update-cli/shared.ts:303) falls back to "npm" silently.
Confirmed persistent in v2026.7.1 — verified against the pinned release tag. The npm fallback line shifted from 302 → 303 between v2026.6.11 and v2026.7.1, but no pnpm 11 detection fix or test fixture has been included. The
resolveGlobalInstallTargetfunction now accepts an optionalpackageNameparameter, but detection logic is otherwise unchanged.
Environment
- OS: Arch Linux
- OpenClaw version: 2026.6.11 (bug confirmed persistent in v2026.7.1)
- pnpm version: 11
- npm: not installed
- Installation style:
pnpm add -g openclaw
Expected behavior
{
"mode": "pnpm",
"root": "/home/user/.local/share/pnpm/store/v11/links/@/openclaw///node_modules/openclaw"
}Actual behavior
{
"mode": "npm",
"root": "/home/user/.local/share/pnpm/store/v11/links/@/openclaw///node_modules/openclaw"
}The root is clearly inside pnpm's store, yet the selected update mode is npm.
Root cause
Two related defects:
1. pnpm 11 layout not recognized
OpenClaw's pnpm detection (detectGlobalInstallManagerForRoot in src/infra/update-global.ts) assumes one of:
- A direct package entry at
$(pnpm root -g)/openclaw - A
.pnpm/.../node_modules/structure - A versioned global directory with pnpm metadata files
In pnpm 11:
pnpm root -greturns~/.local/share/pnpm/global/v11(the global package directory, not anode_modules)$(pnpm root -g)/openclawdoes not exist (pnpm 11 uses isolated install groups with hash symlinks)- The active package resolves through
store/v11/links/@/openclaw///node_modules/openclaw
The secondary detector inferPnpmGlobalRootFromPackageRoot (src/infra/update-global.ts) only recognizes direct versioned node_modules roots or paths containing .pnpm. A store/v11/links path satisfies neither.
2. Failed detection silently defaults to npm
resolveGlobalManager in src/cli/update-cli/shared.ts:303 converts detection failure into "npm":
const byPresence = await detectGlobalInstallManagerByPresence(runCommand, params.timeoutMs);
return byPresence ?? "npm";This produces a false npm classification even when npm is absent and the active root is visibly inside pnpm's store.
Note: the lower-level runner (resolveUpdateInstallSurface and runGatewayUpdate in src/infra/update-runner.ts) already handles this correctly by returning mode: "unknown". The unsafe fallback is only in the CLI shared helper used by dry-run and package-install orchestration.
Steps to reproduce
# Install OpenClaw with pnpm 11
pnpm add -g openclaw@latest
# Confirm pnpm version and paths
pnpm --version
pnpm root -g # returns .../global/v11
pnpm bin -g # returns .../bin
pnpm store path # returns store base dir
# Confirm the older expected direct package path is absent
test -e "$(pnpm root -g)/openclaw" && echo "exists" || echo "absent";
# → absent (normal for pnpm 11)
# Confirm npm is absent (if applicable)
command -v npm || echo "npm not installed";
# Observe incorrect updater classification
openclaw update --dry-run --json | jq '{mode, root}';
# → {"mode": "npm", "root": "...store/v11/links/..."}Impact
- Update command failure: On hosts without npm,
openclaw updatewill attempt to invoke a nonexistent command - Wrong installation target: On hosts where npm is also installed, OpenClaw may update an npm global root that doesn't own the active package — creating split installations
- Misleading diagnostics: JSON output claims
"mode": "npm"rather than indicating detection failed - Auto-update risk: Any automatic update mechanism inherits the misclassification
Suggested fix
Required changes
- Recognize pnpm 11 global installations — use authoritative pnpm metadata (
pnpm list -g --json openclawor scanning hash symlinks underglobal/v11) instead of assuming a direct entry at$(pnpm root -g)/openclaw - Compare realpaths — pnpm 11's install-group
node_modules/openclawmay be a symlink intostore/v11/links; detection should comparerealpathvalues - Fail closed —
resolveGlobalManagershould return an explicitunknownresult (with a reason) when no manager is proven, rather than defaulting to npm. This requires updatingGlobalInstallManagerto include anunknownvariant - Preserve target identity — the updater must update the installation that owns the active package, not a different package-manager root
Implementation approaches
- Option A: Use
pnpm list -g --json openclawas the source of truth, parse the dependency entry path, and realpath-compare with the active package root - Option B: Implement a scanner for pnpm 11's
global/v11directory: read hash symlinks, resolve install groups, checkpackage.jsondependencies, and compare install-groupnode_modules/openclawrealpaths - Option C: Recognize
store/v11/linkspath patterns as supporting evidence, but only accept pnpm ownership after confirming an active global install group points to the same realpath
Related work
- Issue openclaw update: pnpm global installs not detected (mode: unknown) #20745 — pnpm global installs reported as unknown (closed/stale)
- Issue openclaw update SKIPPED for pnpm global installs due to symlink resolution bug #22768 — pnpm symlink resolution bug (closed/completed)
- PR fix: resolve symlinks in pnpm/bun global install detection #24744 — resolved symlinks in pnpm/bun global install detection (merged)
- PR fix(update): preserve pnpm custom global root #78393 — preserve pnpm custom global root (merged)
- PR fix: include pnpm 11 bins in gateway PATH #85238 — include pnpm 11
$PNPM_HOME/binin Gateway PATH (merged) - PR fix(update): preserve pnpm and Bun global installs #107802 — community PR submitted 2026-07-14 addressing defect fix: add @lid format support and allowFrom wildcard handling #1 (pnpm 11 link-store detection). Partial fix: adds
store/v*/linkspath recognition withpackage.jsonname guard and two test cases. Does not address defect Login fails with 'WebSocket Error (socket hang up)' ECONNRESET #2 (unsafe npm fallback inresolveGlobalManager). Status: open, awaiting review.
None of these address pnpm 11's store/v11/links ownership detection in a merged fix.
Workaround
Update OpenClaw explicitly through pnpm:
pnpm add -g openclaw@latest
systemctl --user restart openclaw-gateway.serviceAcceptance criteria
A fix should include tests covering:
- pnpm 11 isolated global installation —
global/v11/install group withstore/v11/linkspackage root →"mode": "pnpm" - npm absent — pnpm owns OpenClaw, npm not present → no npm fallback
- No manager proven →
"mode": "unknown"with explicit reason - Duplicate installations — npm and pnpm copies exist, active root belongs to pnpm → pnpm selected
- Custom
globalDir/storeDir— non-default paths still detected correctly - Managed-service
honorPackageRoot— pnpm storenode_modulesdirectory never reclassified as direct npm root - End-to-end dry-run — without mocking
resolveGlobalManager, target preparation and displayed mode use the same ownership result
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jul 15, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 15, 2026, 6:20 AM ET / 10:20 UTC.
Summary
Current source still permits the reported misclassification: root ownership detection can remain unresolved while the CLI helper converts that result to npm. The linked closing PR remains open and addresses pnpm 11 link-store recognition but not the generic fallback, so this issue remains necessary pending PR review and a fallback-scope decision. citeturn5view1turn5view2turn6view4.
Reproducibility: yes. at source level: a pnpm 11 link-store root can miss affirmative ownership detection, and the CLI helper then converts the unresolved result to npm; the issue also supplies a concrete installed-path reproduction. citeturn5view1turn5view2.
Root-cause cluster
Relationship:
canonicalCanonical: #107746
Summary: This issue is the canonical pnpm 11 link-store report; its open PR is a partial candidate fix, while older pnpm updater reports concern earlier layouts or narrower symlink behavior.
Members:
fixed_by_candidate: fix(update): preserve pnpm and Bun global installs #107802 - The open PR explicitly targets this issue's pnpm 11 link-store ownership defect but does not resolve the generic npm fallback concern.partial_overlap: openclaw update: pnpm global installs not detected (mode: unknown) #20745 - It reports pnpm global ownership detection failure on an older pnpm virtual-store layout, but not the pnpm 11store/v11/linksshape or CLI npm fallback.adjacent_distinct: openclaw update SKIPPED for pnpm global installs due to symlink resolution bug #22768 - It concerned unresolved symlink comparison and was closed by a realpath fix, whereas this issue concerns a new link-store layout plus fallback behavior.adjacent_distinct: fix(update): preserve pnpm custom global root #78393 - The merged PR fixed custom pnpm global-root preservation for an older layout and supplies the ownership invariant relevant to this issue.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
Do not queue a second fix PR while #107802 remains the open closing candidate; maintainer review should scope that branch and the fallback contract.
Maintainer decision needed
Review details
Best possible solution:
Use one authoritative active-root ownership result across dry-run and execution, recognize verified pnpm 11 link-store installs, preserve their owning target, and make unresolved package ownership explicit without invoking a different manager after compatibility-safe caller updates.
Do we have a high-confidence way to reproduce the issue?
Yes at source level: a pnpm 11 link-store root can miss affirmative ownership detection, and the CLI helper then converts the unresolved result to npm; the issue also supplies a concrete installed-path reproduction. citeturn5view1turn5view2.
Is this the best way to solve the issue?
Partly: the linked PR is the narrowest immediate fix for the pnpm 11 layout, but the proposed generic unknown-mode change should be separated or explicitly approved because it changes a wider shipped fallback contract.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against c6adbd233b04.
Label changes
Label justifications:
P0: A supported pnpm 11 global installation can be routed to a nonexistent or non-owning npm command during the built-in update path, with manual terminal recovery required.impact:ux-release-blocker: The normal update flow can stop or split installations, and the available workaround requires direct package-manager commands plus a manual service restart.Evidence reviewed
What I checked:
resolveGlobalManagerasks the root detector, then presence detection, and finally returns npm when both are unresolved. citeturn5view1. (src/cli/update-cli/shared.ts:244, c6adbd233b04)src/infra/update-global.ts:27, c6adbd233b04)src/infra/update-runner.ts:1320, c6adbd233b04)src/infra/update-global.test.ts:261, c6adbd233b04)docs/install/index.md. (docs/install/index.md:55, c6adbd233b04)src/infra/update-global.ts, 2f27c497ec41)Likely related people:
src/infra/update-global.ts,src/infra/update-global.test.ts,src/infra/package-update-steps.ts)src/infra/update-global.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.