Skip to content

fix: apply newer npm installs when restarting the Gateway - #204515

Merged
obviyus merged 7 commits into
mainfrom
fix/npm-resident-adoption-204276-v2
Nov 24, 2026
Merged

obviyus merged 7 commits into
mainfrom
fix/npm-resident-adoption-204276-v2

Conversation

@obviyus

@obviyus obviyus commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

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, 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 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=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, 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 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: 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 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 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. 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 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 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.

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: 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: 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 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 #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), 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/--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.

- 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.
@clawsweeper

clawsweeper Bot commented Nov 24, 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 docs Improvements or additions to documentation cli CLI command changes size: XL labels Nov 24, 2026
…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.
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: Gateway restart keeps 2026.11.9-next.0, ordinary update refuses, and status can report up to date.
  • After: Gateway restart validates and activates 2026.11.10-manual.0 through the existing trial and rollback owner.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful repair with concrete production-entry-point evidence and one actionable status-guidance defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The complete final-head evidence records real Linux CLI and systemd adoption, single activation, rollback failure reporting, and idempotent start; stopped-service validation failed separately, and the read-only-prefix runtime lane did not run.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After npm installs a newer package, restart can retain an older Gateway while status incorrectly reports freshness.
Reason: The reported workflow has a concrete recovery defect, and maintainer authorship supplies direction for the explicit local package-adoption policy.

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
Reviewed head: 46e01ac2967a60726f7c3b6c6ec25d1633646dc4

Before merge

  • [P2] Recommend activation when an npm adoption trial is pending (P2) - With a read-only global npm tree, preparation can succeed while forwarding fails, leaving the newer npm CLI separate and its trial pending. For example, CLI 2026.11.10-manual.0 beside selected 2026.11.9-next.0 produces releaseStatus.notice ending in Run: openclaw update, including in update status --json. Following that instruction delegates another preparation, which src/update/run.ts:144-149 rejects with update-running; waiting does not activate a pending trial. Select the profile-aware openclaw gateway restart command when trial.phase is pending, and cover the combined newer-CLI/pending-trial case in the existing status suite.
  • Complete next step - The author should resolve GitHub's reported merge conflicts with main and rerun checks affected by the resolution.

Findings

  • [P2] [P2] Recommend activation when an npm adoption trial is pending — src/cli/update-cli/status-releases.ts:94-98
Agent review details

How this fits together

The 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
Loading

Technical review

Best 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:

  • [P2] [P2] Recommend activation when an npm adoption trial is pending — src/cli/update-cli/status-releases.ts:94-98
    With a read-only global npm tree, preparation can succeed while forwarding fails, leaving the newer npm CLI separate and its trial pending. For example, CLI 2026.11.10-manual.0 beside selected 2026.11.9-next.0 produces releaseStatus.notice ending in Run: openclaw update, including in update status --json. Following that instruction delegates another preparation, which src/update/run.ts:144-149 rejects with update-running; waiting does not activate a pending trial. Select the profile-aware openclaw gateway restart command when trial.phase is pending, and cover the combined newer-CLI/pending-trial case in the existing status suite.
    Confidence: 0.96
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 947cc1fa83ed.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/cli/update-cli/status.test.ts src/cli/update-cli/status.snapshot.test.ts src/update/cli.test.ts
  • pnpm tsgo:core
  • git diff --check

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit b3e8b85 adds src/update/installation-identity.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b3e8b8551095; files: src/update/installation-identity.ts)

PR surface

Source +448, Tests +432, Docs +29. Total +909 across 15 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 620 172 +448
Tests 5 460 28 +432
Docs 1 29 0 +29
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 1109 200 +909

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #204276
Summary: This PR repairs the npm reinstall and resident-release divergence documented by the linked issue.

Members:

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

Labels

Label changes:

  • add P2: The advanced npm reinstall workflow produces misleading status and cumbersome recovery while the existing Gateway remains available.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The advanced npm reinstall workflow produces misleading status and cumbersome recovery while the existing Gateway remains available.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 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.
@obviyus

obviyus commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: the only CI red on head edc9471449d3 is not caused by this PR.

ci-triage:

checks-node-changed	src/agents/subagents/registry/subagent-registry.requester-wake.e2e.test.ts
  • The six "settles requester receipts" cases (visible final, transition drift, outcome drift, reply replacement, delivery replacement, empty reply) time out at 120 s. The other 44 cases pass. This happened in both CI attempts of run 45372743932 and in one AWS run on this head.
  • The same six cases time out at 120 s on main (merge base c237dbd5bf18) with the same command, and the other 44 pass there too: fix: let finished background commands reach the agent before an active goal advances #204265 (comment)
  • This PR changes no file under src/agents/subagents/.
  • openclaw/ci-gate fails only because it waits on that job.

@obviyus
obviyus merged commit d761611 into main Nov 24, 2026
227 of 232 checks passed
@obviyus
obviyus deleted the fix/npm-resident-adoption-204276-v2 branch November 24, 2026 11:42
@obviyus

obviyus commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as d761611.

  • Problem: after an install moved to the release launcher, npm i -g openclaw@<newer> changed only the CLI. The Gateway stayed on the old release, openclaw update refused with a long node …/openclaw.mjs update command, and update status said "up to date".
  • Fix: openclaw update and a managed openclaw gateway restart from the newer npm copy now apply that package through the normal release checks, trial and rollback. A failed trial is reported with the version that still serves. An older npm package never downgrades the Gateway; the output names openclaw update --tag <version>. update status shows the CLI, the selected release and the Gateway separately.
  • Proof: Linux upgrade lanes (restart alone, update alone, older package, failing candidate) passed on the proof head; tests, typecheck, lint and full build passed on the landed head. The only CI red also fails on main (override above).

Known gap, tracked separately: a stopped service whose database has no shared-memory file still fails the release check (#204227).

tideclaw-bot pushed a commit that referenced this pull request Nov 25, 2026
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…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]>
obviyus added a commit that referenced this pull request Nov 25, 2026
## 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
## 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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 26, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: npm reinstall after release conversion hides CLI/Gateway version split in update status

1 participant