Repository navigation
fix: let Git updates build when pnpm uses a global virtual store - #205010
Conversation
…ual store Pin virtualStoreType to project in the workspace. The build's declaration guard requires dependencies physically inside the checkout, and the updater installs and builds the target tree under the host's user pnpm config.
|
🦞👀 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. |
✅ Dependency graph changes approvedA repository admin or SecOps member approved this revision with an explicit dependency approval comment.
A later push requires a fresh approval comment unless the author is a repository admin or SecOps member. |
|
Codex review: blocked before merge. What this changesPins pnpm’s project virtual store so source builds and Git update candidates keep dependencies inside their checkout. Example: A host uses pnpm 12.15 with user configuration virtualStoreType: global.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR fixes a current source-build and Git-update failure with a focused workspace setting; no actionable patch defects were found, and enforced current-head approvals remain outstanding. Reviewed head: Before merge
FindingsNone. Agent review detailsHow this fits togetherGit update preparation installs and builds a target worktree; its pnpm workspace configuration determines dependency placement before the declaration guard validates compiler inputs. flowchart TD
A[Host pnpm configuration] --> C[Candidate pnpm install]
B[Target workspace configuration] --> C
C --> D[Project dependency store]
D --> E[Declaration input guard]
E --> F[Built update release]
Technical reviewBest possible solution: Merge the workspace-level repair after the enforced approvals, retaining updater compatibility for older targets and the separately tracked environment override follow-up. Do we have a high-confidence way to reproduce the issue? The inherited pnpm configuration and declaration guard establish the failure path in current source, corroborated by supplied macOS build and Linux updater red/green results; no target code was executed during this review. Is this the best way to solve the issue? Pinning the existing pnpm setting in the target workspace is the smallest repair that reaches both already-installed release updaters and direct source builds while preserving compiler-input isolation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7ff72b54d93a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +13, Docs +5, Config +3. Total +21 across 4 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:
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 HistoryReview history (1 earlier review cycle)
Reviewed November 24, 2026, 9:58 PM ET / November 25, 2026, 02:58 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Requesting a dependency review from obviyus. The dependency guard holds this PR because it touches virtualStoreType: projectIt makes pnpm keep the virtual store inside the checkout even when the host's user pnpm config enables a global one. Without it, a Git-channel Head is |
|
/allow-dependencies-change |
…5010) * fix: build Git updates when the user's pnpm config uses a global virtual store Pin virtualStoreType to project in the workspace. The build's declaration guard requires dependencies physically inside the checkout, and the updater installs and builds the target tree under the host's user pnpm config. * test: keep installs inside the checkout when user pnpm config selects a global store (cherry picked from commit 4afbe0b) Co-authored-by: vincentkoc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
…5010) * fix: build Git updates when the user's pnpm config uses a global virtual store Pin virtualStoreType to project in the workspace. The build's declaration guard requires dependencies physically inside the checkout, and the updater installs and builds the target tree under the host's user pnpm config. * test: keep installs inside the checkout when user pnpm config selects a global store (cherry picked from commit 4afbe0b) Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
…nclaw#205010) * fix: build Git updates when the user's pnpm config uses a global virtual store Pin virtualStoreType to project in the workspace. The build's declaration guard requires dependencies physically inside the checkout, and the updater installs and builds the target tree under the host's user pnpm config. * test: keep installs inside the checkout when user pnpm config selects a global store
* fix(update): let a Git release install switch back to its npm package The npm package an npm-to-Git switch leaves forwarding to the Git release launcher (#200578) is this installation's own, but the update executor refused to reserve it ('Occupied slot does not resolve to its original installation') and package activation refused to publish into it, so openclaw update --channel stable on a Git release install always failed. Refs #200578 * fix(update): settle a switch-back publication with the package's own authority The post-update continuation compared the publication's recorded authority (keyed by the reserved npm package) with the executor's installation authority, so a completed switch back from Git reported 'Package publication recovery is pending'. One helper now gives both package activation and its continuation the authority this executor publishes at a root. Refs #200578 * fix(update): key a Git-to-package switch by its package destination Drops the executor slot and publication-authority changes: the post-core continuation runs the installed target, whose executor authority is the parent's install lease, so the lease itself must be the npm package for every published target to accept the recorded publication. Refs #200578 * fix(update): rebind the Git install's Gateway service after a switch to its package The package-root executor admission moves to the package-activation module so the switch can admit the package destination after its inspection. Refs #200578 * fix(update): leave the Git install's Gateway service to its owner on a switch to its package A Git release service definition is not refreshable here (service-definition-not-writable), so the rebind attempt refused the whole switch. The service stays on the Git release with the existing skip warning; rebinding it is a maintainer decision. Refs #200578 * test(update): key a Git-to-npm switch by its package destination before npm has a copy Refs #200578 * test(update): prove a Git-to-npm switch reserves its package destination through target resolution Through resolveUpdateCommandTarget and a real executor: on base the package swap's reservation refuses with 'Occupied slot does not resolve to its original installation.' (forwarding package) or ENOENT realpath (no npm copy); both pass with the destination-keyed admission. Replaces the executor-only case. Refs #200578 * fix(update): rebind the managed Gateway when switching back to npm Co-authored-by: RomneyDa <[email protected]> * fix: let a Git install switch back to the npm package Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: ecdf2764-e5c4-8a1b-b3be-ed34bfd6646e --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 152254c) Release adaptation: Admit an inspected empty npm destination as the primary install root, while keeping the checkout lease for existing targets and acquiring it before restoring any interrupted npm link. Retain the stable writable-service and ownership checks, using the existing split-root rebind and recovery owners. Adapt regressions to a legacy checkout; do not import #200578 or its launcher/forwarder fixtures. Follow-ups: 4afbe0b (#205010) changes pnpm virtual-store behavior and documents it separately; not required for the npm lease or service recovery. No later production code touches. Co-authored-by: RomneyDa <[email protected]>
Related: #204775
What Problem This Solves
openclaw updateon a Git (source checkout) install stops atstaging: prepare:buildwith "The new version could not be built. The current version is still running." whenever the host's user-level pnpm config setsvirtualStoreType: global(pnpm 12). The Gateway keeps serving the old build, and every later update fails the same way. A plainpnpm install && pnpm buildin a checkout on such a host fails too.Root cause:
pnpm-workspace.yamlpinsnodeLinker: isolatedbut not the virtual store type, so pnpm takesglobalfrom the user config and linksnode_modules/typescript(and every other dependency) into the shared store under the user's home. The build's declaration-input guard (scripts/lib/local-check-runtime.mts, used byscripts/lib/tsdown-declaration-boundary.mts) requires compiler inputs to sit physically inside the checkout and rejects it:Declaration input escapes checkout: … shared installs and external symlinks are unsupported. The older Git runner wrotevirtualStoreType: projectinto the candidate's workspace file (src/infra/update-runner-git-commands.ts). The release-based pathsrc/update/prepare-git.tsrunspnpm install --frozen-lockfileandpnpm buildin a worktree of the target commit with the Gateway's environment and no store setting, so the user config wins.User Impact
virtualStoreType: globalin their user pnpm config get a project-localnode_modules/.pnpmin OpenClaw checkouts instead of links into the global store. The first install after this change relinks into the checkout, and pnpm may ask to remove and reinstallnode_modules. That uses more disk per checkout, but it is the only layout the build accepts.pnpm install --frozen-lockfileaccepts the existing lockfile; the setting is not recorded in it.Why This Change Was Made
The installed updater cannot be patched, but it installs and builds inside the target tree, so the target's own
pnpm-workspace.yamlreaches it. One line there,virtualStoreType: projectnext tonodeLinker: isolated, fixes the update path and plain source builds together. Relaxing the declaration guard was not an option, because the guard protects build correctness.Update behavior: this reaches already-installed updaters, because they install and build the target commit inside its own tree. The first update toward a commit that contains this line succeeds; an update toward an older target still fails safely, as before (Gateway keeps serving, nothing activated). No migration and no Doctor change.
Scope notes:
src/update/prepare-git.tsstill does not applyresolvePnpmCandidateEnv(src/infra/update-package-manager.ts). That belongs to the update stream's owner and is tracked on Design: prepared-release updates (state, ownership and plan) #204775. It matters for one case this PR does not cover: pnpm 12.15 gives the environment variablepnpm_config_virtual_store_type=globalprecedence over the workspace file (measured below), so a Gateway that exports that variable still builds with the global store.virtualStoreType: projectis kept. It is now redundant for targets that contain this line but still covers dev and preflight candidates whose target predates it, and it also setsvirtualStoreDir.Audit:
pnpm-workspace.yaml: CI setup and crabbox hydration set onlystore-dir/virtual-store-dir;dependency-fingerprint.mjshashes the file (one cache miss);check-dependency-pins.mtsreads only overrides and package extensions;scripts/worktree-setup.mjsonly checks the file exists. None asserts the store type.test/scripts/baileys-materialization.test.tswritesvirtualStoreType: globalinto its own fixture workspace and env after reading the repo file, so it is unaffected (passes on the head).CONTRIBUTING.md(source dependency layout) anddocs/install/updating/update-methods.md(candidate builds) now state that the workspace pins the project store.Evidence
Tested commits: base
ddc83401337(red), PR headac2ec1ef7a7for the direct green and update cell G2. The branch was then rebased onto4f873f44066(head4dd5ed51ab5). That movement changes only a Swift test and drops oneexportkeyword insrc/state/state-upgrade-tree.ts; neither touches installs, the workspace file or the declaration guard, so the proofs were not rerun.1. Direct build, macOS, user pnpm config
virtualStoreType: global, no environment overridesFresh worktree each time,
pnpm install --frozen-lockfile && pnpm build, pnpm 12.15.0 from thepackageManagerpin.ddc83401337:pnpm config get virtualStoreType=global;node_modules/typescript->../../../../../Library/pnpm/store/v11/links/@/typescript/…; install exit 0, build exit 1 intsdown-ai:ERROR Error: Declaration input escapes checkout: ~/Library/pnpm/store/v11/links/@/typescript/7.1.0-dev.20261028.1/…/node_modules/typescript/package.json … shared installs and external symlinks are unsupported.ac2ec1ef7a7:pnpm config get virtualStoreType=project;node_modules/typescript->.pnpm/[email protected]/node_modules/typescript; install exit 0, build exit 0 (total 3m 21.8s).gugs-direct-red.mp4
gugs-direct-green.mp4
2. Update cell, Linux Docker (real systemd user Gateway), installed updater from base x candidate
Each cell: Git install cloned from a local upstream at
ddc83401337, built withpnpm build:runtime, managed Gateway viaopenclaw gateway install, a Gateway-gated SQLite writer probing during the run. Then~/.config/pnpm/config.yamlgetsvirtualStoreType: global(written after the install was built, since the base itself cannot build under it), upstreammainmoves to the target, andopenclaw update --yes --jsonruns.688aa5d60c8:status=failed reason=build-failed;nextAction: The new version could not be built. The current version is still running.; stepsprepare:install=completed, prepare:build=failed(tsdown-ai failed after 6.15s, stack frames under~/.local/share/pnpm/store/v11/links/…); process exit 1 after 40 s. Serving build before and after:2026.11.8-ddc834013375-…,readyztrue, systemdNRestarts=0; writer 217 probes, 0 failed, no outage.ac2ec1ef7a7:status=succeeded, steps throughprepare:build=completed, validating, activating, restarting; process exit 0 after 350 s. Serving build after:2026.11.8-ac2ec1ef7a78-…,readyztrue, release link moved to the new release, whosepnpm-workspace.yamlhasvirtualStoreType: projectand whosenode_modules/typescript->.pnpm/typescript@…. The writer saw one 12.3 s outage, during the planned restart onto the new build (NRestarts=1).ddc83401337, same user config: install exit 0, typescript linked intopnpm-home/store/v11/links/…, build exit 1 withERROR Error: Declaration input escapes checkout: /home/appuser/um/pnpm-home/store/v11/links/@/typescript/…. This confirms the R1 build failure is the same guard on Linux. (The R1 ledger keeps only the tail of the build output.)847eb181a24(same workspace change, no test/docs) also succeeded.gugs-cell-red-R1.mp4
gugs-cell-green-G2.mp4
The cell recordings replay the decisive raw lines from each cell's own step outputs; the direct recordings are live with idle time compressed. Full raw logs are not attached; the decisive lines are above.
Published stable driver x candidate (installed updater from
v2026.11.9)Tested: installed
v2026.11.9(0032b1d7ffd); targets currentmain4a180835802(S-main) and PR head4dd5ed51ab5(S-head). Same Linux Docker harness with a real systemd user Gateway, one fresh container per cell. The source mirror has history back to 2026-10-25, so the release branch (forked from main at9559c51dd05) connects to both targets.Install, as the
v2026.11.9install docs describe for a server checkout: Git checkout detached at the tag,pnpm install --frozen-lockfile && pnpm build:runtime,pnpm add --global "openclaw@link:$PWD",openclaw gateway install --force, configupdate.channel: dev. State: a Gateway-gated writer filling the agent database to 331 MiB and probing/readyzevery 250 ms. A separate table holds 1,000 marker rows with a known SHA-256.ui.seamColoris set to#5a17d0with the installed CLI (openclaw config set ui.seamColor '"#5a17d0"'). Then~/.config/pnpm/config.yamlgetsvirtualStoreType: global, upstreammainmoves to the target, and the installed CLI runsopenclaw update --yes --json --channel dev.4a180835802)4dd5ed51ab5)openclaw updateresultstatus=ok, runsucceeded, exit 0status=ok, runsucceeded, exit 0/readyzevery 250 ms)2026.11.9-0032b1d7ffd0-…2026.11.9-0032b1d7ffd0-…2026.11.9-4a180835802d-…,readyztrue2026.11.8-4dd5ed51ab55-…,readyztrueui.seamColorafter#5a17d0#5a17d069cb2f125f43dd66…,quick_check=okquick_check=oknode_modules/typescriptin the installed tree.pnpm/[email protected]/…, resolves inside the treepnpm-workspace.yamlvirtualStoreTypekey (main has none), file matchesHEADvirtualStoreType: project(line 43), file matchesHEADmainat target,git status --porcelainemptymainat target,git status --porcelainemptyDecisive raw lines (S-head; S-main matches except where the table differs):
What this shows: the stable driver already builds under a global user store, because its own candidate preparation writes
virtualStoreType: projectinto the preflight worktree. This PR neither breaks nor changes that. With the PR's line already in the target file, that write replaced the existing key: the final file has one key, matchesHEAD, and no workspace backup is left behind. The cell is a no-regression control, not a red/green pair. The stable driver had no failure to fix here.Observations that are the same in both directions, so they do not come from this PR:
git-import-admitted-target, 4.98 GB pack) inside that window. The cell's upstream borrows objects from a shallow mirror, so the import is probably larger here than on an ordinary clone. Not measured on one.ExecStartfrom<checkout>/dist/index.jsto the pnpm global link path of the same package (it served the target build).2026.11.8because its base predates main's version bump; the dev channel accepted it.stable-driver-S-main.mp4
stable-driver-S-head.mp4
3. Regression test
test/scripts/pnpm-install-isolation.test.tsalready runs real pnpm 12 offline in a private HOME. It now copiesvirtualStoreTypefrom the repo's workspace file, writesvirtualStoreType: globalinto the fixture's private user pnpm config, and asserts each installed package file resolves inside its checkout (the guard's requirement), in addition to the existing cross-checkout isolation checks.ddc83401337(workspace without the line):AssertionError: expected '../store/v11/links/@/isolation-fixtur…' not to match /^\.\./u.pnpm_config_virtual_store_type=globalbeats the workspace setting. The test covers user config only.Checks (head
ac2ec1ef7a7, rebased content identical)git diff --check: clean.pnpm check:docs: pass.node scripts/run-vitest.mjs test/scripts/pnpm-install-isolation.test.ts test/scripts/baileys-materialization.test.ts: 2 passed.pnpm changed:lanes --json:all(root config surface).node scripts/check-changed.mjs: typecheck all, format, dependency pin, package-lock, config docs and the other guards pass. Two failures, both in files this PR does not touch: fulllint(eslint(max-lines)in about 25 untouched files) and the dead-export scan (src/state/state-upgrade-tree.ts: skipEntry, fixed on main by fix(ci): remove unused state upgrade export #204988, now in the base).Not proven
pnpm_config_virtual_store_type=global(see scope notes).Review
One independent reviewer read the diff and the raw evidence. Its findings, all addressed: extend the existing pnpm isolation test instead of adding none (done); the update-methods doc wording (done); the env-variable precedence gap (measured and documented above).
$autoreviewdoes not run on this machine.