Skip to content

fix(update): recognize pnpm 11 group-local virtual stores as global installs - #202017

Merged
fuller-stack-dev merged 4 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-pnpm11-grouped-layout-detection
Nov 22, 2026
Merged

fuller-stack-dev merged 4 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-pnpm11-grouped-layout-detection

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

On pnpm 11, OpenClaw's own updater installs the new package into the group's local virtual store, with .pnpm directly under the group:

<PNPM_HOME>/global/v11/<group>/.pnpm/openclaw@<version>_…/node_modules/openclaw

A 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.ts only recognized the pnpm 12 form. A pnpm 11 install addressed by its real path was therefore classified as an unmanaged package-root, with three effects:

  • An update or Gateway update.run started with that root is refused (unmanaged-package-install).
  • Doctor and Control UI detection report the install as unmanaged.
  • The refreshed Gateway service definition pins the per-version <group>/.pnpm/openclaw@…/dist/… path (src/daemon/program-args.ts:81-99) instead of the stable <hash>/node_modules/openclaw entry. pnpm removes that directory on the next update.

Root Cause

inferPnpmProjectRoot (src/infra/update-global.ts) accepted only node_modules/.pnpm. For the pnpm 11 form it took the project to be <group>/.pnpm/openclaw@…, so it never reached the v11 global root.

Fix

The same matcher now accepts both <project>/node_modules/.pnpm/<pkg>/node_modules/openclaw and <project>/.pnpm/<pkg>/node_modules/openclaw. No second matcher was added. The .pnpm branch of inferPnpmGlobalRootFromPackageRoot already 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/openclaw path.

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

  • pnpm 11 global installs are recognized as pnpm installs when addressed by their real path.
  • After an update, the Gateway service definition names the stable entry, so the next update does not leave the service pointing at a removed directory.

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 the node_modules/.pnpm / .pnpm virtual store". The .pnpm case failed on the base ({kind: "package-root", mode: "unknown"}) and passes now. It covers detection, resolveUpdateInstallSurface and resolveTarget.
  • Negative controls in the same file, green:
    • an application image's app/.pnpm;
    • app/node_modules/.pnpm;
    • a stale v11 group with no active link and no lockfile, which stays unmanaged (removing the lockfile requirement turns it red);
    • the shared-store real path, which stays package-root;
    • npm and Bun globals, unchanged.
  • src/daemon/program-args.pnpm.test.ts, the systemd case over both virtual-store forms. The .pnpm case 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 no PNPM_HOME and the root set to the .pnpm real path. It passes on the base too, and fails if the /global/v\d+/ home marker is broken.

Checks:

  • touched and adjacent tests pass (node scripts/run-vitest.mjs);
  • pnpm tsgo:core and pnpm tsgo:core:test pass;
  • oxfmt and oxlint are clean, and both import-cycle checks report 0;
  • pnpm check:baseline-ratchets passes and git diff --check is 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 with pnpm add -g on pnpm 11.28.13. pnpm was pinned on PATH and at PNPM_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 plain openclaw update --tag <this head's package tarball> followed (head d80ed4b, labeled 2026.11.19-beta.2).

Result
openclaw update exit 0, ok, 155 s
openclaw --version OpenClaw 2026.11.19-beta.2 (d80ed4b)
Launcher exec node "${basedir_abs}"/../global/v11/9440847f…/node_modules/openclaw/openclaw.mjs
Gateway serving the new version, readyz true; gateway status --deep: running, connectivity ok
Service unit …/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@… directory
Schema agent/state 38/36 → 43/41 (migrated)
Outage (load probe) 78 s
Disk per directory (peak / left) pnpm home +1759 / +1095 MiB; captures +270 / 0 MiB; update temp +1180 / +670 MiB

Red and green through openclaw gateway install --force, pnpm 11.28.13

Same setup: published 2026.11.5, then an update onto main at this PR's merge base 1eacdff (red) or this head (green), then openclaw gateway install --force, openclaw gateway restart and openclaw gateway status --deep.

Service unit after the update Service unit after gateway install --force Gateway
Red, main 1eacdff $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 running, connectivity ok
Green, this head $PNPM_HOME/global/v11/9440847f…/node_modules/openclaw/dist/index.js $PNPM_HOME/global/v11/9440847f…/node_modules/openclaw/dist/index.js, unchanged and stable running, connectivity ok

Main's own updater already saves the stable entry. The defect is in the service-install path (gateway install --force and the program-args refresh). The 2026.11.7 backport cells show the same per-version path after gateway 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>.

  • With this head, the service unit stayed on the stable global/v11/9440847f…/node_modules/openclaw entry. openclaw --version printed 2026.11.19-beta.3, and the Gateway served with connectivity ok.
  • The second update itself exited 1 with update-recovery-pending: "Update has unfinished recovery; reconcile it before starting another update", with runtime-verification-failed recorded. 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, and src/infra/update-global.ts is 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) and release/2026.11.10 (#201740 merged with the current release tip). On each, the touched tests pass (45) and pnpm tsgo:core passes. It will be added to those backports as a separate commit after this PR has its final head.

Not proven

  • Windows. Real launchd, and systemd as PID 1: the cells used the harness's systemd user shim.
  • The Control UI half is not in this PR: a Gateway whose root is the pnpm 12 store-link real path is still classified 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

  • ClawSweeper round 1 (C / C / B) found that the pnpm11-grouped native-stage case built its launcher from the .pnpm entry, so it stayed green with the group link broken, and it also passed on the base. It is removed in ea871a4; 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.

…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.
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Nov 19, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Detection returns an unmanaged package root, and refreshed service arguments can retain the replaceable version directory.
  • After: Detection identifies pnpm ownership, and service arguments use the active hash link under /pnpm/global/v11.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct and valuable, but supplied tests and historical failure evidence do not satisfy the required after-fix runtime proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A pnpm 11 install can be reported as unmanaged, refuse updates, and save a service command that becomes invalid after package replacement.
Reason: The maintainer-authored PR restores existing supported update behavior with a small shared-resolver change and preserves the intentional shared-store ownership boundary.

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
Reviewed head: 159e4a5f187f499fa7911c2e67903054f630f44f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted logs or terminal recordings of the fixed build on a fresh pnpm 11.28.13 install and an upgrade from latest stable, showing pnpm detection, a stable saved service path, a working Gateway after another package replacement, and preserved settings and data; redact IPs, keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • pnpm project-root inference and durable service entrypoints keeps the original intent (d0dbb62: Recognize nested pnpm virtual stores and persist the active hash-link path so package replacement does not strand Gateway services.)
  • pnpm install ownership keeps the original intent (7a42bc7: Preserve install identity across managed package replacement without adopting foreign or inactive installations.)
  • launcher repair and native staging fixtures keeps the original intent (dbc1aa0: Keep the CLI and Gateway usable after pnpm updates by repairing staged launcher references and preserving service ownership.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d0dbb62 adds src/infra/update-global.ts:717 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d0dbb628ca4c; files: src/infra/update-global.ts)
  • Ayaan Zaidi: Raw commit 7a42bc7 adds src/infra/update-global.ts:1053 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7a42bc752137; files: src/infra/update-global.ts)
  • Jason (Json): Raw commit dbc1aa0 adds src/infra/update-launcher-repair.test.ts:18 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dbc1aa04e88f; files: src/infra/update-launcher-repair.test.ts)

PR surface

Source +1, Tests +129. Total +130 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 7 6 +1
Tests 4 209 80 +129
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 216 86 +130

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The observed pnpm 11 layout can prevent managed updates and leave service commands pointing into a directory removed by a subsequent update.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach the fixed-build pnpm 11 install and upgrade evidence described in the proof assessment.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 19, 2026, 2:46 PM ET / 19:46 UTC.

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.
fuller-stack-dev added a commit to fuller-stack-dev/openclaw that referenced this pull request Nov 22, 2026
…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.
fuller-stack-dev added a commit to fuller-stack-dev/openclaw that referenced this pull request Nov 22, 2026
…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.
@fuller-stack-dev
fuller-stack-dev merged commit e17201c into openclaw:main Nov 22, 2026
135 of 136 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/update-pnpm11-grouped-layout-detection branch November 22, 2026 08:02
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 23, 2026
…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.
tideclaw-bot pushed a commit that referenced this pull request Nov 23, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant