Skip to content

fix: keep the openclaw command and Gateway working after updating a pnpm install - #201735

Merged
fuller-stack-dev merged 11 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-pnpm-package-update-keeps-cli-and-gateway
Nov 19, 2026
Merged

fuller-stack-dev merged 11 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-pnpm-package-update-keeps-cli-and-gateway

Conversation

@fuller-stack-dev

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

Copy link
Copy Markdown
Member

What Problem This Solves

When OpenClaw was installed with pnpm (pnpm add -g openclaw), a plain openclaw update could leave the machine with no openclaw command and no Gateway. This was measured in real Docker cells updating published 2026.11.4 to published 2026.11.5 with pnpm 11.28.13, 12.15.0 and 12.21.0:

  • The live launcher pointed into the update's temporary stage directory, which no longer existed, so every openclaw command failed with Cannot find module .../.openclaw-update-native-XXXXXX/.../openclaw.mjs. On 12.15.0 the update even reported success.
  • On pnpm 11.28.13 and 12.21.0 the Gateway restart was then refused with managed-service-ownership (service-ownership-changed). The Gateway stayed down after the databases had been migrated (state-migrated-no-rollback).

User Impact

User impact: pnpm-managed installs update to a working CLI and a Gateway serving the new version. If the published launcher still cannot start the new package after repair, the update fails and the transaction restores the previous launchers instead of reporting success.

Installs already updated by an older updater are repaired by the new package itself. Its Doctor (which runs during the update and on openclaw doctor) and its Gateway startup rewrite a launcher that provably belongs to this installation and still names a removed update stage, without a user command.

Update behavior for published updaters: the installed updater runs the launcher relocation, so 2026.11.4 and 2026.11.5 still publish a launcher that points into their stage when they update to a release with this fix. In the measured first hops (2026.11.4 and 2026.11.5, each to this fix, pnpm 12.21.0), the new package's Doctor repaired that launcher during the same update. Both updaters handed the post-core steps to the new package (update-driver-handoff), which restarted the Gateway on the new version. Both runs ended with exit 0, a working CLI and the Gateway serving the new version. The service-ownership refusal fired only when the new package lacked the fix (2026.11.4 to public 2026.11.5).

Why This Change Was Made

Launcher (A): pnpm writes shims as exec node "$basedir_abs"/'../global/v11/<group>/node_modules/openclaw/openclaw.mjs' "$@", with the base and the target quoted separately. The relocation pattern only recognized "$basedir_abs/<target>", so the stage-relative target was published unchanged. #170131 fixed the unquoted $basedir_abs/ form; the quoted form was never handled. This change:

  • teaches relocation and verification the quoted form;
  • refuses to finalize, before the Gateway is stopped, a staged launcher that relocation still leaves pointing into the stage;
  • makes the post-activation check resolve every launcher target. A launcher whose target is missing is repaired, or the update fails. An unreadable format keeps the existing warning.

Service (B): before stopping the Gateway, the updater records the service as owned by the lexical pnpm global entry (global/v11/<group>/node_modules/openclaw). The unit runs the real path that entry resolved to in pnpm's versioned store (store/v11/links/@/openclaw/<old>/...). The swap repoints the entry to the new version. Revalidation's install-root-change check then re-inspected the unchanged unit against that same lexical root, which now means the new version, and found it "foreign". This only happens while the old store directory still exists; when pnpm has pruned it, the existing "unresolved" path already passed. Revalidation now also matches the unchanged definition against its own installation root. The protection is unchanged: the definition fingerprint, service name, profile and manager UID must still be the ones admitted before the stop, so an edited definition, or a service of another installation, is still refused.

Evidence

Behavior checked: an ordinary pnpm package update keeps a working CLI and restarts the Gateway on the new version, and an already-broken launcher heals.

  • RED (published updaters): 2026.11.4 to public 2026.11.5 on pnpm 12.21.0 (image default), managed Gateway. Exit 1, CLI broken with Cannot find module '<pnpm-home>/.openclaw-update-native-6MD67E/v11/926ea…/node_modules/openclaw/openclaw.mjs', Gateway down. The same result was measured on 11.28.13; on 12.15.0 the update reported ok and the CLI was broken.
  • GREEN-2 (updater from this head): an installed build of 1f1a842 (relabeled 2026.11.19-beta.1) updated through pnpm 12.21.0 to a newer build of the same code labeled beta.2 (openclaw update --yes --json --tag <tarball>). Exit 0, status ok. openclaw --version prints OpenClaw 2026.11.19-beta.2 (1f1a842). The live launcher runs "${basedir_abs}"/../global/v11/926ea…/node_modules/openclaw/openclaw.mjs, and neither it nor NODE_PATH names a stage. The Gateway serves beta.2 with /readyz 200, and the service definition was refreshed to the new root. A second update returned already-current with the CLI and Gateway still working. The final head 298d125 only adds a merge of two main commits that touch release-validation tooling and docs, so the cell was not rerun for it. The same cell also passed on 387a694.
  • First hop (published 2026.11.5 updater to this head): published 2026.11.5 installed with pnpm add -g on pnpm 12.21.0, updated to a build of the PR head 387a694 with openclaw update --yes --json --tag <tarball>. Exit 0, status ok. Afterwards openclaw --version prints OpenClaw 2026.11.19-beta.2 and the Gateway serves it with /readyz 200. A file observer shows the published updater still writing the broken launcher (exec node "$basedir_abs"/'../.openclaw-update-native-WeztE4/v11/…/openclaw.mjs'; its own check only warned, "Published launcher … could not be verified"). Twelve seconds later, during the post-swap Doctor that runs from this head's package, the launcher was rewritten to ../global/v11/926ea…/node_modules/openclaw/openclaw.mjs. The Gateway restart did not hit the ownership refusal on this hop, because 2026.11.5 hands the post-core steps to the candidate driver (update-driver-handoff), which contains the revalidation fix. A second update returned already-current. The same first hop from published 2026.11.4 (on the earlier head 70e18af) also ended with exit 0, a working CLI and the Gateway serving the new version.
  • Unit tests, red on main and green on this head:
    • update-native-package-stage.test.ts: a pnpm layout with the quoted shim, under a directory named team's base and with NODE_PATH in the stage. On main the published launcher runs Module not found ".../physical/bin/../.openclaw-update-native-…/openclaw.mjs". A second case refuses to finalize an openclaw launcher that relocation cannot rewrite and leaves another package's shim alone.
    • update-runtime-relocation.test.ts: with a symlinked bin directory, a lexical shim resolves beside the link and a shim that assigns basedir_abs resolves physically.
    • update-command-service-install-root.test.ts: a pnpm versioned-store layout with the old store kept. On main this fails with the exact production error (Required: admitted service ownership owned … detected: foreign). The pruned-store case and two negative controls (another installation, an edited definition) are green on both.
    • package-update-swap.launchers.test.ts: the earlier "commit with a warning" contract for missing launcher targets is replaced by a failed swap that keeps the previous package; an unknown launcher format still commits with the actionable warning.
    • update-launcher-repair.test.ts: the exact shim text from the RED evidence is repaired and executes the live install, including under a global directory named team's global (the '\'' quoting round-trips and the shim still runs). The same cases run with an apostrophe above the pnpm home and with a directory named odd "dir" $HOME \ global; a stub node checks the exact entry and NODE_PATH. A FIFO named openclaw on PATH is skipped. The mode is preserved, no staging is left behind, and a second pass leaves the launcher alone. Four cases are left untouched: a live stage (update in progress), another installation's root, a recorded entry that is not the stage's live counterpart, and a stage that is not beside the project. The "another installation" and "stage not beside the project" cases were shown to fail with their guard removed.
    • server-startup-plugins.test.ts: Gateway post-ready maintenance repairs a home-level launcher on PATH that names this installation and a removed stage, and logs the repair.
  • Recovery for an already-bricked 2026.11.4/2026.11.5 install, run in the cell: pnpm add -g --allow-build=openclaw [email protected], openclaw gateway install --force, openclaw gateway restart, then openclaw gateway status --deep and openclaw doctor --non-interactive, all exit 0. The CLI and Gateway work afterwards. openclaw update status still lists the failed run and an unresolved original-state capture; keep it and the <PNPM_HOME>/.openclaw.package-backup-* directory until Doctor passes.
Checks
  • On the final head: node scripts/run-vitest.mjs on the touched and adjacent files (launcher repair, runtime relocation, native stage, all package-update-swap*, runtime path index, service install root, update rollback, Doctor startup, Gateway startup plugins) all pass except update-command-rollback.test.ts > excludes a competing config writer…. That test asserts a setgid mode bit (expected 504 to be 1528) and fails the same way on main on macOS, a known Mac-only failure. Earlier heads also ran the 75 affected files with the same single exception.
  • pnpm tsgo:core, pnpm tsgo:core:test: pass. oxlint on touched files: clean. Test-lines ratchet: +424 against 400 plus the recorded 24. pnpm check:import-cycles and pnpm check:madge-import-cycles: 0 cycles.
  • The commits cherry-pick cleanly onto release/2026.11.6 (fix(update): keep the openclaw command and Gateway working after a pnpm update #201739) and release/2026.11.10 (fix(update): keep the openclaw command and Gateway working after a pnpm update #201740).
  • autoreview does not run on this machine.

Recordings

Raw terminal recordings of the Docker cells. Each shows the cell log streamed live, then a summary read from the raw cell files. Host paths are replaced with <proof-dir>; container paths are under /home/appuser.

  • RED, then recovery: published 2026.11.4 to public 2026.11.5 on pnpm 12.21.0, followed by the recovery commands.
red-2026.11.4-to-2026.11.5-recovery.mp4
  • GREEN-2: head 1f1a842 to head 1f1a842.
green2-head-to-head-1f1a842.mp4
  • GREEN-1 (first hop): published 2026.11.5 to head 387a694.
green1-published-2026.11.5-to-head-387a694.mp4

Full raw cell logs are not attached, because the Crabbox artifact store rejects uploads from this machine. The decisive lines are quoted above.

Review rounds

Landing review on 387a694 found that the launcher rewrite missed pnpm's escaped spelling when the stage path itself contains an apostrophe. With a pnpm home under team's base/, pnpm writes the stage in NODE_PATH as team'\''s base/..., and the raw prefix replacement never matched it. The repair then left NODE_PATH on the removed stage but still reported success, and the pre-stop guard would have refused every update on such an install. It also found that the pattern stopped at a " inside a single-quoted target. Both were real and are fixed in 3df4ba4. Relocation now parses each shell word, rewrites its value and quotes it again, so every quoting form is handled the same way. Coverage, all red on 387a694 and green now:

  • the repair, with the apostrophe below and above the pnpm home and with a directory named odd "dir" $HOME \ global;
  • the updater (finalize), with an apostrophe in the stage path. A stub node checks the exact entry path and NODE_PATH the shell passes.

"Repaired" is reported only when nothing in the launcher still names the stage. The two refusal cases that previously never found a launcher now present one, and each fails when its guard is removed. The private repair directory is removed when the first write fails. Docs now say exactly what the first-hop runs showed.

ClawSweeper round 2 on 3df4ba4 rated it overall D / proof C / patch D. All five findings were real and are fixed in 8db0790:

  • Base directory choice used a textual $basedir_abs match, which missed the braced ${basedir_abs} the rewriter emits. A shim whose bin directory is a symlink would then resolve its target from the wrong parent. Relocation and verification now use the physical bin directory whenever the shim defines basedir_abs.
  • On Windows, absolute paths in extensionless shell shims lost the forward-slash spelling pass. Shell words and comments now get the same native and forward-slash passes as .cmd/.ps1 shims.
  • The repair scan read every PATH candidate before checking its type, so a FIFO named openclaw blocked Doctor and Gateway maintenance. It now skips anything that is not a regular file. A new test with a FIFO on PATH times out without the check and passes with it.
  • Post-activation verification parsed each launcher twice. verifyRuntimeLauncher now returns unknown-format from its single read; the swap turns that into the warning and still fails a missing target.
  • Docs: automatic launcher repair is macOS and Linux only; Windows users follow the reinstall steps.

ClawSweeper round 3 on 3fdf10a (round 2's fixes merged with main) rated it overall D / proof C / patch D. All four findings were real and are fixed in 98bad55:

  • The pre-stop guard inspected every file in the staged bin directory, so another global package's shim that still named the stage failed the OpenClaw update. It now checks only the launchers the swap publishes (resolvePackageUpdateLauncherNames). A new negative control (other-cli) finalizes; the openclaw case still refuses. The control fails when the filter is removed.
  • Physical-base detection matched any text containing basedir_abs, including a directory name in a path. It now requires the shim to assign basedir_abs. The new verification test with a lexical shim, a symlinked bin directory and a path that names basedir_abs fails on the textual check.
  • The repair checked ownership on one read and relocated a second read. Ownership (cmd-shim-target equals this installation's entry) is now checked inside the repair, on the same bytes it relocates. If the launcher changed before the rename, the repair leaves it alone. That race is not covered by a test.
  • The recovery command lacked --allow-build=openclaw. The docs, Doctor and Gateway messages now use pnpm add -g --allow-build=openclaw openclaw@<installed-version>, the command the recovery cell ran.

Shrinking the Gateway startup test to a home-level layout (PNPM_HOME/openclaw beside PNPM_HOME/global/) exposed one more gap, fixed in 1f1a842. In that layout the stage sits inside the launcher's own directory, and an in-place repair kept the target unchanged, treating it as moving with the directory. A launcher rewritten in place now applies the stage relocation. The updater relocates between different directories and is unchanged. The Gateway test fails without this fix.

The same commit consolidates tests:

  • the apostrophe-in-stage finalize case is folded into the quoted pnpm 12 layout;
  • the FIFO case is folded into the four rewrite cases;
  • the verification cases and the service revalidation cases each become one table;
  • "recorded target missing" is dropped, because the ownership check now covers it the same way as "another installation".

After that, 24 regression-test lines remain over the 400-line allowance (21 before the landing round). They are recorded in config/test-lines-allocations/201735-pnpm-update-keeps-cli-and-gateway.txt.

ClawSweeper round 1 on df6345e rated it overall F / proof C / patch F. Its findings and the independent reviewer's were all checked and fixed in bc6c5e9:

  • Pnpm paths containing ' broke the rewritten single-quoted shim: real. Relocation now decodes and re-encodes '\'' both in the exec target and in the NODE_PATH export, and a repaired shim under team's global runs.
  • First-hop repair only looked in PNPM_HOME: real for a bin directory configured elsewhere. It now also scans PATH entries, and still writes only a launcher whose cmd-shim-target is this installation's entry.
  • The repair wrote through a predictable temporary name: real. It now writes the analyzed content into a private mkdtemp directory beside the launcher and renames from there.
  • Doctor swallowed repair failures: real. Doctor and the Gateway now report each launcher they could not repair, with the reinstall command.
  • The service fixture was systemd-only: real. Those cases are skipped on Windows, with the reason stated.
  • From the independent reviewer: the repair branch inside the post-activation check was unreachable (the pre-stop guard already refuses), so it was removed. Docs updated. Assertions added for the launcher half of a failed swap and for the untouched project after a pre-stop refusal.

Landing round on 298d125

The required check-guards-architecture job failed on a new import cycle: update-native-package-stage.ts → package-update-filesystem.ts → package-update-swap-contract.ts → back. resolvePackageUpdateLauncherNames now lives in a leaf module, package-update-launcher-names.ts, and all four callers import it from there. pnpm check:madge-import-cycles reported 1 cycle before and 0 after; pnpm check:import-cycles passes. The new module is listed in the update-restart swap fixture and in the PR wrapper inventory, and their tests pass.

Two smaller fixes from the same round:

  • Absolute-path relocation used replaceAll with a string replacement, so a $' in the live path was read as a replacement token. A callback replaces it now. The repair quoting case now uses a directory named odd "dir" $HOME $' \ global; it fails with the string replacement and passes with the callback.
  • The pre-stop refusal now names the direct pnpm reinstall, openclaw gateway install --force and openclaw gateway restart, which is the sequence the recovery cell ran, plus openclaw triage. The finalize test asserts the full message.

No new rating round or Docker cell was run for these. The launcher writer is unchanged except in the $' case, which has the unit test.

Follow-ups (not in this PR)

  • A lexical basedir shim reached through a symlinked bin directory is relocated from the physical directory. The repair then correctly reports it as not repaired (update-launcher-repair.ts, the relocation step) instead of repairing it.
  • The repair writes, rereads and rewrites its temporary file. This costs only efficiency.
  • Two not-ours tests find no launcher at all and need PNPM_HOME set to exercise a real one.
  • An empty private repair directory can be left behind if the first write fails.

Steps left to a person

  • An install already bricked by a published updater whose Gateway is down needs the recovery commands above, or openclaw triage, because no new code is running there yet. Once this release is installed (for example by the recovery's pnpm add), its Doctor and Gateway repair the launcher themselves.

Not proven

  • The Windows .cmd/.ps1 quoted forms were not observed; those formats keep the existing behavior.
  • Bun global installs are unchanged and were not run end to end.
  • Which pnpm binary the updater invokes: resolvePnpmCommand prefers PNPM_HOME/bin/pnpm over PATH. In these cells no pnpm was installed in PNPM_HOME, so the image's pnpm ran. Every pnpm tried (11.28.13, 12.15.0, 12.21.0) wrote or rewrote the quoted form, so the fix does not depend on the version.

@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 cli CLI command changes size: L labels Nov 19, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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. 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 repairs quoted pnpm launchers and preserves Gateway service ownership across package updates.

Example: Update a pnpm 12.21.0 installation from OpenClaw 2026.11.5 to the fixed build.

  • Before: The launcher can point into a deleted staging directory, and Gateway service revalidation can refuse the restart.
  • After: The launcher resolves to the activated package, and the unchanged admitted Gateway service restarts on the new version.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with supplied shipped-entry-point upgrade evidence, meaningful regression coverage, and no actionable findings; broad CI is still running.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR supplies live command results and launcher observations from real Docker pnpm installations: fixed-head updates and a published 2026.11.5 upgrade finish with the expected CLI version and Gateway readiness 200, including candidate Doctor repairing the older updater's broken launcher.
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 normal pnpm update can remove the working OpenClaw command and leave the Gateway down.
Reason: The maintainer-authored direction repairs observed published-release failures, including candidate-side recovery needed for the first upgrade from an older updater.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a concrete pnpm update failure still present on current main. No actionable introduced defect was found; CI remains pending.

Priority: P1
Reviewed head: df6345e6fd44688563d3e36e379a9dd525a34a75

Before merge

None.

Findings

None.

Agent review details

How this fits together

The package updater stages and activates pnpm installations, publishes CLI launchers, and reconciles the managed Gateway service; Doctor and Gateway startup also repair launchers left broken by older updaters.

flowchart TD
  A[OpenClaw update] --> B[Stage pnpm package]
  B --> C[Relocate and validate launchers]
  C --> D[Activate package and launchers]
  D --> E[Revalidate admitted Gateway service]
  E --> F[Working CLI and Gateway]
  G[Doctor and Gateway startup] --> H[Shared launcher repair]
  H --> F
Loading

Technical review

Best possible solution:

Retain the shared relocation and repair owner, reject provably broken launchers through existing rollback, and refresh only the unchanged admitted Gateway definition.

Do we have a high-confidence way to reproduce the issue?

The supplied published-release Docker failures match the current-main parser and lexical-root revalidation paths; this read-only review did not rerun them.

Is this the best way to solve the issue?

The patch fixes launcher production at the existing relocator, supplies shared candidate-side recovery for older updaters, and preserves the admitted service identity without introducing another lifecycle owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0d4eacf5b9e2.

Provenance checked

  • Quoted pnpm launcher relocation keeps the original intent (51211ac: Support pnpm basedir_abs launchers and physical bin paths after staging cleanup.)
  • Post-publication launcher failure handling changes intended behavior with a stated reason (51211ac: Warn without rollback when executable-target verification fails; this PR documents actual unusable CLI outcomes and deliberately rolls back known missing targets while retaining warnings for unknown formats.)
  • Retained managed-service definition keeps the original intent (54abbae: Refresh recognized service policy while preserving installed launchers, operator settings, and ownership; the fallback now handles a repointed lexical root while retaining fingerprint and manager comparisons.)
  • Validation before service stop keeps the original intent (d1a69c0: Prepare and validate candidates while the previous Gateway remains available.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit 3e82b9d adds src/infra/update-runtime-relocation.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3e82b9d8eef4; files: src/infra/update-runtime-relocation.ts)

PR surface

Source +247, Tests +260. Total +507 across 11 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 7 278 31 +247
Tests 4 289 29 +260
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 567 60 +507

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.

Root-cause cluster

Relationship: canonical
Canonical: #201735
Summary: This PR owns the main-branch pnpm package-update repair; two release backports carry it, while the Git-link switch report overlaps only part of the mechanism.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P1: Published pnpm update paths can leave both the CLI unusable and the managed Gateway stopped.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: Published pnpm update paths can leave both the CLI unusable and the managed Gateway stopped.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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, 4:06 AM ET / 09:06 UTC.

…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.
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 19, 2026
@fuller-stack-dev
fuller-stack-dev merged commit dbc1aa0 into openclaw:main Nov 19, 2026
143 of 144 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/update-pnpm-package-update-keeps-cli-and-gateway branch November 19, 2026 12:24
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
…npm install (openclaw#201735)

* fix(update): keep the pnpm launcher and Gateway working across a pnpm package update

* fix(update): quote repaired pnpm launchers safely and report repairs Doctor cannot make

* fix(update): rewrite pnpm launcher words by value so every shell quoting form relocates

* fix(update): verify pnpm launchers in one pass and skip non-regular PATH 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.

* fix(update): touch only this installation's pnpm launchers and prove 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`.

* fix(update): repair a home-level pnpm launcher in place and consolidate 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.

* fix(update): break the launcher-names import cycle and name the recovery 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.
tideclaw-bot pushed a commit that referenced this pull request Nov 23, 2026
…npm install (#201735)

* fix(update): keep the pnpm launcher and Gateway working across a pnpm package update

* fix(update): quote repaired pnpm launchers safely and report repairs Doctor cannot make

* fix(update): rewrite pnpm launcher words by value so every shell quoting form relocates

* fix(update): verify pnpm launchers in one pass and skip non-regular PATH 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.

* fix(update): touch only this installation's pnpm launchers and prove 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`.

* fix(update): repair a home-level pnpm launcher in place and consolidate 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.

* fix(update): break the launcher-names import cycle and name the recovery 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.

(cherry picked from commit dbc1aa0)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 176c28c431ce4347520c8483d4c266a9d64482aa)
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…aw#194058)

Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139.

Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact.

Co-authored-by: TorstenW <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>

(cherry picked from commit 7c702c3)

Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression.

Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109)

Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd)
(cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
fuller-stack-dev added a commit that referenced this pull request Nov 25, 2026
…leave the Gateway stopped (#205067)

Published 2026.11.7, 2026.11.8 and 2026.11.9 ship the same launcher
relocation and service revalidation code as 2026.11.6, and none of them
contains the pnpm launcher and restart fix (#201735), so a pnpm update
they drive still leaves the Gateway stopped. 2026.11.10 carries the fix.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…leave the Gateway stopped (openclaw#205067)

Published 2026.11.7, 2026.11.8 and 2026.11.9 ship the same launcher
relocation and service revalidation code as 2026.11.6, and none of them
contains the pnpm launcher and restart fix (openclaw#201735), so a pnpm update
they drive still leaves the Gateway stopped. 2026.11.10 carries the fix.
tideclaw-bot pushed a commit that referenced this pull request Nov 26, 2026
…leave the Gateway stopped (#205067)

Published 2026.11.7, 2026.11.8 and 2026.11.9 ship the same launcher
relocation and service revalidation code as 2026.11.6, and none of them
contains the pnpm launcher and restart fix (#201735), so a pnpm update
they drive still leaves the Gateway stopped. 2026.11.10 carries the fix.

(cherry picked from commit 230456c)
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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