Repository navigation
fix(update): keep the openclaw command and Gateway working after a pnpm update - #201740
fuller-stack-dev wants to merge 17 commits into
Conversation
|
🦞👀 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: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
…Doctor cannot make
…ing form relocates
…ATH entries - Resolve pnpm shims from the physical bin directory whenever the shim defines basedir_abs, including the braced form the rewriter emits. - Keep the forward-slash pass for absolute paths in extensionless shims on Windows. - verifyRuntimeLauncher reports an unknown format from its single inspection; the swap turns it into a warning and fails a missing target. - The launcher repair scan skips FIFOs and other special files instead of blocking Doctor or Gateway startup on them. - Docs: automatic launcher repair is macOS and Linux only.
…ownership on the bytes repaired - The pre-stop guard refuses only launchers the swap publishes; another global package's shim in the staged bin directory no longer fails the OpenClaw update. - A shim resolves physically only when it assigns basedir_abs; a path that merely contains the name no longer switches an older lexical shim to the physical bin directory. - Launcher repair checks cmd-shim-target ownership on the same read it relocates, and leaves the launcher alone if it changed before the rename. - Doctor, Gateway and docs recovery commands use `pnpm add -g --allow-build=openclaw`.
…te launcher tests - A launcher rewritten in place (Doctor and Gateway repair) does not move with its directory, so the stage relocation now applies when the stage sits inside that directory, as with pnpm's home-level shim. The updater relocates between different directories and is unchanged. - Fold the apostrophe-in-stage finalize case into the quoted pnpm 12 layout, the FIFO case into the rewrite cases, the verification cases into one table and the service revalidation cases into one table. Drop the "recorded target missing" refusal: the ownership check now covers it the same way as "another installation". - Record the remaining 21 regression-test lines over the allowance.
…ery route on refusal - Move resolvePackageUpdateLauncherNames into the leaf module package-update-launcher-names.ts so the native stage no longer imports package-update-filesystem (madge cycle through the swap contract), and list it in the update-restart swap fixture and PR wrapper inventory. - Relocate absolute paths with a replacement callback, so `$'` and similar in a live path stay literal. - The pre-stop refusal names the direct pnpm reinstall, the Gateway reinstall and restart, and openclaw triage.
Real pnpm update onto this backport head: passesThe cell started from published
This hop migrates the schema. Published 2026.11.5 therefore hands the rest of the update to the new package (an Negative control. The same cell with the unpatched CI on this head. Note on disk: "peak extra disk" is the drop in free space on the Docker VM's shared filesystem, not a per-directory measurement of the install. Recordings (cell log streamed live, then a summary read from the raw cell files; host paths replaced with
bp-pnpm-2026.11.5-to-r10-c89a3ee.mp4
bp-pnpm-2026.11.5-to-r6tip-06afb10.mp4The full raw logs are not attached. GitHub's attachment route accepts only media, and the Crabbox artifact store rejects uploads from this machine. The decisive lines follow. This head: steps around the restart (raw
|
Published 2026.11.6 breaks pnpm installs on updateSetup: published
What 2026.11.5 prints at the end. Both commands it names fail, because the
|
Update: pnpm 11, and the 2026.11.4 startThese cells use the same setup as the comment above: published OpenClaw from the public registry, a plain
pnpm 11 users break the same way, and the same recovery works.
The 2026.11.4 start is the worse state, and the same three steps recover it with the data intact.
Recordings:
pub-pnpm11.28.13-2026.11.5-to-public-2026.11.6.mp4
pub-pnpm-2026.11.4-to-public-2026.11.6-recovery.mp4 |
…updater refuses the restart Shipped updaters 2026.11.4 through 2026.11.6 refuse the Gateway restart after a same-schema pnpm update (`service-revalidation-failed`) and leave the Gateway stopped. The verified recovery is `openclaw gateway install --force` followed by `openclaw gateway restart`; `gateway restart` alone fails while the service still names the previous store directory. One module decides that state: on macOS or Linux, the service this pnpm installation owns and may rewrite still names another version's package in the same pnpm home, and no other active global project uses it. - Doctor, run by such an updater, returns the pair as an update warning once it had to repair the launcher that updater published (the marker of a shipped driver); shipped updaters render it in their final report. - `openclaw update status` names the pair as the next step for a `service-revalidation-failed` run while the Gateway is not responding and its service is stopped. - `openclaw gateway status --deep` names it in the installation drift line while the service is stopped. - Both commands carry the reader's profile. - The update docs no longer claim that these updaters always hand the restart to the new package. Squashed from openclaw#203406.
…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.
… bits, from the shim's own base - Launcher repair leaves a launcher owned by another account unchanged and reports why (uid of the owner and of this account) through the existing failed-repair message, instead of replacing it with this account's file. - The replacement keeps permission bits only; setuid, setgid and sticky bits are never carried into a rewritten launcher. - Detection and relocation share one answer for the base a shim's `$basedir` resolves from (physical only when the shim defines `basedir_abs`), so a symlinked bin directory cannot make them disagree. - The update guide lists 2026.11.6 among the updaters that miss these steps and states the ownership rule.
… after activation A pnpm updater that a previous OpenClaw update installed runs from its group's project-local virtual store. Activating the next version moves that group into the transaction backup, so the running updater's own `dist` disappears. Work started inside the update loads workers through the retained-runtime generation, but process-wide owners that start workers from detached or earlier async contexts (the state lease heartbeat carrier, the file-log worker pool) still resolved them from the installed package. Their spawns failed with `Cannot find module`, the plugin lifecycle lease was lost, and the update unwound as `update-recovery-pending` while the new Gateway was already serving. The retained-runtime generation now also registers a process-wide resolver for as long as it is bound, and `createCpuTrackedWorker`, which every tracked worker spawn goes through, applies it. Async-context bindings keep precedence; nothing changes outside an update that retained its runtime. Release-line form of openclaw#203458; this line needs no type move.
…nly once A worker captured inside the generation was resolved again by the process-wide resolver at spawn time. The retained-runtime mapping is idempotent, but a generation's resolver need not be: the heartbeat generation test's wrapping resolver then imported itself and the worker never started (Bun shard timeout). A URL the generation already produced is now final.
|
Replaced by #205078, a single-commit port that applies cleanly to the current release/2026.11.10 head. |
What Problem This Solves
For a pnpm user: with this PR,
openclaw updateto 2026.11.10 leaves a workingopenclawcommand. Updates from 2026.11.5 or 2026.11.6 migrate the schema, so the Gateway also restarts by itself; this was verified from 2026.11.5. A same-schema hop, such as one from 2026.11.10-beta.1, leaves the Gateway stopped. The user then runsopenclaw gateway install --forceand thenopenclaw gateway restart; the update output,openclaw update statusandopenclaw gateway status --deepall name these two commands.Fixes: after
openclaw updateon a pnpm install (pnpm add -g openclaw), theopenclawcommand fails withCannot find module …/.openclaw-update-native-…/openclaw.mjsand the Gateway can stay stopped.This backports #201735 to
release/2026.11.10. It is a proposal for the release owner. Published 2026.11.10-beta.1 does not contain the fix.User Impact
What a pnpm user gets when they update to a 2026.11.10 build from this branch:
openclawcommand keeps working. The installed updater still publishes a launcher that points into its removed update stage, and this package's Doctor repairs it during the same update.service-revalidation-failed), as it did on every same-schema hop on the 2026.11.7 line (fix(update): keep the openclaw command and Gateway working after a pnpm update #203401). There,openclaw gateway install --force, thenopenclaw gateway restartbrought the Gateway back.openclaw gateway restartalone does not work.Why This Change Was Made
This carries the #201735 change (the same commits as before) plus merges of the current
release/2026.11.10tip. It does the following:The fingerprint, name, profile and manager-UID ownership checks are unchanged.
Update behavior: the fix runs when this package is the updater, the Doctor or the Gateway. Updates driven by an installed 2026.11.6 or older updater get the Doctor launcher repair, plus the Gateway restart on schema-migrating hops.
Commits added on top
4b7f50a: cherry-pick of fix(ci): keep launcher repair helper internal #201816, which keeps the launcher repair helper internal.a5e3cd7: the true-instructions change from fix(update): name the working Gateway recovery after a shipped pnpm updater leaves it stopped #203406, squashed. On a same-schema hop, Doctor reports "If this updater leaves the Gateway stopped, runopenclaw gateway install --forceand thenopenclaw gateway restart." during the update, andopenclaw update statusandopenclaw gateway status --deepname that pair afterwards. The docs no longer claim that shipped updaters always hand the restart over. Its real cells ran on the 2026.11.7 line (fix(update): keep the openclaw command and Gateway working after a pnpm update #203401 and fix(update): name the working Gateway recovery after a shipped pnpm updater leaves it stopped #203406); it applies here unchanged.6a73e3f: pnpm 11 layout detection from fix(update): recognize pnpm 11 group-local virtual stores as global installs #202017, squashed.88bc1e4: launcher-repair hardening from fix(update): repair only this account's pnpm launcher and never keep set-ID bits #203447. The repair touches only a launcher owned by the current account, never keeps set-ID bits, and uses the same base for detection and relocation; the docs now list 2026.11.6.1d30fa2and66e2acd: the second-update fix from fix(update): a pnpm update no longer fails after activating when the updater itself was installed by an update #203458. On pnpm, an update run by an updater that an earlier update installed no longer fails after activating withupdate-recovery-pending. That failure happened because detached workers were still started from the package activation had just moved away. Without this commit, the first pnpm update after this release would fail falsely, and every later update would be refused.On head
6a73e3f, the touched and added tests pass (launcher, relocation, stage, swap, filesystem, service install root, Gateway startup, true-instructions,doctor-health-startup,status.gather, program-args and pnpm owner), along withtsgo:coreandtsgo:core:test. Both import-cycle checks report 0, and the baseline ratchets pass in release context. The release tip has since moved to00f7ee6with a single UI test change. I merged the tip once before the final cell and did not merge again.Evidence
Real pnpm update onto this head
Published
[email protected]was installed from the public registry withpnpm add -g(pnpm 12.21.0). 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, 2026.11.10-beta.2>followed.openclaw updateok, 143 sopenclaw --versionOpenClaw 2026.11.10-beta.2 (c979fec)exec node "${basedir_abs}"/../global/v11/926ea0a5…/node_modules/openclaw/openclaw.mjsopenclaw gateway status --deep: connectivity ok…/store/v11/links/@/openclaw/2026.11.5/…→…/global/v11/926ea0a5…/node_modules/openclaw/dist/index.jsNo recovery command was needed. Recording:
r10-pnpm12-2026.11.5-to-r10-c979fec.mp4
Full raw logs are not attached, because the artifact store rejected uploads from the test host.
Checks
Run on
2d90bc4, the first tip merge;c979fecadds the next tip, a single CI test file. The pack ran onc979fecas well.node scripts/run-vitest.mjspasses on the launcher repair, runtime relocation, native stage, allpackage-update-swap*, package filesystem, service install root, Gateway startup plugin, update-restart module outcome and eager import closure tests.pnpm tsgo:core,tsgo:core:test,tsgo:extensions:testandtsgo:test:rootpass.pnpm check:import-cyclesandpnpm check:madge-import-cyclesreport 0 cycles.pnpm check:baseline-ratchetspasses in release context.runtime-postbuild. The earlier compatibility-inventory pack failure came from the release tip, and it is gone on the current tip.c979fec,checks-fast-baseline-ratchetswas stopped after 46 minutes in "Run baseline ratchets", with no log retained. The same lane passes locally in about 3 minutes, and fix(update): keep the openclaw command and Gateway working after a pnpm update #203401 passed it in CI. The same hang hit fix(update): recognize pnpm 11 group-local virtual stores as global installs #202017 once, and its next run passed. This is attributed to the runner; the new head re-runs it.cachesInstructionstype error and a runner download failure). Both are gone after the merge: the type lanes above pass locally on this head.Not proven
An install already stranded by the second-update failure on an unfixed build is not cleared by this branch; see fix(update): a pnpm update no longer fails after activating when the updater itself was installed by an update #203458.
Launcher-repair hardening (fix(update): repair only this account's pnpm launcher and never keep set-ID bits #203447) is unit-proven only. A root-run repair against another account's launcher on a real host was not run.
A fixed version installed from a registry. The target was this head's tarball offered with
--tag, in the same project-store layout as a registry target.Windows. Automatic launcher repair is macOS and Linux only.
Real launchd, and systemd as PID 1. The cells used the harness's systemd user shim.
autoreviewdoes not run on this machine.