Skip to content

fix: keep the Windows openclaw command on the current release after Git updates - #203247

Merged
steipete merged 4 commits into
mainfrom
codex/git-npm-switch-back
Nov 21, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/git-npm-switch-back

Conversation

@steipete

@steipete steipete commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #200578

What Problem This Solves

On Windows, a Git install's openclaw command keeps running the build made when the installer ran. After #200578, every Git update should repoint the installer's openclaw.cmd at the release launcher. On Windows it never did, so openclaw keeps running the checkout's old build and its old updater. At the next state schema bump that build would refuse every command, including openclaw update. macOS and Linux are not affected.

User Impact

  • The next Git update on Windows repoints openclaw at the current release.
  • That update still exits with its real exit code.
  • New Windows Git installs write a wrapper the updater recognizes.

Why This Change Was Made

install.ps1 built the wrapper path with "dist\\entry.js". In a double-quoted PowerShell string that is a literal double backslash, so the wrapper reads node "C:\repo\dist\\entry.js" %*. The updater compared that line exactly against C:\repo\dist\entry.js, so it skipped the wrapper every time. The installer's own Test-PreviousGitWrapper regex rejected the line for the same reason. The fix:

  • The updater compares normalized, case-insensitive Windows paths.
  • The installer writes single backslashes.
  • The installer's regex accepts wrappers already written with the double backslash.

Once the rewrite happened, a second problem showed up live. openclaw update usually runs through the very wrapper it rewrites. cmd.exe rereads a running batch file at its saved byte offset, so when the update returned, cmd resumed in the middle of the new line. The update then exited 1 with The system cannot find the path specified. even though it had succeeded.

The new wrapper is:

  • @goto run;
  • a @rem line padded so the old file's length lands exactly on @exit /b %errorlevel%;
  • :run;
  • @node "<launcher>" %*.

A fresh run jumps to the launcher. The cmd.exe that ran the update exits with the update's own exit code. The updater and the installer recognize both formats, and a later update rewrites the wrapper byte for byte.

POSIX wrappers are unchanged: they exec, so bash never reads the rewritten file.

Evidence

  • Regression test. The wrapper install.ps1 writes is repointed at the launcher. In the new file, the old file's byte length lands on the exit line, and a second update rewrites it unchanged. The test fails on base and passes with the fix.

  • Live, Crabbox Windows Server 2025 (AWS). Base install.ps1 writes the wrapper, then one openclaw update --channel dev from a checkout at the driver commit:

    Driver Wrapper after the update openclaw --version Update exit code
    base 9156690807f still node "C:\g\oc\dist\\entry.js" (checkout build) checkout build 0
    first fix, rewrite with no padding launcher release 1, The system cannot find the path specified.
    padded rewrite (ac2174e34e5) padded launcher wrapper release 0810295 0

    Through the padded launcher wrapper, openclaw --version exits 0 and an unknown command exits 1.
    The final head (b4828c4ce9f) adds only the unit-proven skip that leaves a wrapper already on the launcher unchanged.

  • test/scripts/install-ps1.test.ts passes locally with pwsh.

  • Reviews on b4828c4ce9f: autoreview scoped-clean, and an independent codex exec review found nothing. Earlier rounds found the repeated-rewrite padding growth and the vacuous second-call test; both are fixed.

Not in this PR. The evidence is on #200578.

  • Switching a Git install back to npm (Occupied slot does not resolve to its original installation.) needs more than a slot exception. Package publication recovery also requires the executor's installation to be the npm directory, so the fix belongs with the package update owner. Verified workaround: npm i -g openclaw@<version>, then openclaw gateway install --force.
  • POSIX Git-on-main installs already locked out by schema 41. An older updater left their wrapper on the checkout. Recovery: node ~/.openclaw/git-install/openclaw-launcher.mjs update --channel dev.

…taller wrapper

A Git release install leaves the npm package forwarding to its launcher, but
the executor's occupied-slot check only accepted a package path that resolves
to the installation, so switching back to npm failed with 'Occupied slot does
not resolve to its original installation.' Reserve this install's exact
forwarding package, the same ownership proof destination admission uses.

install.ps1 wrote the Git wrapper as dist\\entry.js (a literal double
backslash), which the updater's exact match never recognized, so Windows Git
installs kept running the checkout's installer-time build from PATH. Match the
wrapper's entry by normalized Windows path and write single backslashes.

Refs #200578
@clawsweeper

clawsweeper Bot commented Nov 21, 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 cli CLI command changes scripts Repository scripts size: S labels Nov 21, 2026
@steipete
steipete marked this pull request as ready for review November 21, 2026 19:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T20:13:15.629868Z b4828c4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment 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-environment Preliminary submission classification; full source review pending. labels Nov 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR restores Git-to-npm switching and makes Windows Git installer wrappers follow the selected release.

Example: An npm installation switches to Git, then runs openclaw update --channel stable.

  • Before: The executor rejects its forwarding npm package with “Occupied slot does not resolve to its original installation.”
  • After: The owning Git executor can reserve that package and proceed with the switch.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation appears correct and useful, but required runtime proof is not yet supplied.
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: Git users cannot complete the supported npm round trip, and Windows users keep invoking the installer-time build after Git updates.
Reason: Both repairs restore behavior explicitly intended by the merged migration, and the supplied maintainer-author facts establish direction.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs two source-confirmed Git update failures that remain on current main, and no introduced correctness defect was found.

Priority: P1
Reviewed head: b12bfc4bf7c0796bdd263525bbbe48afe8c7f6af

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted CLI output or terminal screenshots proving the Linux npm→Git→npm round trip and Windows fresh-install/existing-wrapper update through PATH, including an upgrade from v2026.11.6 with settings and data preserved; redact IPs, keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The update CLI coordinates installation leases, package activation, and PATH wrappers so requested updates select the release that later CLI and Gateway launches run.

flowchart TD
  A[Update command] --> B[Installation executor]
  B --> C[Package destination admission]
  C --> D[Package activation]
  A --> E[Git release update]
  E --> F[Installer wrapper]
  F --> G[Release launcher]
Loading

Technical review

Best possible solution:

Retain these focused repairs in the existing executor and wrapper owners while preserving unrelated installations and user-written wrappers.

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

The producer, destination admission, executor reservation, and wrapper comparison expose both failing paths directly; no product code or tests were executed during this read-only review.

Is this the best way to solve the issue?

The patch restores the documented release-migration contract with existing ownership predicates and Windows path normalization, without adding a competing owner or unnecessary test machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 89596c51481e.

Provenance checked

  • Executor occupied-slot admission keeps the original intent (b107d4a: Interrupted-package recovery reserved publication paths under the original installation's lease and refused unrelated installations.)
  • Git release forwarding and wrapper conversion keeps the original intent (feat(update): run every Git install from releases and delete the in-place Git runner #200578: Every Git installation should run immutable releases through one launcher, with working PATH commands and a supported switch back to npm.)
  • Windows installer entry verification keeps the original intent (2edd6e2: Reject Git installations whose build did not produce a runnable entry; the separator correction retains that verification.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current-main switch-back failure: Destination admission accepts the exact forwarding package, but the executor still requires its real path to equal the Git installation key; package activation calls that reservation before publication. (src/cli/update-cli/update-command-executor.ts:229, 89596c51481e)
  • Scoped ownership repair: The exception requires both the existing exact forwarding-entry predicate and a match between the held installation lease and the serving Git slot; acquisition still uses the existing lease owner. (src/cli/update-cli/update-command-executor.ts:243, b12bfc4bf7c0)
  • Windows producer and consumer mismatch: The original installer writes a doubled separator before entry.js while wrapper retirement compares the command text exactly; the patch corrects new output and normalizes existing Windows paths. (src/cli/update-cli/update-command-git.ts:110, b12bfc4bf7c0)
  • Prior intended contract: The merged release migration explicitly promises npm-to-Git-to-npm switching and installer wrappers that launch the current release; its author also recorded successful release-migration lanes, which do not establish proof for this repair. (b229b2664537)
  • Supplied proof remains pending: The full live PR body still marks Linux base/fix runs and the Windows Git lane pending; discussion supplies no changed-path runtime output. (b12bfc4bf7c0)
  • Repository policy applied: Read the complete root and scripts instructions, the maintainer and simplification skills, and the boundary-test guidance; no additional ancestor instructions or maintainer-notes directory govern these paths. (AGENTS.md:1, b12bfc4bf7c0)

Likely related people:

  • Peter Steinberger: Raw commit b107d4a adds src/cli/update-cli/update-command-executor.ts:198 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b107d4af14d7; files: src/cli/update-cli/update-command-executor.ts)
  • Ayaan Zaidi: Raw commit b229b26 adds src/cli/update-cli/update-command-git.ts:68 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b229b2664537; files: src/cli/update-cli/update-command-git.ts)
  • Jason (Json): Raw commit b868ed4 adds src/cli/update-cli/update-command-executor-release-link.test.ts:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b868ed4c21ba; files: src/cli/update-cli/update-command-executor-release-link.test.ts)

PR surface

Source +23, Tests +75, Other 0. Total +98 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 29 6 +23
Tests 2 77 2 +75
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 3 0
Total 5 109 11 +98

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:

  • add P1: Supported Git update workflows currently reject switching back to npm or leave the Windows PATH command running an outdated build.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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: Supported Git update workflows currently reject switching back to npm or leave the Windows PATH command running an outdated build.
  • 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.

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 21, 2026, 2:30 PM ET / 19:30 UTC.

…xits cleanly

cmd.exe rereads a running batch file at its saved byte offset. openclaw update
usually runs through the wrapper it rewrites, so after the update returned cmd
resumed inside the new command line and the update exited 1 with 'The system
cannot find the path specified.' Pad the new wrapper so the old length lands on
an exit line that keeps the update's exit code.

Drop the npm switch-back slot admission: package publication recovery also
requires the executor's installation to be the npm directory, so the switch
back needs a root decision in the package update owner, not a slot exception.

Refs #200578

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac2174e34e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +169 to +173
const head = "@goto run\r\n@rem ";
const pad = "x".repeat(Math.max(0, Buffer.byteLength(contents) - head.length - 2));
const next =
platform === "win32"
? `@echo off\r\nnode "${entry}" %*\r\n`
? `${head}${pad}\r\n${WINDOWS_WRAPPER_EXIT}\r\n:run\r\n@node "${entry}" %*\r\n`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid growing the Windows wrapper on every Git update

On Windows, every subsequent Git update recognizes the padded wrapper but rewrites it with padding based on its entire current length, adding another exit/launcher suffix each time. With the paths in the new regression test, the wrapper exceeds 4096 bytes after 42 rewrites, at which point this function's size guard silently skips it—including when switching back to npm. The stale wrapper can therefore remain ahead of npm on PATH and continue launching the Git installation. Preserve an already-correct launcher wrapper unchanged; the new test's second-call equality assertion also fails with the current implementation.

Useful? React with 👍 / 👎.

@steipete steipete changed the title fix: let Git installs switch back to npm, and keep the Windows openclaw command on the current release fix: keep the Windows openclaw command on the current release after Git updates Nov 21, 2026
@steipete
steipete merged commit 9809b28 into main Nov 21, 2026
140 checks passed
@steipete
steipete deleted the codex/git-npm-switch-back branch November 21, 2026 21:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 22, 2026
…it updates (openclaw#203247)

* fix(update): admit Git-to-npm switch back and repoint the Windows installer wrapper

A Git release install leaves the npm package forwarding to its launcher, but
the executor's occupied-slot check only accepted a package path that resolves
to the installation, so switching back to npm failed with 'Occupied slot does
not resolve to its original installation.' Reserve this install's exact
forwarding package, the same ownership proof destination admission uses.

install.ps1 wrote the Git wrapper as dist\\entry.js (a literal double
backslash), which the updater's exact match never recognized, so Windows Git
installs kept running the checkout's installer-time build from PATH. Match the
wrapper's entry by normalized Windows path and write single backslashes.

Refs openclaw#200578

* fix(update): admit the forwarding package only for its own Git install's executor

Refs openclaw#200578

* fix(update): rewrite the Windows Git wrapper so the running cmd.exe exits cleanly

cmd.exe rereads a running batch file at its saved byte offset. openclaw update
usually runs through the wrapper it rewrites, so after the update returned cmd
resumed inside the new command line and the update exited 1 with 'The system
cannot find the path specified.' Pad the new wrapper so the old length lands on
an exit line that keeps the update's exit code.

Drop the npm switch-back slot admission: package publication recovery also
requires the executor's installation to be the npm directory, so the switch
back needs a root decision in the package update owner, not a slot exception.

Refs openclaw#200578

* fix(update): leave a wrapper that already runs the release launcher unchanged

Refs openclaw#200578
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…lace Git runner (#200578)

Slice 4b of the update foundation. Follows #199706 (slice 4), #201917 (releases outside `node_modules`) and #201538 (half-switched Git updates).

## Problem

Since #199706, POSIX Git checkouts with a Gateway service update through releases: a detached worktree at `<state>/git-install/releases/<id>/openclaw`, behind the link `<state>/git-install/openclaw`, started by a launcher that switches back after two failed starts. Three cases still used the in-place Git runner, which rewrites the checkout the Gateway runs from:

- Windows checkouts;
- package-to-Git switches;
- checkouts with no Gateway service.

That runner is RC1 of the update RCA: in-place replacement at a path running processes use. Keeping it meant keeping its rollback, retention, pack transfer, staging and handoff code.

## Change

Every Git install now updates through releases. The in-place Git runner and its command-side rollback are deleted on every platform in one cutover. `openclaw update` no longer moves the checkout `HEAD` or rebuilds its `dist`. (`scripts/update-gateway.sh`, a separate maintainer script, still rebuilds a checkout in place; it is unchanged.)

- **Windows:**
  - The release link is an NTFS junction, which needs no administrator rights. It is owned by the existing `package-release-slot*` code; the win32 exclusions there and in the release lease are removed.
  - Windows cannot rename onto a junction, so a switch removes the old junction and then renames.
  - The Windows task supervisor starts its Gateway child through the release launcher, so the child's starts count toward the trial.
- **Package-to-Git:**
  - The checkout is cloned and the target is built as the release on trial. Its fallback is the npm package that was serving, kept intact: if the Git build fails to start twice, the launcher switches the link back to the package, and the Gateway and `openclaw` on PATH run the npm build again with no manual step. A deferred (`--no-restart`) switch keeps the same fallback. The package counts as this install's only while its `openclaw.mjs` is exactly this install's forwarding entry; retention never touches it.
  - The global npm package's `openclaw.mjs` is rewritten once to import the release launcher, so the existing npm bin shims run the release. Without that, `openclaw` on PATH would keep running the old npm build, whose updater treats the install as npm.
  - The rejected alternative, re-pointing the npm package path at the release, would name the release through `node_modules/openclaw` again, the cause of #201874.
  - Installs whose switch was done by an older updater have the npm package path linked to the checkout, which releases never rebuild. A Git release update replaces that link (only a link to the checkout) with a directory holding `openclaw.mjs` and `dist/index.js`, both starting the launcher; the second keeps a service definition that names the package path working after a `--no-restart` update. Without this, the CLI and its updater stayed on the version the switch built (found by the package-to-Git upgrade lane).
- **No service:** a checkout run by hand updates through a release too. The next `openclaw gateway` runs it.
- **CLI on PATH:** after a Git release update, the installer's `openclaw` wrapper (POSIX and Windows) is rewritten once to run the release launcher, and a global npm, pnpm (`pnpm add -g openclaw@link:`) or Bun (`bun link`) link to the checkout is replaced the same way as the npm link above. The launcher selects a `--no-restart` release on the next Gateway run and counts `openclaw gateway` / `openclaw gateway run` as trial starts; other commands (`gateway status`, `--version`) never count.
- **Service definition:** `serviceUsesUpdatedRoot` reads the service definition, not the running process. A `--no-restart` Git release update whose service still starts the checkout writes a definition that starts the launcher without starting or restarting the Gateway (`stage`; systemd reloads unit metadata only). Every OpenClaw restart route on macOS (`openclaw gateway restart` and the Gateway's own restart) re-bootstraps the job when the loaded command is known to differ from the plist on disk; otherwise it kickstarts. Only a failed write leaves an owed `service-definition` step.
- **Conversion stop:** a Git update stops a Gateway whose service does not yet name the launcher before the release activates, so the existing install rebinds it. A Dashboard update on macOS runs inside the Gateway's LaunchAgent, which cannot rewrite itself while loaded; without the stop, the update reported success, the Gateway kept the old checkout and the result asked for `openclaw gateway install --force`. This replaces `main`'s macOS in-place fallback (247b958), whose runner this PR deletes. An update the previous definition does not start is reported as pending, not succeeded. Services that already name the launcher still switch without a stop.
- **Restart:** the converted service restarts once, not twice. Git release updates no longer warn to restart a live Gateway by hand: a release replaces no root the Gateway uses.
- **No manual steps (Ayaan, 2026-11-20):**
  - Releases built under `lib/node_modules` by `7db69bedeab6`-era updaters (#201874): bundled plugin public surfaces there load the built `dist/extensions/<plugin>/` JavaScript, so those installs update by themselves; the manual bridge in the #201874 comment is no longer needed.
  - A killed npm link swap leaves the link under npm's backup name; the next Git update restores it and retries.
  - The launcher finishes a Windows link switch killed between removing the old junction and renaming the new one.
  - npm -> Git -> npm: destination ownership recognizes this install's exact forwarding `openclaw.mjs`, so switching back is admitted.

## Impact

- One update path for Git installs on macOS, Linux and Windows.
- `openclaw` on PATH runs the current release after an update.
- **Accepted edge cases:**
  - Two checkouts that share one state directory share its single release install.
  - After a package-to-Git switch, the old npm package keeps its disk space until a switch back to npm replaces it.
  - A Gateway run for another profile through the default `openclaw` on PATH counts toward the default install's trial (accepted by Ayaan, 2026-11-20).
  - `--no-restart` selects the new release at the next start without the two-start switch-back.
  - A checkout installed at `<state>/git-install/openclaw` (the release link path; the installer default is `~/openclaw`) is left in place, and every update fails visibly with nothing changed, naming the fix: move the checkout or reinstall with another `--git-dir` (accepted by Ayaan, 2026-11-21).
  - The first update of an install whose service still names the checkout has a one-time outage while the Gateway stops and the LaunchAgent or unit is rebound (26 s on the macOS Dashboard run).
  - If a macOS release's `launchctl print` omits the job's arguments, a definition staged by `--no-restart` applies at the next login or update instead of the next restart.
  - Unchanged follow-up: when local commits conflict with every newer commit, the preflight reports `already-current` instead of naming the conflict. This predates the PR and gets its own PR.

## Size

Against the merge base, 32 commits:

- Production code: +821 / −2,166 (56 files).
- Tests: +1,391 / −8,893 (74 files). Cut tests covered steps a Git release no longer takes (checkout rollback, in-place staging, service stop before checkout); each is listed in the contract.
- Upgrade-survivor scenario: +836 / −104 (4 files): baselines `v2026.11.5`, `7db69bedeab6`, `main`; package-to-Git; no service; SIGKILL at stage, build, publish, link switch and launcher restore.
- Docs: +132 / −104.

## Evidence

Final head `99ecf23e04e8`. Each row names the head its end-to-end proof ran on; later commits change tests, the e2e helper's lint, the restart warning text, the macOS reload probe's unknown case, the npm/pnpm/Bun link lookup and the deferred-switch staging (unit-proven, red on base).

| Invariant | Result | Proof |
|---|---|---|
| Release built where it serves; no `node_modules` in the link or realpath | Pass | Linux upgrade-survivor lanes; macOS launchd (isolated profile on a maintainer Mac); hosted Crabbox Windows Server 2025 |
| Gateway serves the new release and `tools.invoke web_search` works after every update | Pass | every hop on all three OSes |
| SIGKILL at stage, build, publish, link switch, launcher restore leaves a serving install | Pass | Linux kill-point lane (`8f63330`) |
| Two failed starts switch back and restore `.pre-` state | Pass | Linux lanes; macOS `8f63330` (`failed to start twice; switched back`); Windows `9cbc4b5`, automatic through the Scheduled Task, 67.5 s outage. Older-supervisor and pending cases: unit tests red on base (`6003675`, `75e7bd5`) |
| The release updates itself | Pass | Linux; macOS `8f63330`; Windows `9cbc4b5` |
| The checkout is never written (HEAD, status) | Pass | every lane and OS run |
| Every shipped layout reaches releases with no manual step | Pass | `v2026.11.5`, merge-base `main` (`8f63330`); `7db69bedeab6` (`6003675`) |
| npm → Git switch; `openclaw` on PATH runs the release | Pass | Linux `75e7bd5` |
| No service: the next `openclaw gateway` runs the release | Pass | Linux `8f63330` |
| `--no-restart` keeps the Gateway up; the next restart runs the release | Pass | macOS `8f63330`: 0 s outage, `gateway restart` reloads launchd arguments |
| macOS Dashboard update (`update.run`) on a LaunchAgent that names the checkout, twice, then a terminal update | Pass | `80d9587`, isolated profile on a maintainer Mac: each update served its new commit, launchd runs `openclaw-launcher.mjs`, `web_search` passed, checkout unchanged, no manual step needed. Red on `3c14869` (Gateway kept the checkout, manual install step) |
| Linux `7db69bedeab6` → head and npm → Git | Pass | `80d9587` |
| Windows junction; a release held open is retained, then collected | Pass | hosted Crabbox (Windows Server 2025) |
| Windows without admin rights | Not run | S4U Limited stays admin on the Crabbox image |
| Installer-made partial clones (`--filter=blob:none`) | Not run | all lanes clone fully |

Reviews: local ClawSweeper on every head (last finding accepted above); Fable 5.2 contract reviews. Unit: release, update-runner, launcher, wrapper, service, launchd, systemd, restart, task-supervisor, plugin loader suites; `tsgo:core` and `tsgo:core:test` clean.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit b229b26)

Release adaptation: Extract only the three public-surface resolver, caller and regression paths. Preserve globals, source checkouts and already-bound plugin instances; exclude the Git updater rewrite.

Companion audit: PR #200578 is the source; #203247 and #204835 follow the excluded Windows launcher and install switch. No follow-up modifies the selected public-surface files.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…it updates (#203247)

* fix(update): admit Git-to-npm switch back and repoint the Windows installer wrapper

A Git release install leaves the npm package forwarding to its launcher, but
the executor's occupied-slot check only accepted a package path that resolves
to the installation, so switching back to npm failed with 'Occupied slot does
not resolve to its original installation.' Reserve this install's exact
forwarding package, the same ownership proof destination admission uses.

install.ps1 wrote the Git wrapper as dist\\entry.js (a literal double
backslash), which the updater's exact match never recognized, so Windows Git
installs kept running the checkout's installer-time build from PATH. Match the
wrapper's entry by normalized Windows path and write single backslashes.

Refs #200578

* fix(update): admit the forwarding package only for its own Git install's executor

Refs #200578

* fix(update): rewrite the Windows Git wrapper so the running cmd.exe exits cleanly

cmd.exe rereads a running batch file at its saved byte offset. openclaw update
usually runs through the wrapper it rewrites, so after the update returned cmd
resumed inside the new command line and the update exited 1 with 'The system
cannot find the path specified.' Pad the new wrapper so the old length lands on
an exit line that keeps the update's exit code.

Drop the npm switch-back slot admission: package publication recovery also
requires the executor's installation to be the npm directory, so the switch
back needs a root decision in the package update owner, not a slot exception.

Refs #200578

* fix(update): leave a wrapper that already runs the release launcher unchanged

Refs #200578

(cherry picked from commit 9809b28)

Release adaptation: Keep only normalized install paths and recognition of the owned stable wrapper when its legacy entry path contains repeated separators. Exclude resident launcher and its retirement rewrite.

Companion audit: PR #203247 is the source. #203588 atomic replacement is already present via NullString.Value; later memory gating is out of scope.

Co-authored-by: RomneyDa <[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 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. scripts Repository scripts size: S 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