Repository navigation
fix: apply newer npm installs when restarting the Gateway - #204515
Conversation
- Let explicit local npm update and managed activation use the resident updater. - Preserve release trials, rollback forwarding, older-package guidance and honest split status.
- Keep native start/restart intent and pending activation behavior. - Reuse the update owner outcome wait and rollback failure text. - Report observed Gateway identity without treating history as current health.
- Preserve an already-running Gateway and return without the outcome wait. - Name the serving and prepared versions and the single restart command. - Keep trial-file reads inside the update owner.
|
🦞👀 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. |
…ration - Combine build-identity and npm frontend cases with consistent running-version facts. - Move the existing current-update suite intact into registered test support to keep the owner file below its line cap.
|
Codex review: needs changes before merge. What this changesThis PR applies newer global npm packages through resident release validation and rollback, and separates CLI, selected-release, and running-Gateway status. Example: A Linux installation serves 2026.11.9-next.0 after npm installs 2026.11.10-manual.0.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this PR addresses a concrete update defect, but pending-trial guidance needs correction and GitHub reports merge conflicts. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe update owner turns installed packages into validated release trials; managed lifecycle commands activate them, and status projects installation and Gateway facts. flowchart TD
A[Npm CLI] --> B[Resident update owner]
B --> C[Validated release trial]
A --> D[Managed lifecycle]
D --> E[Resident launcher]
C --> E
E --> F[Gateway]
C --> G[Update status]
F --> G
Technical reviewBest possible solution: Keep the existing update and activation owners, and make pending-trial status recommend the profile-aware Gateway restart command. Do we have a high-confidence way to reproduce the issue? Current-main source supports the reported installation split, and the linked issue supplies concrete CLI observations; this read-only review ran no reproduction. Is this the best way to solve the issue? Delegating to the resident updater preserves validation, rollback, and native restart intent without introducing a competing activation mechanism. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 947cc1fa83ed. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +448, Tests +432, Docs +29. Total +909 across 15 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 24, 2026, 4:01 AM ET / 09:01 UTC. |
- Consume the preparation failure tag without comparing opaque run IDs. - Remove the redundant pending-trial ID comparison and obsolete mock baseline entry. - Consolidate overlapping regressions to keep net test growth at 398 lines.
- Keep the archive-path presence and staging ownership contract explicit. - Verify preparation consumes the returned archive under both npm command routes.
|
Maintainer override: the only CI red on head ci-triage:
|
|
Landed as d761611.
Known gap, tracked separately: a stopped service whose database has no shared-memory file still fails the release check (#204227). |
Closes #204276 After conversion to resident releases, installing a newer global npm package changes the CLI but leaves the managed Gateway on the old release. Restart keeps that old release, ordinary update refuses, and update status can incorrectly say “up to date.” User impact: after `npm i -g`, either `openclaw gateway restart` or `openclaw update` applies the installed newer package through the existing release checks and trial. No UUID-specific command or second restart is required. | State | What the user sees | | --- | --- | | Newer npm package | CLI, selected release, and observed Gateway are separate; status recommends `openclaw update`. Restart, or start of a stopped service, applies the installed package through the normal trial. | | Matching version and build | Forwarding is restored; an ordinary restart remains a restart. | | Start while already running | No restart or downtime. Output names the old serving version, the prepared new version, and `openclaw gateway restart` to apply it. | | Same version, different or unknown build | Status names the build difference. Explicit update validates the installed artifact; restart does not assume unknown bytes are identical. | | Older npm package | The newer resident release stays selected. Output names `openclaw update --tag <version>` for a deliberate downgrade. | | Pending trial / `--no-restart` | Forwarding follows the selected release; status names the pending version and its next-start activation. | | Failed preparation | Nothing is published; the same short update command can retry. | | Failed trial | The command exits nonzero with the update owner's rollback cause and restored serving version. The npm entry follows the recovered release, not the failed package. | | Read-only npm tree | A forwarding warning does not undo the Gateway update. The npm entry stays separate. | | Offline or remote Gateway | Running local version is not claimed as verified. Git and Gateway RPC installation identity checks remain in place. | The resident release prepares a retained archive of the installed npm package rather than registry latest. Managed lifecycle commands ask it only to prepare, then use their original native activation once, with the user's restart options. An existing pending trial is reused, including when npm forwarding is read-only. After native readiness, the update owner follows the recorded outcome; a healthy rollback is not a successful update. If idempotent start leaves the old Gateway running, the owner reports the still-pending release without waiting for an activation that did not occur. Status reads existing release/trial facts; there is no new schema, protocol, public flag, install hook, or background updater. The explicit local package-to-package policy also admits another global npm prefix for this profile. It does not infer that a markerless package is the original converted tree, and it does not grant that admission to RPC callers or Git checkouts. The whole diff was reviewed with pr-simplify. The repair removes a separate native-restart fallback and leaves activation with the existing lifecycle owner, preserving `--force` and `--wait`. The existing outcome formatter is shared rather than copied into native health checks. Packing is retained through preparation, and forwarding uses the existing marker writer. No update/trial manager, installation receipt, RPC field, retry loop, or postinstall action was added. The remaining growth implements the approved package admission, local delegation, single managed activation, archive lifetime, forwarding warning, and factual text/JSON status. Supervisor-health and legacy-release rendering code was moved unchanged to keep their existing modules bounded; moves cancel in the net count. Net against integrated main `e2de897bf5fc`: **+448 production TypeScript, +400 tests/support, +29 documentation lines**. This remains above the production estimate. The outcome wait and idempotent-start reporting add 46 production lines to the handed-off +402 tree; they close false-success and unactivated-trial hangs rather than introduce another updater. Overlapping coverage was consolidated by 55 lines; the hosted-runtime archive follow-up adds two ownership-contract lines. No test allocation file was added. Repair head: `edc9471449d336b96dc9cfa430d3d5a068ec8d88`. The earlier AWS owner run was Node-hosted: `CI=1` defaults the test host to Node, and a fixture row named `runtime: "bun"` changes only the fake installer. CI's hosted Bun lane instead [selects bundled npm](https://github.com/openclaw/openclaw/blob/edc9471449d336b96dc9cfa430d3d5a068ec8d88/src/infra/npm-command.ts#L30-L33), which returns `openclaw-2026.11.21.tgz` rather than the PATH fake's `openclaw.tgz`. The test now requires a present archive directly owned by staging and checks consumption of the returned archive, without prescribing npm's filename. Production code and the recorded Linux behavior are unchanged. [AWS dual-host verification](https://crabbox.openclaw.ai/portal/runs/run_71abf35b21de3b9400055bb314174f41) passed the complete `src/update/prepare.test.ts` file on this head: **36/36 under explicit Node and 36/36 under explicit hosted Bun** using the pinned fork. Lint/format passed, and the test-lines guard passed at **+400 / 400**, with zero allocation credit. The repair is test-only. PR head: `6acf6fff368faa437b70c75b32f66202b4c3eba0`. The pending trial no longer compares opaque run IDs, and native lifecycle code checks only the boolean preparation-failure result type. Preparation already returned the pending run for this operation. The obsolete closed-mock baseline entry for status's Gateway client was removed, and overlapping test setup/cases were consolidated while retaining native failure/rollback assertions, custom/remote exclusion, and the existing restart-intent suites. [AWS ratchet/prune run](https://crabbox.openclaw.ai/portal/runs/run_77d2c03ad7d573bafb4ffbb4b768949c): session-identity ratchet passed without allowlist changes; mock factories pruned 6122 → 6121 and the normal guard passed; test-lines passed at **+398 / 400**, with zero allocation credit. These are non-behavioral cleanup changes for the recorded Linux flows, so the Linux proof at `46e01ac296` remains applicable. [Frozen-head AWS verification](https://crabbox.openclaw.ai/portal/runs/run_4740daa715b07c92480614ed3c20cdae) passed on `6acf6fff368faa437b70c75b32f66202b4c3eba0` (source tree `636c89bd760fa5d1e32149a85886a61561dc70d8`): all three ratchets, **216 owner tests** in nine files / four configurations (261.44 seconds), core/core-test typechecks, and touched-file lint/format. One repair push contains all three CI fixes. Integrated main `e2de897bf5fc`; integration head is `18ebed63330b4b7558fa83eca4f94e6218a38188`. The only conflict was the preparation test case table: both npm-adoption cases and main's rebuilt/installed-artifact cases are retained. The existing already-current suite moved intact to registered test support to keep its owner file below the line cap. The production integration delta auto-merges #204426's [same-known-build check](https://github.com/openclaw/openclaw/blob/18ebed63330b4b7558fa83eca4f94e6218a38188/src/update/run.ts#L326-L335). It requires a nonempty prepared build ID, **equal version**, and **equal build ID**. [Adoption delegates through the resident launcher](https://github.com/openclaw/openclaw/blob/18ebed63330b4b7558fa83eca4f94e6218a38188/src/update/cli.ts#L159-L166), and [preparation receives that resident's root and VERSION](https://github.com/openclaw/openclaw/blob/18ebed63330b4b7558fa83eca4f94e6218a38188/src/update/cli.ts#L511-L519). Therefore the relabeled newer npm package cannot take this shortcut even with the same build ID; same-version/different-build and unknown-build artifacts cannot either. Only an identical known version/build is current, as intended. No production adoption/restart/status conflict was resolved. The full-build and Linux evidence below remains explicitly at `46e01ac296`, not the integrated head. [Complete integration range](46e01ac...18ebed6). [Integrated owner/static run](https://crabbox.openclaw.ai/portal/runs/run_88448c64c0ad803a299e25d1b156ce2a) verified head `18ebed63330b4b7558fa83eca4f94e6218a38188`, source tree `e8c2369e8acaeae1e31d98977d31b6871a18e904`: **222 tests passed** in nine files / four configurations (266.27 seconds), including both retained build-identity cases and the extracted current-update suite. Core/core-test typechecks, changed-file Oxlint, and Oxfmt passed. That run subsequently stopped at baseline setup because the older baseline tree was absent from the fresh transport; it was not an owner/static failure. [Integrated base-red run](https://crabbox.openclaw.ai/portal/runs/run_41feef571982972198e6c23f52332460) completed the baseline gate using regression files from `18ebed6333` on integrated main `e2de897bf5fc`: expected exit 1, with the original installation-mismatch refusal, absent npm forwarding, and absent resident status facts reproduced. Missing newly added APIs are excluded from original-bug evidence. This closes the earlier missing-tree setup gap without rerunning the already-passed owner/static checks. Two local ClawSweeper rounds were completed. The first found lost restart intent and interception of a pending trial after forwarding failed; both are repaired. The second reviewed `4134b34a13` and found that idempotent start could wait for a trial it had not activated. `46e01ac296` fixes that in the update owner and names the serving version, prepared version, and restart command. No third full review was run under the two-round policy. - Proof head: `46e01ac2967a60726f7c3b6c6ec25d1633646dc4`; source tree `d99cf21ead0e87765a1c6a821e0a7cfcbcc18657`. - [AWS owner/static/base run](https://crabbox.openclaw.ai/portal/runs/run_d48b583c06661f56539cc824040794d1): 220 tests passed across nine files / four Vitest configurations, 222.83 seconds for the focused test command. CI seconds are not yet available. - Core and core-test typechecks passed; changed-file Oxlint reported zero warnings/errors; Oxfmt passed. - Final regression files were copied onto `b0678469a4` in a separately installed baseline. The original npm update cases hit the installation-mismatch refusal, adopted npm forwarding was absent, and resident text/JSON status facts were absent. Missing new internal APIs are not counted as original-bug proof. - [AWS full-build/package run](https://crabbox.openclaw.ai/portal/runs/run_9297457fe50ca3638c219a019a275a87): three full source builds and package preparation passed. T uses state schema 41; source-built T+1 and the separate startup-fault build use schema 42 and distinct build IDs. The fault runs after migration and before listen. These are disposable qualification fixtures, not published releases or a repository schema change. [AWS run and retained artifacts](https://crabbox.openclaw.ai/portal/runs/run_e30ee8c9954fd4adfe8a415000415ea1) completed the required lanes on proof head `46e01ac296`. Independent assertions over the saved CLI, status text/JSON, service snapshots, and journals passed: | Entry point | Observed result | | --- | --- | | Published `2026.11.7` → T → T+1 | First hop reached `2026.11.8-first-hop.0`; conversion committed source-built schema-42 `2026.11.9-next.0`. | | Newer npm → `gateway restart` alone | CLI and observed Gateway both reached `2026.11.10-manual.0`, with one systemd restart. | | Separate newer npm → `update` alone | CLI and Gateway both reached `2026.11.10-manual.0`, with one existing supervisor child restart; the stable launcher was not restarted a second time. | | Older npm → `gateway restart` | `2026.11.10-manual.0` stayed selected/serving; output named `update --tag 2026.11.9-next.0`. | | Failing newer npm → `gateway restart` | The source-built candidate crashed after migration; exit 1 reported `Update failed: new build failed to start; v2026.11.10-manual.0 is still running`. CLI, selected release, and observed Gateway all followed that restored version. | | Newer npm → start while already running | Serving version and PID stayed unchanged; output named the old version, prepared new version, and `gateway restart`. A later restart committed the same pending run. | `openclaw --version`, `update status`, and `update status --json` were captured before and after. This was **not an all-green script**: the later stopped-service start lane failed candidate validation with `unable to open database file`, before publication. The required lanes above remain independently verified; the stopped-service failure is tracked separately below. The later read-only-prefix / pending-start runtime lane did not run after that failure; its forwarding warning and pending-run reuse retain focused test coverage. The additional stopped-service validation failure matches the error and checker owner in [#204227](#204227), concerning a cleanly closed WAL database without SHM. This PR does not change that checker. A comparison build from current main `5454c0e62e` completed ([build run](https://crabbox.openclaw.ai/portal/runs/run_c23776094a368fd5f61e506cc0158554)), but the [control attempt](https://crabbox.openclaw.ai/portal/runs/run_31b93cc9d0cb5193eb9afe01083a8969) was time-boxed during service-reinstallation setup before its plain stopped-service update command. **No main-control pass/fail result is claimed.** No public comment was added to the other maintainer's issue. Real runtime qualification is scoped to Linux systemd and a task-owned named profile. Remote/custom-service exclusions and restart `--force`/`--wait` intent have focused test coverage; this PR does not claim new macOS or Windows runtime proof. The registry is an isolated fixture: its channel target differs from the newer npm-installed artifact, so adoption must use the installed source, not registry latest. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit d761611) Co-authored-by: RomneyDa <[email protected]>
…04515) Closes openclaw#204276 ## What Problem This Solves After conversion to resident releases, installing a newer global npm package changes the CLI but leaves the managed Gateway on the old release. Restart keeps that old release, ordinary update refuses, and update status can incorrectly say “up to date.” ## User Impact User impact: after `npm i -g`, either `openclaw gateway restart` or `openclaw update` applies the installed newer package through the existing release checks and trial. No UUID-specific command or second restart is required. | State | What the user sees | | --- | --- | | Newer npm package | CLI, selected release, and observed Gateway are separate; status recommends `openclaw update`. Restart, or start of a stopped service, applies the installed package through the normal trial. | | Matching version and build | Forwarding is restored; an ordinary restart remains a restart. | | Start while already running | No restart or downtime. Output names the old serving version, the prepared new version, and `openclaw gateway restart` to apply it. | | Same version, different or unknown build | Status names the build difference. Explicit update validates the installed artifact; restart does not assume unknown bytes are identical. | | Older npm package | The newer resident release stays selected. Output names `openclaw update --tag <version>` for a deliberate downgrade. | | Pending trial / `--no-restart` | Forwarding follows the selected release; status names the pending version and its next-start activation. | | Failed preparation | Nothing is published; the same short update command can retry. | | Failed trial | The command exits nonzero with the update owner's rollback cause and restored serving version. The npm entry follows the recovered release, not the failed package. | | Read-only npm tree | A forwarding warning does not undo the Gateway update. The npm entry stays separate. | | Offline or remote Gateway | Running local version is not claimed as verified. Git and Gateway RPC installation identity checks remain in place. | ## Why This Change Was Made The resident release prepares a retained archive of the installed npm package rather than registry latest. Managed lifecycle commands ask it only to prepare, then use their original native activation once, with the user's restart options. An existing pending trial is reused, including when npm forwarding is read-only. After native readiness, the update owner follows the recorded outcome; a healthy rollback is not a successful update. If idempotent start leaves the old Gateway running, the owner reports the still-pending release without waiting for an activation that did not occur. Status reads existing release/trial facts; there is no new schema, protocol, public flag, install hook, or background updater. The explicit local package-to-package policy also admits another global npm prefix for this profile. It does not infer that a markerless package is the original converted tree, and it does not grant that admission to RPC callers or Git checkouts. ## Simplification and boundaries The whole diff was reviewed with pr-simplify. The repair removes a separate native-restart fallback and leaves activation with the existing lifecycle owner, preserving `--force` and `--wait`. The existing outcome formatter is shared rather than copied into native health checks. Packing is retained through preparation, and forwarding uses the existing marker writer. No update/trial manager, installation receipt, RPC field, retry loop, or postinstall action was added. The remaining growth implements the approved package admission, local delegation, single managed activation, archive lifetime, forwarding warning, and factual text/JSON status. Supervisor-health and legacy-release rendering code was moved unchanged to keep their existing modules bounded; moves cancel in the net count. Net against integrated main `fb3745e4050c`: **+448 production TypeScript, +400 tests/support, +29 documentation lines**. This remains above the production estimate. The outcome wait and idempotent-start reporting add 46 production lines to the handed-off +402 tree; they close false-success and unactivated-trial hangs rather than introduce another updater. Overlapping coverage was consolidated by 55 lines; the hosted-runtime archive follow-up adds two ownership-contract lines. No test allocation file was added. ## Evidence ### Hosted Bun expectation follow-up Repair head: `edc9471449d336b96dc9cfa430d3d5a068ec8d88`. The earlier AWS owner run was Node-hosted: `CI=1` defaults the test host to Node, and a fixture row named `runtime: "bun"` changes only the fake installer. CI's hosted Bun lane instead [selects bundled npm](https://github.com/openclaw/openclaw/blob/edc9471449d336b96dc9cfa430d3d5a068ec8d88/src/infra/npm-command.ts#L30-L33), which returns `openclaw-2026.11.21.tgz` rather than the PATH fake's `openclaw.tgz`. The test now requires a present archive directly owned by staging and checks consumption of the returned archive, without prescribing npm's filename. Production code and the recorded Linux behavior are unchanged. [AWS dual-host verification](https://crabbox.openclaw.ai/portal/runs/run_71abf35b21de3b9400055bb314174f41) passed the complete `src/update/prepare.test.ts` file on this head: **36/36 under explicit Node and 36/36 under explicit hosted Bun** using the pinned fork. Lint/format passed, and the test-lines guard passed at **+400 / 400**, with zero allocation credit. The repair is test-only. ### CI ratchet repair PR head: `6acf6fff368faa437b70c75b32f66202b4c3eba0`. The pending trial no longer compares opaque run IDs, and native lifecycle code checks only the boolean preparation-failure result type. Preparation already returned the pending run for this operation. The obsolete closed-mock baseline entry for status's Gateway client was removed, and overlapping test setup/cases were consolidated while retaining native failure/rollback assertions, custom/remote exclusion, and the existing restart-intent suites. [AWS ratchet/prune run](https://crabbox.openclaw.ai/portal/runs/run_77d2c03ad7d573bafb4ffbb4b768949c): session-identity ratchet passed without allowlist changes; mock factories pruned 6122 → 6121 and the normal guard passed; test-lines passed at **+398 / 400**, with zero allocation credit. These are non-behavioral cleanup changes for the recorded Linux flows, so the Linux proof at `46e01ac296` remains applicable. [Frozen-head AWS verification](https://crabbox.openclaw.ai/portal/runs/run_4740daa715b07c92480614ed3c20cdae) passed on `6acf6fff368faa437b70c75b32f66202b4c3eba0` (source tree `636c89bd760fa5d1e32149a85886a61561dc70d8`): all three ratchets, **216 owner tests** in nine files / four configurations (261.44 seconds), core/core-test typechecks, and touched-file lint/format. One repair push contains all three CI fixes. ### Main integration Integrated main `fb3745e4050c`; integration head is `18ebed63330b4b7558fa83eca4f94e6218a38188`. The only conflict was the preparation test case table: both npm-adoption cases and main's rebuilt/installed-artifact cases are retained. The existing already-current suite moved intact to registered test support to keep its owner file below the line cap. The production integration delta auto-merges openclaw#204426's [same-known-build check](https://github.com/openclaw/openclaw/blob/18ebed63330b4b7558fa83eca4f94e6218a38188/src/update/run.ts#L326-L335). It requires a nonempty prepared build ID, **equal version**, and **equal build ID**. [Adoption delegates through the resident launcher](https://github.com/openclaw/openclaw/blob/18ebed63330b4b7558fa83eca4f94e6218a38188/src/update/cli.ts#L159-L166), and [preparation receives that resident's root and VERSION](https://github.com/openclaw/openclaw/blob/18ebed63330b4b7558fa83eca4f94e6218a38188/src/update/cli.ts#L511-L519). Therefore the relabeled newer npm package cannot take this shortcut even with the same build ID; same-version/different-build and unknown-build artifacts cannot either. Only an identical known version/build is current, as intended. No production adoption/restart/status conflict was resolved. The full-build and Linux evidence below remains explicitly at `46e01ac296`, not the integrated head. [Complete integration range](openclaw/openclaw@46e01ac...18ebed6). ### Integrated-head AWS checks [Integrated owner/static run](https://crabbox.openclaw.ai/portal/runs/run_88448c64c0ad803a299e25d1b156ce2a) verified head `18ebed63330b4b7558fa83eca4f94e6218a38188`, source tree `e8c2369e8acaeae1e31d98977d31b6871a18e904`: **222 tests passed** in nine files / four configurations (266.27 seconds), including both retained build-identity cases and the extracted current-update suite. Core/core-test typechecks, changed-file Oxlint, and Oxfmt passed. That run subsequently stopped at baseline setup because the older baseline tree was absent from the fresh transport; it was not an owner/static failure. [Integrated base-red run](https://crabbox.openclaw.ai/portal/runs/run_41feef571982972198e6c23f52332460) completed the baseline gate using regression files from `18ebed6333` on integrated main `fb3745e4050c`: expected exit 1, with the original installation-mismatch refusal, absent npm forwarding, and absent resident status facts reproduced. Missing newly added APIs are excluded from original-bug evidence. This closes the earlier missing-tree setup gap without rerunning the already-passed owner/static checks. ### Local review Two local ClawSweeper rounds were completed. The first found lost restart intent and interception of a pending trial after forwarding failed; both are repaired. The second reviewed `4134b34a13` and found that idempotent start could wait for a trial it had not activated. `46e01ac296` fixes that in the update owner and names the serving version, prepared version, and restart command. No third full review was run under the two-round policy. ### Pre-integration AWS checks - Proof head: `46e01ac2967a60726f7c3b6c6ec25d1633646dc4`; source tree `d99cf21ead0e87765a1c6a821e0a7cfcbcc18657`. - [AWS owner/static/base run](https://crabbox.openclaw.ai/portal/runs/run_d48b583c06661f56539cc824040794d1): 220 tests passed across nine files / four Vitest configurations, 222.83 seconds for the focused test command. CI seconds are not yet available. - Core and core-test typechecks passed; changed-file Oxlint reported zero warnings/errors; Oxfmt passed. - Final regression files were copied onto `5dd8952020` in a separately installed baseline. The original npm update cases hit the installation-mismatch refusal, adopted npm forwarding was absent, and resident text/JSON status facts were absent. Missing new internal APIs are not counted as original-bug proof. - [AWS full-build/package run](https://crabbox.openclaw.ai/portal/runs/run_9297457fe50ca3638c219a019a275a87): three full source builds and package preparation passed. T uses state schema 41; source-built T+1 and the separate startup-fault build use schema 42 and distinct build IDs. The fault runs after migration and before listen. These are disposable qualification fixtures, not published releases or a repository schema change. ### Linux behavior at `46e01ac296` [AWS run and retained artifacts](https://crabbox.openclaw.ai/portal/runs/run_e30ee8c9954fd4adfe8a415000415ea1) completed the required lanes on proof head `46e01ac296`. Independent assertions over the saved CLI, status text/JSON, service snapshots, and journals passed: | Entry point | Observed result | | --- | --- | | Published `2026.11.7` → T → T+1 | First hop reached `2026.11.8-first-hop.0`; conversion committed source-built schema-42 `2026.11.9-next.0`. | | Newer npm → `gateway restart` alone | CLI and observed Gateway both reached `2026.11.10-manual.0`, with one systemd restart. | | Separate newer npm → `update` alone | CLI and Gateway both reached `2026.11.10-manual.0`, with one existing supervisor child restart; the stable launcher was not restarted a second time. | | Older npm → `gateway restart` | `2026.11.10-manual.0` stayed selected/serving; output named `update --tag 2026.11.9-next.0`. | | Failing newer npm → `gateway restart` | The source-built candidate crashed after migration; exit 1 reported `Update failed: new build failed to start; v2026.11.10-manual.0 is still running`. CLI, selected release, and observed Gateway all followed that restored version. | | Newer npm → start while already running | Serving version and PID stayed unchanged; output named the old version, prepared new version, and `gateway restart`. A later restart committed the same pending run. | `openclaw --version`, `update status`, and `update status --json` were captured before and after. This was **not an all-green script**: the later stopped-service start lane failed candidate validation with `unable to open database file`, before publication. The required lanes above remain independently verified; the stopped-service failure is tracked separately below. The later read-only-prefix / pending-start runtime lane did not run after that failure; its forwarding warning and pending-run reuse retain focused test coverage. ### Related stopped-service failure The additional stopped-service validation failure matches the error and checker owner in [openclaw#204227](openclaw#204227), concerning a cleanly closed WAL database without SHM. This PR does not change that checker. A comparison build from current main `259f82d011` completed ([build run](https://crabbox.openclaw.ai/portal/runs/run_c23776094a368fd5f61e506cc0158554)), but the [control attempt](https://crabbox.openclaw.ai/portal/runs/run_31b93cc9d0cb5193eb9afe01083a8969) was time-boxed during service-reinstallation setup before its plain stopped-service update command. **No main-control pass/fail result is claimed.** No public comment was added to the other maintainer's issue. ### Coverage limits Real runtime qualification is scoped to Linux systemd and a task-owned named profile. Remote/custom-service exclusions and restart `--force`/`--wait` intent have focused test coverage; this PR does not claim new macOS or Windows runtime proof. The registry is an isolated fixture: its channel target differs from the newer npm-installed artifact, so adoption must use the installed source, not registry latest. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Two update paths could claim the same installation. A converted install could fall into the retained in-place updater; reinstalling its Gateway from an unmarked npm entry could replace the resident launcher. Before first conversion, a different npm root could also claim an empty state slot. Node-only hosts were sent into a Gateway trial with nobody to activate it. Related: #204516, #203807, #204266, and the converted-install legacy fall-through. #203628's runtime selection is a separate release-runtime issue, not changed here. #204515 npm adoption behavior is retained. ## User Impact - Converted installs stay with their resident launcher. Installer-kind switches and immutable activation refuse with a reason and next step instead of replacing it; dry runs retain the existing read-only preview. - Ordinary and planned Gateway service installs select the verified launcher for the captured state directory; explicit retained recovery entrypoints still win. - Before conversion, node-only package installs with a node service but no Gateway definition or live local Gateway keep their package route; no launcher, forwarding entry or pending Gateway trial is created. Node-only Git checkouts keep the release updater and requested `--sha`. Already-converted installs keep their resident release owner, including `--no-restart` preparation after the Gateway service was removed. - Node-only package results name the updated installation's `node install --force` and `node restart` commands. They do not claim a retained node runtime was restarted, and guidance consumes captured result facts without a new service scan or state read. - Documented versions, dist-tags, npm specs/artifacts, deferred restart and implicit Git channel selection keep their existing behavior. - Windows process snapshots honor the existing native inspection budget instead of two hidden five-second ceilings. Unknown inspection remains distinct from proof that a service stopped. ## Ownership Cut The existing admission adapter owns the release-versus-package decision; the complete release routing block moved there to keep `update-command.ts` below its 700-line ratchet. The same read-only ownership guard stays before CLI cleanup/run creation and is rechecked under preparation's lock. Final service argument selection replaces the old invocation-based launcher selector. No new persistent state, schema, marker or flag. After the single custody integration, production `tokei` code on this PR's eleven touched runtime files, excluding tests/support/harness: **4,595 → 4,814 (+219)** against integrated main `8aaf3820112a4755d9aebb431e6c247b6d5d5412`. Shared native-observer changes already landed in #204868 and are no longer counted here. No unrelated deletion was used to meet a line quota. ## Evidence AWS [targeted proof](https://crabbox.openclaw.ai/portal/runs/run_8314f1f6e7468775618b5e1b8125915c) passed **151 tests across nine files**: routing 14, service entry/planning 62, Windows inspection 75. These lanes ran independently on Linux; the Windows lane uses native-inspection mocks, not a Windows live claim. Runtime source is `b59eee4e13b3a71725b69a914211eea9e7ae75ad`; the subsequent commit is documentation-only. The [qualified base comparison](https://crabbox.openclaw.ai/portal/runs/run_59926da4d8eb490b0855d67398d0fcd1) has **18 intended assertion failures and 133 passing controls**: routing eight, service-entry/planning four, inspection budgets six. Earlier archived-checkout dependency failures were fixture setup, not product reds; fixed green lanes were not rerun for that repair. ## Integration and remaining proof The scheduled-task SQL-to-file observer hunk is shared with #204868; the second PR to land rebases the identical hunk rather than maintaining an independent variant. A rare first-conversion refusal applies when a live foreground Gateway's root is opaque and it cannot accept the requested update over RPC. With operator access, the Gateway can classify its own argv and handle `update.run`. Otherwise the message offers Control UI/operator-access update or stopping the Gateway through its existing owner and rerunning. No lock or protocol field was added. Against integrated main, the test change measures **+740 lines**, with **340 reviewed allocation lines** above the normal 400-line allowance. `config/test-lines-allocations/204866-install-update-owner.txt` maps the thirteen changed test files to their contracts; upstream-owned native-observer credit was removed. Existing controls preserve package routing, Git SHA, converted/legacy ownership and immutable inspection-only output. The two existing legacy-layout launcher cases in `git-release.test.ts` now pass the captured state environment and `{ planned: entry }`, retaining both launcher and legacy path assertions. An explicit string entrypoint is reserved for `--restore-service-cli` and must win over ordinary launcher selection; those cases represent ordinary installation planning, not recovery. The retained legacy service-staging producer resolves its release launcher before passing an explicit service CLI (`d831dde27f`). CI on that head proved the three unchanged no-restart staging cases red: the selector still treated the explicit launcher as a package CLI root. `dd83c4f630` repairs that single selector by directly selecting a recognized accessible Gateway launcher, preserving Node and other recovery strings. [Focused AWS proof](https://crabbox.openclaw.ai/portal/runs/run_cfcb09aada70caf4e34f1ea6f25fb287) passed all three regressions, the existing launcher control, and all four service-entry controls: **8 passed**, unchanged assertions. The 38 unrelated service cases were intentionally excluded by the focused name filter. Final head `2536f8aea4` passed [CI](https://github.com/openclaw/openclaw/actions/runs/45544076053) and the [security/aggregate gate](https://github.com/openclaw/openclaw/actions/runs/45548330474): **70 successful checks, none pending or failed**. It differs from reviewed/Linux-qualified `48e606149e` only by three local test-helper rename substitutions fixing no-shadow; assertions and production bytes are identical. Main's exact-head and delta reviews are clean. - [Integrated AWS qualification](https://crabbox.openclaw.ai/portal/runs/run_e165cd4d147a24e0808417237069d4ae) passed: current owner/preview/merge controls, full build, package integrity, and real Linux stable **2026.11.9** upgrade flows. Deferred conversion staged the launcher and committed on public restart; read-only-npm PATH service reinstall kept launcher ExecStart, committed the same pending trial, and the following update committed. A converted node-only install prepared a pending release without activating it; an unconverted node-only install used npm with no trial and named exact install/restart commands rather than claiming activation. Source `48e606149e` is production-identical to final `2536f8aea4`. Healthy relabels retain that source; this is not a schema-bump or live-Windows claim. Historical shallow-Git setup failed before tests and is not a merge gate. - Windows 11 ARM64 status/restart follows the exclusively owned custody lane; per maintainer direction it can be recorded after landing. No live-Windows pass is claimed. - All requested landing gates are green. The single required custody merge is complete; Main owns landing. No further scope or merge is planned. Launcher manifest, budget and one-strike changes are deliberately outside this PR. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Two update paths could claim the same installation. A converted install could fall into the retained in-place updater; reinstalling its Gateway from an unmarked npm entry could replace the resident launcher. Before first conversion, a different npm root could also claim an empty state slot. Node-only hosts were sent into a Gateway trial with nobody to activate it. Related: openclaw#204516, openclaw#203807, openclaw#204266, and the converted-install legacy fall-through. openclaw#203628's runtime selection is a separate release-runtime issue, not changed here. openclaw#204515 npm adoption behavior is retained. ## User Impact - Converted installs stay with their resident launcher. Installer-kind switches and immutable activation refuse with a reason and next step instead of replacing it; dry runs retain the existing read-only preview. - Ordinary and planned Gateway service installs select the verified launcher for the captured state directory; explicit retained recovery entrypoints still win. - Before conversion, node-only package installs with a node service but no Gateway definition or live local Gateway keep their package route; no launcher, forwarding entry or pending Gateway trial is created. Node-only Git checkouts keep the release updater and requested `--sha`. Already-converted installs keep their resident release owner, including `--no-restart` preparation after the Gateway service was removed. - Node-only package results name the updated installation's `node install --force` and `node restart` commands. They do not claim a retained node runtime was restarted, and guidance consumes captured result facts without a new service scan or state read. - Documented versions, dist-tags, npm specs/artifacts, deferred restart and implicit Git channel selection keep their existing behavior. - Windows process snapshots honor the existing native inspection budget instead of two hidden five-second ceilings. Unknown inspection remains distinct from proof that a service stopped. ## Ownership Cut The existing admission adapter owns the release-versus-package decision; the complete release routing block moved there to keep `update-command.ts` below its 700-line ratchet. The same read-only ownership guard stays before CLI cleanup/run creation and is rechecked under preparation's lock. Final service argument selection replaces the old invocation-based launcher selector. No new persistent state, schema, marker or flag. After the single custody integration, production `tokei` code on this PR's eleven touched runtime files, excluding tests/support/harness: **4,595 → 4,814 (+219)** against integrated main `44d311177c0f4e86eb4ecb6828371c9eaa81b4f6`. Shared native-observer changes already landed in openclaw#204868 and are no longer counted here. No unrelated deletion was used to meet a line quota. ## Evidence AWS [targeted proof](https://crabbox.openclaw.ai/portal/runs/run_8314f1f6e7468775618b5e1b8125915c) passed **151 tests across nine files**: routing 14, service entry/planning 62, Windows inspection 75. These lanes ran independently on Linux; the Windows lane uses native-inspection mocks, not a Windows live claim. Runtime source is `b59eee4e13b3a71725b69a914211eea9e7ae75ad`; the subsequent commit is documentation-only. The [qualified base comparison](https://crabbox.openclaw.ai/portal/runs/run_59926da4d8eb490b0855d67398d0fcd1) has **18 intended assertion failures and 133 passing controls**: routing eight, service-entry/planning four, inspection budgets six. Earlier archived-checkout dependency failures were fixture setup, not product reds; fixed green lanes were not rerun for that repair. ## Integration and remaining proof The scheduled-task SQL-to-file observer hunk is shared with openclaw#204868; the second PR to land rebases the identical hunk rather than maintaining an independent variant. A rare first-conversion refusal applies when a live foreground Gateway's root is opaque and it cannot accept the requested update over RPC. With operator access, the Gateway can classify its own argv and handle `update.run`. Otherwise the message offers Control UI/operator-access update or stopping the Gateway through its existing owner and rerunning. No lock or protocol field was added. Against integrated main, the test change measures **+740 lines**, with **340 reviewed allocation lines** above the normal 400-line allowance. `config/test-lines-allocations/204866-install-update-owner.txt` maps the thirteen changed test files to their contracts; upstream-owned native-observer credit was removed. Existing controls preserve package routing, Git SHA, converted/legacy ownership and immutable inspection-only output. The two existing legacy-layout launcher cases in `git-release.test.ts` now pass the captured state environment and `{ planned: entry }`, retaining both launcher and legacy path assertions. An explicit string entrypoint is reserved for `--restore-service-cli` and must win over ordinary launcher selection; those cases represent ordinary installation planning, not recovery. The retained legacy service-staging producer resolves its release launcher before passing an explicit service CLI (`d831dde27f`). CI on that head proved the three unchanged no-restart staging cases red: the selector still treated the explicit launcher as a package CLI root. `dd83c4f630` repairs that single selector by directly selecting a recognized accessible Gateway launcher, preserving Node and other recovery strings. [Focused AWS proof](https://crabbox.openclaw.ai/portal/runs/run_cfcb09aada70caf4e34f1ea6f25fb287) passed all three regressions, the existing launcher control, and all four service-entry controls: **8 passed**, unchanged assertions. The 38 unrelated service cases were intentionally excluded by the focused name filter. Final head `2536f8aea4` passed [CI](https://github.com/openclaw/openclaw/actions/runs/45544076053) and the [security/aggregate gate](https://github.com/openclaw/openclaw/actions/runs/45548330474): **70 successful checks, none pending or failed**. It differs from reviewed/Linux-qualified `48e606149e` only by three local test-helper rename substitutions fixing no-shadow; assertions and production bytes are identical. Main's exact-head and delta reviews are clean. - [Integrated AWS qualification](https://crabbox.openclaw.ai/portal/runs/run_e165cd4d147a24e0808417237069d4ae) passed: current owner/preview/merge controls, full build, package integrity, and real Linux stable **2026.11.9** upgrade flows. Deferred conversion staged the launcher and committed on public restart; read-only-npm PATH service reinstall kept launcher ExecStart, committed the same pending trial, and the following update committed. A converted node-only install prepared a pending release without activating it; an unconverted node-only install used npm with no trial and named exact install/restart commands rather than claiming activation. Source `48e606149e` is production-identical to final `2536f8aea4`. Healthy relabels retain that source; this is not a schema-bump or live-Windows claim. Historical shallow-Git setup failed before tests and is not a merge gate. - Windows 11 ARM64 status/restart follows the exclusively owned custody lane; per maintainer direction it can be recorded after landing. No live-Windows pass is claimed. - All requested landing gates are green. The single required custody merge is complete; Main owns landing. No further scope or merge is planned. Launcher manifest, budget and one-strike changes are deliberately outside this PR. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Two update paths could claim the same installation. A converted install could fall into the retained in-place updater; reinstalling its Gateway from an unmarked npm entry could replace the resident launcher. Before first conversion, a different npm root could also claim an empty state slot. Node-only hosts were sent into a Gateway trial with nobody to activate it. Related: #204516, #203807, #204266, and the converted-install legacy fall-through. #203628's runtime selection is a separate release-runtime issue, not changed here. #204515 npm adoption behavior is retained. ## User Impact - Converted installs stay with their resident launcher. Installer-kind switches and immutable activation refuse with a reason and next step instead of replacing it; dry runs retain the existing read-only preview. - Ordinary and planned Gateway service installs select the verified launcher for the captured state directory; explicit retained recovery entrypoints still win. - Before conversion, node-only package installs with a node service but no Gateway definition or live local Gateway keep their package route; no launcher, forwarding entry or pending Gateway trial is created. Node-only Git checkouts keep the release updater and requested `--sha`. Already-converted installs keep their resident release owner, including `--no-restart` preparation after the Gateway service was removed. - Node-only package results name the updated installation's `node install --force` and `node restart` commands. They do not claim a retained node runtime was restarted, and guidance consumes captured result facts without a new service scan or state read. - Documented versions, dist-tags, npm specs/artifacts, deferred restart and implicit Git channel selection keep their existing behavior. - Windows process snapshots honor the existing native inspection budget instead of two hidden five-second ceilings. Unknown inspection remains distinct from proof that a service stopped. ## Ownership Cut The existing admission adapter owns the release-versus-package decision; the complete release routing block moved there to keep `update-command.ts` below its 700-line ratchet. The same read-only ownership guard stays before CLI cleanup/run creation and is rechecked under preparation's lock. Final service argument selection replaces the old invocation-based launcher selector. No new persistent state, schema, marker or flag. After the single custody integration, production `tokei` code on this PR's eleven touched runtime files, excluding tests/support/harness: **4,595 → 4,814 (+219)** against integrated main `8aaf3820112a4755d9aebb431e6c247b6d5d5412`. Shared native-observer changes already landed in #204868 and are no longer counted here. No unrelated deletion was used to meet a line quota. ## Evidence AWS [targeted proof](https://crabbox.openclaw.ai/portal/runs/run_8314f1f6e7468775618b5e1b8125915c) passed **151 tests across nine files**: routing 14, service entry/planning 62, Windows inspection 75. These lanes ran independently on Linux; the Windows lane uses native-inspection mocks, not a Windows live claim. Runtime source is `b59eee4e13b3a71725b69a914211eea9e7ae75ad`; the subsequent commit is documentation-only. The [qualified base comparison](https://crabbox.openclaw.ai/portal/runs/run_59926da4d8eb490b0855d67398d0fcd1) has **18 intended assertion failures and 133 passing controls**: routing eight, service-entry/planning four, inspection budgets six. Earlier archived-checkout dependency failures were fixture setup, not product reds; fixed green lanes were not rerun for that repair. ## Integration and remaining proof The scheduled-task SQL-to-file observer hunk is shared with #204868; the second PR to land rebases the identical hunk rather than maintaining an independent variant. A rare first-conversion refusal applies when a live foreground Gateway's root is opaque and it cannot accept the requested update over RPC. With operator access, the Gateway can classify its own argv and handle `update.run`. Otherwise the message offers Control UI/operator-access update or stopping the Gateway through its existing owner and rerunning. No lock or protocol field was added. Against integrated main, the test change measures **+740 lines**, with **340 reviewed allocation lines** above the normal 400-line allowance. `config/test-lines-allocations/204866-install-update-owner.txt` maps the thirteen changed test files to their contracts; upstream-owned native-observer credit was removed. Existing controls preserve package routing, Git SHA, converted/legacy ownership and immutable inspection-only output. The two existing legacy-layout launcher cases in `git-release.test.ts` now pass the captured state environment and `{ planned: entry }`, retaining both launcher and legacy path assertions. An explicit string entrypoint is reserved for `--restore-service-cli` and must win over ordinary launcher selection; those cases represent ordinary installation planning, not recovery. The retained legacy service-staging producer resolves its release launcher before passing an explicit service CLI (`d831dde27f`). CI on that head proved the three unchanged no-restart staging cases red: the selector still treated the explicit launcher as a package CLI root. `dd83c4f630` repairs that single selector by directly selecting a recognized accessible Gateway launcher, preserving Node and other recovery strings. [Focused AWS proof](https://crabbox.openclaw.ai/portal/runs/run_cfcb09aada70caf4e34f1ea6f25fb287) passed all three regressions, the existing launcher control, and all four service-entry controls: **8 passed**, unchanged assertions. The 38 unrelated service cases were intentionally excluded by the focused name filter. Final head `2536f8aea4` passed [CI](https://github.com/openclaw/openclaw/actions/runs/45544076053) and the [security/aggregate gate](https://github.com/openclaw/openclaw/actions/runs/45548330474): **70 successful checks, none pending or failed**. It differs from reviewed/Linux-qualified `48e606149e` only by three local test-helper rename substitutions fixing no-shadow; assertions and production bytes are identical. Main's exact-head and delta reviews are clean. - [Integrated AWS qualification](https://crabbox.openclaw.ai/portal/runs/run_e165cd4d147a24e0808417237069d4ae) passed: current owner/preview/merge controls, full build, package integrity, and real Linux stable **2026.11.9** upgrade flows. Deferred conversion staged the launcher and committed on public restart; read-only-npm PATH service reinstall kept launcher ExecStart, committed the same pending trial, and the following update committed. A converted node-only install prepared a pending release without activating it; an unconverted node-only install used npm with no trial and named exact install/restart commands rather than claiming activation. Source `48e606149e` is production-identical to final `2536f8aea4`. Healthy relabels retain that source; this is not a schema-bump or live-Windows claim. Historical shallow-Git setup failed before tests and is not a merge gate. - Windows 11 ARM64 status/restart follows the exclusively owned custody lane; per maintainer direction it can be recorded after landing. No live-Windows pass is claimed. - All requested landing gates are green. The single required custody merge is complete; Main owns landing. No further scope or merge is planned. Launcher manifest, budget and one-strike changes are deliberately outside this PR. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 0fea252) Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Closes #204276
What Problem This Solves
After conversion to resident releases, installing a newer global npm package changes the CLI but leaves the managed Gateway on the old release. Restart keeps that old release, ordinary update refuses, and update status can incorrectly say “up to date.”
User Impact
User impact: after
npm i -g, eitheropenclaw gateway restartoropenclaw updateapplies the installed newer package through the existing release checks and trial. No UUID-specific command or second restart is required.openclaw update. Restart, or start of a stopped service, applies the installed package through the normal trial.openclaw gateway restartto apply it.openclaw update --tag <version>for a deliberate downgrade.--no-restartWhy This Change Was Made
The resident release prepares a retained archive of the installed npm package rather than registry latest. Managed lifecycle commands ask it only to prepare, then use their original native activation once, with the user's restart options. An existing pending trial is reused, including when npm forwarding is read-only. After native readiness, the update owner follows the recorded outcome; a healthy rollback is not a successful update. If idempotent start leaves the old Gateway running, the owner reports the still-pending release without waiting for an activation that did not occur. Status reads existing release/trial facts; there is no new schema, protocol, public flag, install hook, or background updater.
The explicit local package-to-package policy also admits another global npm prefix for this profile. It does not infer that a markerless package is the original converted tree, and it does not grant that admission to RPC callers or Git checkouts.
Simplification and boundaries
The whole diff was reviewed with pr-simplify. The repair removes a separate native-restart fallback and leaves activation with the existing lifecycle owner, preserving
--forceand--wait. The existing outcome formatter is shared rather than copied into native health checks. Packing is retained through preparation, and forwarding uses the existing marker writer. No update/trial manager, installation receipt, RPC field, retry loop, or postinstall action was added.The remaining growth implements the approved package admission, local delegation, single managed activation, archive lifetime, forwarding warning, and factual text/JSON status. Supervisor-health and legacy-release rendering code was moved unchanged to keep their existing modules bounded; moves cancel in the net count.
Net against integrated main
e2de897bf5fc: +448 production TypeScript, +400 tests/support, +29 documentation lines. This remains above the production estimate. The outcome wait and idempotent-start reporting add 46 production lines to the handed-off +402 tree; they close false-success and unactivated-trial hangs rather than introduce another updater. Overlapping coverage was consolidated by 55 lines; the hosted-runtime archive follow-up adds two ownership-contract lines. No test allocation file was added.Evidence
Hosted Bun expectation follow-up
Repair head:
edc9471449d336b96dc9cfa430d3d5a068ec8d88. The earlier AWS owner run was Node-hosted:CI=1defaults the test host to Node, and a fixture row namedruntime: "bun"changes only the fake installer. CI's hosted Bun lane instead selects bundled npm, which returnsopenclaw-2026.11.21.tgzrather than the PATH fake'sopenclaw.tgz. The test now requires a present archive directly owned by staging and checks consumption of the returned archive, without prescribing npm's filename. Production code and the recorded Linux behavior are unchanged.AWS dual-host verification passed the complete
src/update/prepare.test.tsfile on this head: 36/36 under explicit Node and 36/36 under explicit hosted Bun using the pinned fork. Lint/format passed, and the test-lines guard passed at +400 / 400, with zero allocation credit. The repair is test-only.CI ratchet repair
PR head:
6acf6fff368faa437b70c75b32f66202b4c3eba0. The pending trial no longer compares opaque run IDs, and native lifecycle code checks only the boolean preparation-failure result type. Preparation already returned the pending run for this operation. The obsolete closed-mock baseline entry for status's Gateway client was removed, and overlapping test setup/cases were consolidated while retaining native failure/rollback assertions, custom/remote exclusion, and the existing restart-intent suites.AWS ratchet/prune run: session-identity ratchet passed without allowlist changes; mock factories pruned 6122 → 6121 and the normal guard passed; test-lines passed at +398 / 400, with zero allocation credit. These are non-behavioral cleanup changes for the recorded Linux flows, so the Linux proof at
46e01ac296remains applicable.Frozen-head AWS verification passed on
6acf6fff368faa437b70c75b32f66202b4c3eba0(source tree636c89bd760fa5d1e32149a85886a61561dc70d8): all three ratchets, 216 owner tests in nine files / four configurations (261.44 seconds), core/core-test typechecks, and touched-file lint/format. One repair push contains all three CI fixes.Main integration
Integrated main
e2de897bf5fc; integration head is18ebed63330b4b7558fa83eca4f94e6218a38188. The only conflict was the preparation test case table: both npm-adoption cases and main's rebuilt/installed-artifact cases are retained. The existing already-current suite moved intact to registered test support to keep its owner file below the line cap.The production integration delta auto-merges #204426's same-known-build check. It requires a nonempty prepared build ID, equal version, and equal build ID. Adoption delegates through the resident launcher, and preparation receives that resident's root and VERSION. Therefore the relabeled newer npm package cannot take this shortcut even with the same build ID; same-version/different-build and unknown-build artifacts cannot either. Only an identical known version/build is current, as intended.
No production adoption/restart/status conflict was resolved. The full-build and Linux evidence below remains explicitly at
46e01ac296, not the integrated head. Complete integration range.Integrated-head AWS checks
Integrated owner/static run verified head
18ebed63330b4b7558fa83eca4f94e6218a38188, source treee8c2369e8acaeae1e31d98977d31b6871a18e904: 222 tests passed in nine files / four configurations (266.27 seconds), including both retained build-identity cases and the extracted current-update suite. Core/core-test typechecks, changed-file Oxlint, and Oxfmt passed. That run subsequently stopped at baseline setup because the older baseline tree was absent from the fresh transport; it was not an owner/static failure.Integrated base-red run completed the baseline gate using regression files from
18ebed6333on integrated maine2de897bf5fc: expected exit 1, with the original installation-mismatch refusal, absent npm forwarding, and absent resident status facts reproduced. Missing newly added APIs are excluded from original-bug evidence. This closes the earlier missing-tree setup gap without rerunning the already-passed owner/static checks.Local review
Two local ClawSweeper rounds were completed. The first found lost restart intent and interception of a pending trial after forwarding failed; both are repaired. The second reviewed
4134b34a13and found that idempotent start could wait for a trial it had not activated.46e01ac296fixes that in the update owner and names the serving version, prepared version, and restart command. No third full review was run under the two-round policy.Pre-integration AWS checks
Proof head:
46e01ac2967a60726f7c3b6c6ec25d1633646dc4; source treed99cf21ead0e87765a1c6a821e0a7cfcbcc18657.AWS owner/static/base run: 220 tests passed across nine files / four Vitest configurations, 222.83 seconds for the focused test command. CI seconds are not yet available.
Core and core-test typechecks passed; changed-file Oxlint reported zero warnings/errors; Oxfmt passed.
Final regression files were copied onto
b0678469a4in a separately installed baseline. The original npm update cases hit the installation-mismatch refusal, adopted npm forwarding was absent, and resident text/JSON status facts were absent. Missing new internal APIs are not counted as original-bug proof.AWS full-build/package run: three full source builds and package preparation passed. T uses state schema 41; source-built T+1 and the separate startup-fault build use schema 42 and distinct build IDs. The fault runs after migration and before listen. These are disposable qualification fixtures, not published releases or a repository schema change.
Linux behavior at
46e01ac296AWS run and retained artifacts completed the required lanes on proof head
46e01ac296. Independent assertions over the saved CLI, status text/JSON, service snapshots, and journals passed:2026.11.7→ T → T+12026.11.8-first-hop.0; conversion committed source-built schema-422026.11.9-next.0.gateway restartalone2026.11.10-manual.0, with one systemd restart.updatealone2026.11.10-manual.0, with one existing supervisor child restart; the stable launcher was not restarted a second time.gateway restart2026.11.10-manual.0stayed selected/serving; output namedupdate --tag 2026.11.9-next.0.gateway restartUpdate failed: new build failed to start; v2026.11.10-manual.0 is still running. CLI, selected release, and observed Gateway all followed that restored version.gateway restart. A later restart committed the same pending run.openclaw --version,update status, andupdate status --jsonwere captured before and after. This was not an all-green script: the later stopped-service start lane failed candidate validation withunable to open database file, before publication. The required lanes above remain independently verified; the stopped-service failure is tracked separately below.The later read-only-prefix / pending-start runtime lane did not run after that failure; its forwarding warning and pending-run reuse retain focused test coverage.
Related stopped-service failure
The additional stopped-service validation failure matches the error and checker owner in #204227, concerning a cleanly closed WAL database without SHM. This PR does not change that checker. A comparison build from current main
5454c0e62ecompleted (build run), but the control attempt was time-boxed during service-reinstallation setup before its plain stopped-service update command. No main-control pass/fail result is claimed. No public comment was added to the other maintainer's issue.Coverage limits
Real runtime qualification is scoped to Linux systemd and a task-owned named profile. Remote/custom-service exclusions and restart
--force/--waitintent have focused test coverage; this PR does not claim new macOS or Windows runtime proof. The registry is an isolated fixture: its channel target differs from the newer npm-installed artifact, so adoption must use the installed source, not registry latest.