Repository navigation
fix(update): recognize pnpm 11 group-local virtual stores as global installs - #202017
Conversation
…nstalls pnpm 11 puts the updater's project-local virtual store at <group>/.pnpm, not <group>/node_modules/.pnpm. Project inference missed that form, so a pnpm 11 install addressed by its real path was classified as an unmanaged package root and its refreshed service pinned the per-version .pnpm path that the next update removes.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR recognizes pnpm 11 group-local virtual stores so updates identify the owning global install and service definitions retain its stable package link. Example: pnpm 11.28.13 installs OpenClaw 2026.11.6 at /pnpm/global/v11/group-a/.pnpm/[email protected]/node_modules/openclaw.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a concrete pnpm 11 detection defect still present on main, and the implementation preserves existing ownership checks; no actionable code defect was found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared update resolver consumes package paths and pnpm project metadata, then supplies install ownership and stable package paths to update planning and service argument generation. flowchart TD
A[Running package path] --> B[Project root inference]
B --> C[Active pnpm project lookup]
C --> D[Update install classification]
C --> E[Stable package link]
E --> F[Gateway service arguments]
Technical reviewBest possible solution: Retain the focused extension of the existing project-root resolver and its ownership checks. Do we have a high-confidence way to reproduce the issue? The reported real pnpm 11 layout reaches the defective matcher on current main, and the PR records base failures for detection and persisted service-path regressions; no target code was executed during this review. Is this the best way to solve the issue? The change repairs the shared producer of project identity, allowing existing update and service consumers to benefit without duplicate policy or a new configuration option. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 24006ea30ec3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +129. Total +130 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 19, 2026, 2:46 PM ET / 19:46 UTC. |
…uped-layout-detection
The pnpm 11 grouped stage case built its launcher from the `.pnpm` entry, so breaking the group link left it green, and it passed on the base as well: the stage does not use the inference this PR changes. The layout is covered by the detection, service-path and launcher-repair cases.
…uped-layout-detection
…nstalls pnpm 11.28 installs a global package into `<group>/.pnpm/...`; layout inference accepted only `<group>/node_modules/.pnpm/...`, so such an install was classified as an unmanaged package root and the refreshed service definition pinned the per-version directory pnpm removes on the next update. Squashed from openclaw#202017.
…nstalls pnpm 11.28 installs a global package into `<group>/.pnpm/...`; layout inference accepted only `<group>/node_modules/.pnpm/...`, so such an install was classified as an unmanaged package root and the refreshed service definition pinned the per-version directory pnpm removes on the next update. Squashed from openclaw#202017.
|
Merged via squash.
|
…nstalls (openclaw#202017) * fix(update): recognize pnpm 11 group-local virtual stores as global installs pnpm 11 puts the updater's project-local virtual store at <group>/.pnpm, not <group>/node_modules/.pnpm. Project inference missed that form, so a pnpm 11 install addressed by its real path was classified as an unmanaged package root and its refreshed service pinned the per-version .pnpm path that the next update removes. * test(update): drop the grouped stage case that passes without the change The pnpm 11 grouped stage case built its launcher from the `.pnpm` entry, so breaking the group link left it green, and it passed on the base as well: the stage does not use the inference this PR changes. The layout is covered by the detection, service-path and launcher-repair cases.
…nstalls (#202017) * fix(update): recognize pnpm 11 group-local virtual stores as global installs pnpm 11 puts the updater's project-local virtual store at <group>/.pnpm, not <group>/node_modules/.pnpm. Project inference missed that form, so a pnpm 11 install addressed by its real path was classified as an unmanaged package root and its refreshed service pinned the per-version .pnpm path that the next update removes. * test(update): drop the grouped stage case that passes without the change The pnpm 11 grouped stage case built its launcher from the `.pnpm` entry, so breaking the group link left it green, and it passed on the base as well: the stage does not use the inference this PR changes. The layout is covered by the detection, service-path and launcher-repair cases. (cherry picked from commit e17201c) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit bdeff7f6b4fc7cc037d2da6b63a485de185ddd33) (cherry picked from commit 99c8988f15fab893e7c77bb52f29439d2472d3f1)
What Problem This Solves
On pnpm 11, OpenClaw's own updater installs the new package into the group's local virtual store, with
.pnpmdirectly under the group:<PNPM_HOME>/global/v11/<group>/.pnpm/openclaw@<version>_…/node_modules/openclawA real pnpm 11.28.13 cell (published 2026.11.5 → plain
openclaw update→ public 2026.11.6) produced exactly that layout. pnpm 12 uses<group>/node_modules/.pnpm/….pnpm layout inference in
src/infra/update-global.tsonly recognized the pnpm 12 form. A pnpm 11 install addressed by its real path was therefore classified as an unmanagedpackage-root, with three effects:update.runstarted with that root is refused (unmanaged-package-install).<group>/.pnpm/openclaw@…/dist/…path (src/daemon/program-args.ts:81-99) instead of the stable<hash>/node_modules/openclawentry. pnpm removes that directory on the next update.Root Cause
inferPnpmProjectRoot(src/infra/update-global.ts) accepted onlynode_modules/.pnpm. For the pnpm 11 form it took the project to be<group>/.pnpm/openclaw@…, so it never reached thev11global root.Fix
The same matcher now accepts both
<project>/node_modules/.pnpm/<pkg>/node_modules/openclawand<project>/.pnpm/<pkg>/node_modules/openclaw. No second matcher was added. The.pnpmbranch ofinferPnpmGlobalRootFromPackageRootalready runs the isolated-root check first, so it needed no change.resolvePnpmGlobalInstallOwner, which the program-args refresh uses, now finds the active entry, and the saved service definition names the stable<hash>/node_modules/openclawpath.rewritePnpmVersionedOpenClawEntryPath(src/infra/openclaw-root.ts:10-19) is unchanged. For grouped layouts it can only yield the per-group<group>/node_modules/openclaw, which is not stable on pnpm 12 either. The stable entry comes from the argv launcher root and the owner lookup.The shared-store guard is kept. A real path inside the shared content store,
store/v11/links/@/openclaw/<v>/<hash>/node_modules/openclaw, still does not count as the install owner, and a test now asserts this with that realistic path.User Impact
Update behavior: this is a fix in the new package's own detection. It applies when this code is the running updater, Gateway or Doctor. Shipped updaters keep their behavior.
Evidence
Each unit case was red on the base where marked, then green:
src/infra/update-global.bun-owner.test.ts, "detects a pnpm v11 install by its real path in thenode_modules/.pnpm/.pnpmvirtual store". The.pnpmcase failed on the base ({kind: "package-root", mode: "unknown"}) and passes now. It covers detection,resolveUpdateInstallSurfaceandresolveTarget.app/.pnpm;app/node_modules/.pnpm;v11group with no active link and no lockfile, which stays unmanaged (removing the lockfile requirement turns it red);package-root;src/daemon/program-args.pnpm.test.ts, the systemd case over both virtual-store forms. The.pnpmcase failed on the base with ENOENT, because the saved entry pointed at the removed per-version directory. Now the saved path is<hash>/node_modules/openclaw, and after the old group is deleted it still resolves to the replacement version's files. The test reads the files through the saved path; it does not start the service.src/infra/update-launcher-repair.test.ts, a pnpm 11.28.13 shim captured from the real cell, with noPNPM_HOMEand the root set to the.pnpmreal path. It passes on the base too, and fails if the/global/v\d+/home marker is broken.Checks:
node scripts/run-vitest.mjs);pnpm tsgo:coreandpnpm tsgo:core:testpass;pnpm check:baseline-ratchetspasses andgit diff --checkis clean.Real-cell evidence of the pnpm 11 layout and the shipped failure: #201739 (comment)
Real pnpm 11 update onto main with this commit
Published
[email protected]was installed from the public registry withpnpm add -gon pnpm 11.28.13. pnpm was pinned on PATH and atPNPM_HOME/bin/pnpm, which the updater prefers. The Gateway ran as a managed service under the harness's systemd user shim, with a 256 MiB agent database and a busy writer. A plainopenclaw update --tag <this head's package tarball>followed (headd80ed4b, labeled 2026.11.19-beta.2).openclaw updateok, 155 sopenclaw --versionOpenClaw 2026.11.19-beta.2 (d80ed4b)exec node "${basedir_abs}"/../global/v11/9440847f…/node_modules/openclaw/openclaw.mjsgateway status --deep: running, connectivity ok…/store/v11/links/@/openclaw/2026.11.5/…→$PNPM_HOME/global/v11/9440847f…/node_modules/openclaw/dist/index.js, the stable entry rather than the per-version<group>/.pnpm/openclaw@…directoryRed and green through
openclaw gateway install --force, pnpm 11.28.13Same setup: published 2026.11.5, then an update onto main at this PR's merge base
1eacdff(red) or this head (green), thenopenclaw gateway install --force,openclaw gateway restartandopenclaw gateway status --deep.gateway install --force1eacdff$PNPM_HOME/global/v11/9440847f…/node_modules/openclaw/dist/index.js$PNPM_HOME/global/v11/71b-…/.pnpm/openclaw@file+…[email protected]/node_modules/openclaw/dist/index.js, the per-version directory pnpm replaces on the next update$PNPM_HOME/global/v11/9440847f…/node_modules/openclaw/dist/index.js$PNPM_HOME/global/v11/9440847f…/node_modules/openclaw/dist/index.js, unchanged and stableMain's own updater already saves the stable entry. The defect is in the service-install path (
gateway install --forceand the program-args refresh). The 2026.11.7 backport cells show the same per-version path aftergateway install --force(#203401).Recordings, red then green:
lay-pnpm11-force-install-main-1eacdff.mp4
lay-pnpm11-force-install-lay-d80ed4b.mp4
A second update from that state
After the first update, the cell relabeled the same build 2026.11.19-beta.3 and ran
openclaw update --yes --json --tag <it>.global/v11/9440847f…/node_modules/openclawentry.openclaw --versionprinted2026.11.19-beta.3, and the Gateway served with connectivity ok.update-recovery-pending: "Update has unfinished recovery; reconcile it before starting another update", withruntime-verification-failedrecorded. That happens identically on main's merge base, so it does not come from this PR. It is a separate finding about a fixed-to-fixed same-schema update, possibly helped along by the cell's relabeling, and it is reported separately.Recordings, head then base:
lay-pnpm11-2026.11.5-to-lay-d80ed4b-then-next.mp4
lay-pnpm11-2026.11.5-to-main-1eacdff-then-next.mp4
Full raw logs are not attached, because the artifact store rejected uploads from the test host. The cells ran on
d80ed4b; the head since adds only the test removal below and main merges, andsrc/infra/update-global.tsis unchanged.Recording:
lay-pnpm11-2026.11.5-to-lay-d80ed4b.mp4
Cherry-pick for the release line
This is one self-contained commit. It applies cleanly onto
release/2026.11.6(stacked on #201739) andrelease/2026.11.10(#201740 merged with the current release tip). On each, the touched tests pass (45) andpnpm tsgo:corepasses. It will be added to those backports as a separate commit after this PR has its final head.Not proven
package-root. That is a separate PR at the Gateway's root owner, because it has to handle several global groups linking the same store directory.Steps left to a person
None for this change.
Review notes
pnpm11-groupednative-stage case built its launcher from the.pnpmentry, so it stayed green with the group link broken, and it also passed on the base. It is removed inea871a4; the detection, service-path and launcher-repair cases cover the layout. It also asked for an accurate description of the systemd case, which the Evidence section now gives.