Repository navigation
fix(ui): show app updates outside the conversation - #203357
Conversation
OpenClaw-Publication: 6bd61228-c411-4fb8-aca2-fd4d11db4504
|
🦞👀 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. |
Clean comparisonBefore — update notice in the conversation After — status in the top-right toast Annotated comparisonProduction Control UI builds with a synthetic Gateway and an empty conversation. Before: |
|
Codex review: blocked before merge. What this changesThis PR moves browser and desktop conversation update notices into a persistent, localized toast backed by the existing update record. Example: An update requested in Control UI reaches staging.
Review scores
ProductKind: Preference · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep this maintainer-authored draft open: the presentation change is useful, but a persistence defect needs repair before merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherGateway update admission records the requesting transport’s presentation choice; the durable update ledger supplies progress and outcomes to Control UI, while other clients retain transcript or channel delivery. flowchart LR
A[Conversation update request] --> B[Gateway update admission]
B --> C[Durable update ledger]
C --> D[Update watcher and reconnect]
D --> E[Control UI overlay]
E --> F[Persistent toast]
C --> G[Existing chat notice delivery]
Technical reviewBest possible solution: Preserve the app presentation enum through the existing ledger compaction owner, retaining the shared overlay, toast, and non-app delivery paths. Do we have a high-confidence way to reproduce the issue? Source tracing establishes the compaction failure: add noticeSurface="app" to the existing overflow fixture, then finish the run with its additional guidance; compaction changes the literal before decode. No target code or tests were executed during this read-only review. Is this the best way to solve the issue? Reusing the durable ledger and existing toast owner is appropriate; the persisted enum must participate in the codec’s existing exact-value preservation contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 41dce5629f27. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +186, Tests +114, Docs +6. Total +306 across 22 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. 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 21, 2026, 7:03 PM ET / November 22, 2026, 00:03 UTC. |
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…emaining budget - Control UI and desktop requests on a Git install record the app notice surface and broadcast the run, as package installs do since #203357, instead of writing chat notices. - The release build receives only what remains of the --timeout budget.
* fix(ui): show app updates outside the conversation * fix(ui): show app updates outside the conversation OpenClaw-Publication: 6bd61228-c411-4fb8-aca2-fd4d11db4504 * fix(gateway): finish in-app update refusals in the same notice * test(gateway): build a complete question client handshake
- pnpm gateway:validators:gen; picks up update.run noticeInApp from #203357.
…#203413) ## Problem `build-artifacts` is red on `main`: the `pnpm validators:check` step fails with ``` Error: packages/gateway-protocol/src/compiled/protocol.generated/predicates.js is stale; run pnpm gateway:validators:gen ``` Scheduled run: https://github.com/openclaw/openclaw/actions/runs/44980759580 (job 137080867330), and earlier https://github.com/openclaw/openclaw/actions/runs/44976289659. ## Root cause #203357 (`fix(ui): show app updates outside the conversation`, e769225) added two optional fields to the update-run schema in `packages/gateway-protocol/src/schema/update-runs.ts`: - `noticeSurface: Type.Optional(Type.Literal("app"))` - `noticeInApp: Type.Optional(Type.Boolean())` It did not regenerate the compiled gateway validators, so `predicates.js` no longer matches the schema. ## Fix Regenerate with the owning script: `pnpm gateway:validators:gen`. No hand edits. The diff adds the two fields to the generated predicates; the rest is check-id renumbering from the generator. ## Evidence - Base `origin/main` (6375a36): `pnpm gateway:validators:check` fails with the error above. - Head: `pnpm validators:check` (gateway, ui, codex-app-server, static, lobster) exits 0. The other four sub-checks were already fresh on base. ## Merge danger Two-way door. Generated validator output only; a revert restores the stale file. Blast radius: Gateway protocol validation of update-run payloads, which now accepts the two optional fields the schema already declares. Co-authored-by: Ayaan Zaidi <[email protected]>
…dshake (#203423) ## Problem Gateway Node shards are red on `main` (scheduled run https://github.com/openclaw/openclaw/actions/runs/44980759580, jobs `checks-node-compact-large-40`, `-41`, and at 3c8c7bf also `-8`, `-16`, `-6`). Every PR inherits these reds and has to triage them. 14 tests fail in 6 files: - `server.sessions.create.lifecycle.test.ts` (4), `server.sessions.create.authority.test.ts` (2), `server.sessions.create-notices.test.ts` (1) - `server-methods/question.test.ts` (4), `server-methods/session-catalog-gateway-copy.test.ts` (1) - `talk/handlers/index.test.ts` "role-required Talk session creation" (2) All fail with `TypeError: undefined is not an object (evaluating 'client.connect.client.id')`, which the handlers return as `FORBIDDEN`. ## Root cause #203357 (e769225) added `clientId: client.internal?.syntheticClient ? undefined : client.connect.client.id` in `captureGatewayOperatorRunAuthority` (`src/gateway/operator-run-authority.ts:621`). Production is correct: `GatewayClient["connect"]` is the handshake `ConnectParams`, where `client` is required, and every real or spread client carries it. The failing fixtures built a partial `connect` (`{ scopes }` or `{ role, scopes }`) and hid the missing `client` with `as never` / `as GatewayWsClient["connect"]` casts. #203357 fixed one such fixture (`question.own-run.test.ts`) but not these. ## Fix Build those fixture connects with the existing shared `gatewayConnect()` test fixture (`src/gateway/server/client-fixtures.test-support.ts`), so they are complete handshakes. Test-only change, no production code, net −3 lines. ## Evidence - Base `origin/main` 6375a36: `ocx test` on the 6 files: 14 failed / 185 passed, 4 unhandled `client.connect.client.id` rejections. - Head: same command, `Test Files 6 passed (6)`, `Tests 192 passed (192)`. - `pnpm check:test-types` passes; oxlint/oxfmt clean on changed files. Co-authored-by: Ayaan Zaidi <[email protected]>
…ident launcher (#203194) ## Problem A Git install updates in place under the running Gateway, through a managed-service handoff helper. When the new build does not start, recovery depends on that helper and on the old updater that is already installed, so a failed update can leave the Gateway down or stuck in `update-recovery-pending`. ## Change Git installs now update through prepared releases and a resident launcher: 1. `update.run`, `openclaw update` and automatic updates admit the run, resolve the target and run preflight (Node engine, required tools, disk space, container installs refused before any change). 2. The next release is built beside the running one (`git worktree add --detach`, then the target's install and build). The running checkout is not changed. 3. `openclaw update check-release` runs the new code offline against the current config and state and reports broken plugin or config surfaces. It does not migrate state. 4. `openclaw update plugins` runs from the published release: the existing plugin maintenance owner (`updatePluginsAfterCoreUpdate`), with the new core's code and version. A plugin problem, or a target too old to have the command, is recorded as a `plugins` step with a next action and never fails the update. An already-current install still runs it from the serving code and restarts a running Gateway when plugins changed (`docs/install/updating.md`). 5. The release is published as a pending trial, and the Gateway restarts with a process-replacing reason. 6. The launcher switches the release link at the next child start, counts attempts, commits the trial when the new Gateway is ready, and otherwise rolls back and starts the previous release. 7. The Gateway that starts after the switch (new on success, old after a rollback) finishes the run and sends the outcome to a requester that received the start notice. Routing: - `update.run` reads the install kind from the existing install-status owner (`resolveStartupInstallStatus`). `update-run.ts` wraps `update.run`; `update.ts` is unchanged and still serves package installs. - `openclaw update` branches after `prepareUpdateCommand`, so every existing refusal (external supervisor, host-owned, immutable, system package owner, interrupted update) applies first. A requested non-dev channel on a Git checkout still switches it to a package through the existing flow, and `--dry-run` keeps the existing preview. - Package installs move to this path in the next change, which also deletes the old Git machinery that this PR leaves unused. Converting an existing install: - The old entry points of a converted install (`openclaw.mjs`, `dist/index.js`) forward to the release launcher through a marker beside the tree. Existing service definitions and PATH shims keep working without a rewrite. - A first update driven by an older installed updater still migrates state as it does today. Released updaters require migrated state: 23 stable and 6 extended-stable tags contain that check. Fixes found by the real-install runs below, each a separate commit: - `openclaw update --sha` now sends the tracked upstream that the protocol requires. - The new path restarts with `update.run` / `update.auto`, so the process is replaced instead of restarted in place. - A Gateway started by the launcher leaves its update successor to the launcher instead of spawning one outside it. - Preflight skips dangling symlinks in agent homes, such as Codex `arg0` shims, when it sizes state databases. - `check-release` writes its JSON result to stdout. - Plain `openclaw update` keeps following the run while the restarting Gateway refuses connections with a retryable HTTP 503. Before, it exited 1 although the update succeeded. Accepted edge cases: - After `openclaw update` runs in a Git checkout, `openclaw.mjs` and `dist/index.js` in that checkout run the current release. A developer who edits the source of a checkout they also update from runs the release, not their edits. - A stop request handled inside a launcher child exits with code 0, and the launcher starts the child again. A stop through the service manager stops the launcher and its child. - On a Gateway with no service manager, the first update from a released version does not restart it. The released updater does this, and says so. - Package updates now read the install status twice per request: once to route, once in the old handler. - After a rollback, the previous release runs with plugins maintained for the new core. A plugin that cannot load stays off for that boot, as the plugin docs describe. - `openclaw update --accept-capabilities` reaches plugin maintenance when the CLI prepares the release itself (`--no-restart`, or no Gateway answering). Through a running Gateway, `update.run` has no field for it, so a plugin that needs consent is reported with its `openclaw plugins update` next action. Carrying the flag through `update.run` is a protocol change and follows separately. - `openclaw update` run from a different checkout than the one the configured local Gateway serves updates the Gateway's installation, not the invoking checkout. Binding the request to the checkout needs a protocol field and follows with `--accept-capabilities`. ## Evidence Real install on macOS (Apple silicon). Isolated HOME, state, config and port, a foreground Gateway, no launchd service. Every candidate was built from `git archive` of its commit; the final candidate is this branch's head before review. | Step | Run status | Trial | Served after | Health | |---|---|---|---|---| | 2026.11.6 → A (released updater) | succeeded | (old path) | A, after a recorded manual start | 200 / 200 | | A → B′ (B′ fails at startup) | failed, `new build failed to start` | rolled-back, 2 attempts | A, as the launcher's child | 200 / 200 | | A → B | succeeded | committed, 1 attempt | B, as the launcher's child | 200 / 200 | | B → C | succeeded | committed, 1 attempt | C, as the launcher's child | 200 / 200 | - The same launcher process stayed the parent through every replacement. The previous release was kept after each commit. - Phase times (seconds), from the persisted run steps: | Step | Staging (build) | Validating | Restarting | Total | |---|---:|---:|---:|---:| | A → B′ (rollback) | 192.5 | 0.8 | 29.2 | 222.7 | | A → B | 195.7 | 1.1 | 32.9 | 229.8 | | B → C | 201.6 | 0.9 | 36.9 | 239.5 | - `check-release` on a copy of a real state directory (Linux, no network): exit 0 in 3.0 s, 187 surfaces checked, shared state schema 40 → 40, agent databases 43 → 43. Plugin maintenance, real install on macOS (isolated, foreground Gateway, a real third-party npm plugin `@martian-engineering/lossless-claw` served through a scratch registry proxy that advertises 1.1.1, then the real latest 1.2.0): | Case | Run | `plugins` step | Plugin | Gateway | |---|---|---|---|---| | Core update through the new path | succeeded, trial committed (1 attempt) | completed | 1.1.1 → 1.2.0 | one restart into the new release | | Already current, plugin outdated | skipped / already-current | completed | 1.1.1 → 1.2.0 | restarted | | Already current, nothing to change | skipped / already-current | completed | unchanged | no restart | | Already current, registry returns HTTP 503 | skipped / already-current | completed, detail names the plugin and its `openclaw plugins update` retry | kept 1.1.1 | no restart; CLI prints "Plugin notes: …" | | Already current, `--no-restart` | skipped / already-current | completed | 1.1.1 → 1.2.0 | same process, no restart | - An earlier head counted a `warning` result as a failed step with no message; the run above found it and the fix is in this PR. - A run with `--timeout 1` showed the CLI calling a still-running update "Update failed: unknown reason". The fix ("The update did not finish in time. Run `openclaw update status` to see it.") is covered by `src/update/cli.test.ts`; it was not rerun on the real install. Tests: - New: `src/update/*.test.ts` (target, preflight, Git and package preparation, check-release, store, launcher, trial settlement and outcome notice, CLI request shape), plus a launcher-child case in `process-respawn.test.ts`. - The gateway `update*` suites run against package installs. Tests that pinned the old Git handoff, Git preflight delegation, explicit Git targets and foreground parking are deleted. Tests of behavior that package installs still use (notice policy, owner checks, campaign adoption, platform admission) now run on a managed package install. ## Review - `--no-restart` on a Git install now prepares the release in the CLI process instead of asking the Gateway, so the Gateway does not restart. The release starts at the Gateway's next start, and the CLI says so and exits 0, instead of reporting "Updated". - The first conversion creates the `prefix/openclaw` link to the running tree before it writes the forwarding marker. Forwarded commands work between publish and the switch. - The run row is written through the existing asynchronous update-run owner (`update-run-write.async.ts`). The synchronous second writer is deleted, so there is no SQLite work on the Gateway thread. - Rejected: settling trials of the format-1 Git-release launcher (#199706). No released build contains it (not 2026.11.6 `latest`, 2026.10.33 `extended-stable` or 2026.11.10-beta.1 `beta`), and main-only code is not a shipped contract. Only a Git checkout that tracked `main` between 2026-11-17 and this change can have such a trial. - The in-process path (`--no-restart`, or no Gateway answering) uses the requested channel, else the saved `update.channel` (`readUpdateChannelConfig`), else `dev`, as the existing CLI does. The Gateway path passes the checkout's tag and branch facts, as the existing handler does, so a configless checkout on a stable tag stays on stable. - After publishing a Git release, `git worktree repair` records it at its final path, so `git worktree list` and a later `git worktree prune` see the serving release where it is. - `prefix/openclaw` is repointed to the running tree when it does not already resolve there, so a link left from an earlier package install cannot become the rollback target. - Rejected for this PR: carrying the package layout's `lib/node_modules/openclaw` link. That layout belongs to package-release installs, which this PR does not route; the next change moves package installs and owns it. - A new build that exits 78 (it refuses the configuration) during a trial now rolls back like any other failed candidate. Outside a trial, 78 stays terminal. - Rejected again, same reason as the format-1 trial: making `git-install/lib/node_modules/openclaw` follow `prefix/openclaw`. Only the main-only Git-release conversion (#199706) creates that link, and no release contains it. - A Gateway with `OPENCLAW_NO_RESPAWN` set now refuses `update.run` with `restart-unavailable` before anything is recorded or prepared, as the existing handler does. The prepared release starts only in a new process, which that Gateway cannot start. - `openclaw update --timeout <seconds>` on a Git install is the overall budget again: it bounds how long the CLI follows the run, reaches the Gateway as `update.run` `timeoutMs`, and target resolution, the release build and plugin maintenance get only what remains of it. Preflight and `check-release` keep their own short bounds. - Rejected again, same reason as the format-1 trial: settling legacy `.trial` records in `stale-install.ts`. Only #199706 writes them; `settleGitReleaseTrial` is in no released build (2026.11.6 `latest`, 2026.10.33 `extended-stable`, 2026.11.10-beta.1 `beta`). - Rejected: routing `--tag` on a Git install to the package flow. The existing Git flow ignores `--tag` ("--tag applies to npm installs only; git updates ignore it"), so the Git route keeps that behavior. - After merging `main`: Control UI and desktop app requests on a Git install show the update in the app instead of the conversation (#203357), through the same `appUpdateNoticePublisher` owner as package installs. - A manual `update.run` on a Git install during a scheduled campaign adopts the campaign through its existing owner: it applies the pinned commit, records `trigger: campaign` with the campaign ID, binds the run, and refuses a mismatched `--sha` or a campaign already applying, as package installs do. - Rejected a third time: settling legacy `.trial` records (same reason as above). - Rejected: restoring the plugin cohort across a trial rollback. Removing the cohort is the approved design (plugins are non-fatal). After a rollback the previous release runs with plugins maintained for the new core; a plugin that cannot load stays off for that boot. Listed under accepted edge cases. - Updating without a Gateway (`--no-restart`, or none answering) reads the checkout's tag and branch facts, as the Gateway route does, so a stable-tag checkout with no saved `update.channel` stays on stable instead of preparing `dev`. - `openclaw update --no-restart --json` no longer prints the human "is ready" line before the JSON result. - Deferred: carrying `--accept-capabilities` through `update.run` (a protocol change); listed under accepted edge cases. - `openclaw update` delegates to `update.run` only when the call targets the configured local Gateway (`isImplicitLocalGatewayTarget`). With `gateway.mode=remote` or a Gateway URL override it prepares this checkout in-process instead of updating the remote installation. - `check-release` and `update plugins` run through the existing process owner (`runCommandWithTimeout` with process-tree termination), so a timeout ends npm and every descendant and waits for them before the step settles. - A linked Git worktree gets the root-level `.openclaw-launcher` marker (its `.git` is a file); only a main working tree uses `.git/openclaw-launcher`. Before, the marker went to the main working tree, so the linked worktree never forwarded. Not covered by a new test: it needs a full release build through publish. - Deferred with `--accept-capabilities`: binding `update.run` to the CLI's checkout. When the configured local Gateway runs another installation than the checkout the CLI runs from, the Gateway updates its own installation. Matching them needs the admitted root in `update.run` (a protocol change). The previous in-place Git updater had the same mismatch: it updated the invoking checkout and restarted the configured service. - A Git install is already current only when the serving build's commit (`resolveLoadedCommitHash`) matches the target, not when the checkout's `HEAD` does. A checkout pulled to the target without a rebuild still runs the old build, so it now prepares the release. An unknown build commit prepares a release too. - The Git route honors `update.run` `restartDelayMs` when it restarts into a prepared release or after changed plugins, as the package route does. ## Merge danger - Two-way door for the code: a revert restores the old Git update path. The forwarder that reads the launcher marker ships in this change, so after a revert the checkout's `openclaw.mjs` runs the checkout again and the old updater updates it in place; the `git-install/` prefix is left unused. A revert was not exercised. - One-way parts: a converted install has a `git-install/` prefix with releases, the launcher and a forwarding marker beside the checkout; a revert leaves them in place. No schema, stored-row or protocol version change. - Blast radius: Git installs only (source checkouts updating with `openclaw update`, `update.run` and automatic updates). Package installs keep the existing path. Co-authored-by: Ayaan Zaidi <[email protected]>
…openclaw#203413) ## Problem `build-artifacts` is red on `main`: the `pnpm validators:check` step fails with ``` Error: packages/gateway-protocol/src/compiled/protocol.generated/predicates.js is stale; run pnpm gateway:validators:gen ``` Scheduled run: https://github.com/openclaw/openclaw/actions/runs/44980759580 (job 137080867330), and earlier https://github.com/openclaw/openclaw/actions/runs/44976289659. ## Root cause openclaw#203357 (`fix(ui): show app updates outside the conversation`, d0aa56d) added two optional fields to the update-run schema in `packages/gateway-protocol/src/schema/update-runs.ts`: - `noticeSurface: Type.Optional(Type.Literal("app"))` - `noticeInApp: Type.Optional(Type.Boolean())` It did not regenerate the compiled gateway validators, so `predicates.js` no longer matches the schema. ## Fix Regenerate with the owning script: `pnpm gateway:validators:gen`. No hand edits. The diff adds the two fields to the generated predicates; the rest is check-id renumbering from the generator. ## Evidence - Base `origin/main` (c5a7d41): `pnpm gateway:validators:check` fails with the error above. - Head: `pnpm validators:check` (gateway, ui, codex-app-server, static, lobster) exits 0. The other four sub-checks were already fresh on base. ## Merge danger Two-way door. Generated validator output only; a revert restores the stale file. Blast radius: Gateway protocol validation of update-run payloads, which now accepts the two optional fields the schema already declares. Co-authored-by: Ayaan Zaidi <[email protected]>
…dshake (openclaw#203423) ## Problem Gateway Node shards are red on `main` (scheduled run https://github.com/openclaw/openclaw/actions/runs/44980759580, jobs `checks-node-compact-large-40`, `-41`, and at 4926ccd also `-8`, `-16`, `-6`). Every PR inherits these reds and has to triage them. 14 tests fail in 6 files: - `server.sessions.create.lifecycle.test.ts` (4), `server.sessions.create.authority.test.ts` (2), `server.sessions.create-notices.test.ts` (1) - `server-methods/question.test.ts` (4), `server-methods/session-catalog-gateway-copy.test.ts` (1) - `talk/handlers/index.test.ts` "role-required Talk session creation" (2) All fail with `TypeError: undefined is not an object (evaluating 'client.connect.client.id')`, which the handlers return as `FORBIDDEN`. ## Root cause openclaw#203357 (d0aa56d) added `clientId: client.internal?.syntheticClient ? undefined : client.connect.client.id` in `captureGatewayOperatorRunAuthority` (`src/gateway/operator-run-authority.ts:621`). Production is correct: `GatewayClient["connect"]` is the handshake `ConnectParams`, where `client` is required, and every real or spread client carries it. The failing fixtures built a partial `connect` (`{ scopes }` or `{ role, scopes }`) and hid the missing `client` with `as never` / `as GatewayWsClient["connect"]` casts. openclaw#203357 fixed one such fixture (`question.own-run.test.ts`) but not these. ## Fix Build those fixture connects with the existing shared `gatewayConnect()` test fixture (`src/gateway/server/client-fixtures.test-support.ts`), so they are complete handshakes. Test-only change, no production code, net −3 lines. ## Evidence - Base `origin/main` c5a7d41: `ocx test` on the 6 files: 14 failed / 185 passed, 4 unhandled `client.connect.client.id` rejections. - Head: same command, `Test Files 6 passed (6)`, `Tests 192 passed (192)`. - `pnpm check:test-types` passes; oxlint/oxfmt clean on changed files. Co-authored-by: Ayaan Zaidi <[email protected]>
…ident launcher (openclaw#203194) ## Problem A Git install updates in place under the running Gateway, through a managed-service handoff helper. When the new build does not start, recovery depends on that helper and on the old updater that is already installed, so a failed update can leave the Gateway down or stuck in `update-recovery-pending`. ## Change Git installs now update through prepared releases and a resident launcher: 1. `update.run`, `openclaw update` and automatic updates admit the run, resolve the target and run preflight (Node engine, required tools, disk space, container installs refused before any change). 2. The next release is built beside the running one (`git worktree add --detach`, then the target's install and build). The running checkout is not changed. 3. `openclaw update check-release` runs the new code offline against the current config and state and reports broken plugin or config surfaces. It does not migrate state. 4. `openclaw update plugins` runs from the published release: the existing plugin maintenance owner (`updatePluginsAfterCoreUpdate`), with the new core's code and version. A plugin problem, or a target too old to have the command, is recorded as a `plugins` step with a next action and never fails the update. An already-current install still runs it from the serving code and restarts a running Gateway when plugins changed (`docs/install/updating.md`). 5. The release is published as a pending trial, and the Gateway restarts with a process-replacing reason. 6. The launcher switches the release link at the next child start, counts attempts, commits the trial when the new Gateway is ready, and otherwise rolls back and starts the previous release. 7. The Gateway that starts after the switch (new on success, old after a rollback) finishes the run and sends the outcome to a requester that received the start notice. Routing: - `update.run` reads the install kind from the existing install-status owner (`resolveStartupInstallStatus`). `update-run.ts` wraps `update.run`; `update.ts` is unchanged and still serves package installs. - `openclaw update` branches after `prepareUpdateCommand`, so every existing refusal (external supervisor, host-owned, immutable, system package owner, interrupted update) applies first. A requested non-dev channel on a Git checkout still switches it to a package through the existing flow, and `--dry-run` keeps the existing preview. - Package installs move to this path in the next change, which also deletes the old Git machinery that this PR leaves unused. Converting an existing install: - The old entry points of a converted install (`openclaw.mjs`, `dist/index.js`) forward to the release launcher through a marker beside the tree. Existing service definitions and PATH shims keep working without a rewrite. - A first update driven by an older installed updater still migrates state as it does today. Released updaters require migrated state: 23 stable and 6 extended-stable tags contain that check. Fixes found by the real-install runs below, each a separate commit: - `openclaw update --sha` now sends the tracked upstream that the protocol requires. - The new path restarts with `update.run` / `update.auto`, so the process is replaced instead of restarted in place. - A Gateway started by the launcher leaves its update successor to the launcher instead of spawning one outside it. - Preflight skips dangling symlinks in agent homes, such as Codex `arg0` shims, when it sizes state databases. - `check-release` writes its JSON result to stdout. - Plain `openclaw update` keeps following the run while the restarting Gateway refuses connections with a retryable HTTP 503. Before, it exited 1 although the update succeeded. Accepted edge cases: - After `openclaw update` runs in a Git checkout, `openclaw.mjs` and `dist/index.js` in that checkout run the current release. A developer who edits the source of a checkout they also update from runs the release, not their edits. - A stop request handled inside a launcher child exits with code 0, and the launcher starts the child again. A stop through the service manager stops the launcher and its child. - On a Gateway with no service manager, the first update from a released version does not restart it. The released updater does this, and says so. - Package updates now read the install status twice per request: once to route, once in the old handler. - After a rollback, the previous release runs with plugins maintained for the new core. A plugin that cannot load stays off for that boot, as the plugin docs describe. - `openclaw update --accept-capabilities` reaches plugin maintenance when the CLI prepares the release itself (`--no-restart`, or no Gateway answering). Through a running Gateway, `update.run` has no field for it, so a plugin that needs consent is reported with its `openclaw plugins update` next action. Carrying the flag through `update.run` is a protocol change and follows separately. - `openclaw update` run from a different checkout than the one the configured local Gateway serves updates the Gateway's installation, not the invoking checkout. Binding the request to the checkout needs a protocol field and follows with `--accept-capabilities`. ## Evidence Real install on macOS (Apple silicon). Isolated HOME, state, config and port, a foreground Gateway, no launchd service. Every candidate was built from `git archive` of its commit; the final candidate is this branch's head before review. | Step | Run status | Trial | Served after | Health | |---|---|---|---|---| | 2026.11.6 → A (released updater) | succeeded | (old path) | A, after a recorded manual start | 200 / 200 | | A → B′ (B′ fails at startup) | failed, `new build failed to start` | rolled-back, 2 attempts | A, as the launcher's child | 200 / 200 | | A → B | succeeded | committed, 1 attempt | B, as the launcher's child | 200 / 200 | | B → C | succeeded | committed, 1 attempt | C, as the launcher's child | 200 / 200 | - The same launcher process stayed the parent through every replacement. The previous release was kept after each commit. - Phase times (seconds), from the persisted run steps: | Step | Staging (build) | Validating | Restarting | Total | |---|---:|---:|---:|---:| | A → B′ (rollback) | 192.5 | 0.8 | 29.2 | 222.7 | | A → B | 195.7 | 1.1 | 32.9 | 229.8 | | B → C | 201.6 | 0.9 | 36.9 | 239.5 | - `check-release` on a copy of a real state directory (Linux, no network): exit 0 in 3.0 s, 187 surfaces checked, shared state schema 40 → 40, agent databases 43 → 43. Plugin maintenance, real install on macOS (isolated, foreground Gateway, a real third-party npm plugin `@martian-engineering/lossless-claw` served through a scratch registry proxy that advertises 1.1.1, then the real latest 1.2.0): | Case | Run | `plugins` step | Plugin | Gateway | |---|---|---|---|---| | Core update through the new path | succeeded, trial committed (1 attempt) | completed | 1.1.1 → 1.2.0 | one restart into the new release | | Already current, plugin outdated | skipped / already-current | completed | 1.1.1 → 1.2.0 | restarted | | Already current, nothing to change | skipped / already-current | completed | unchanged | no restart | | Already current, registry returns HTTP 503 | skipped / already-current | completed, detail names the plugin and its `openclaw plugins update` retry | kept 1.1.1 | no restart; CLI prints "Plugin notes: …" | | Already current, `--no-restart` | skipped / already-current | completed | 1.1.1 → 1.2.0 | same process, no restart | - An earlier head counted a `warning` result as a failed step with no message; the run above found it and the fix is in this PR. - A run with `--timeout 1` showed the CLI calling a still-running update "Update failed: unknown reason". The fix ("The update did not finish in time. Run `openclaw update status` to see it.") is covered by `src/update/cli.test.ts`; it was not rerun on the real install. Tests: - New: `src/update/*.test.ts` (target, preflight, Git and package preparation, check-release, store, launcher, trial settlement and outcome notice, CLI request shape), plus a launcher-child case in `process-respawn.test.ts`. - The gateway `update*` suites run against package installs. Tests that pinned the old Git handoff, Git preflight delegation, explicit Git targets and foreground parking are deleted. Tests of behavior that package installs still use (notice policy, owner checks, campaign adoption, platform admission) now run on a managed package install. ## Review - `--no-restart` on a Git install now prepares the release in the CLI process instead of asking the Gateway, so the Gateway does not restart. The release starts at the Gateway's next start, and the CLI says so and exits 0, instead of reporting "Updated". - The first conversion creates the `prefix/openclaw` link to the running tree before it writes the forwarding marker. Forwarded commands work between publish and the switch. - The run row is written through the existing asynchronous update-run owner (`update-run-write.async.ts`). The synchronous second writer is deleted, so there is no SQLite work on the Gateway thread. - Rejected: settling trials of the format-1 Git-release launcher (openclaw#199706). No released build contains it (not 2026.11.6 `latest`, 2026.10.33 `extended-stable` or 2026.11.10-beta.1 `beta`), and main-only code is not a shipped contract. Only a Git checkout that tracked `main` between 2026-11-17 and this change can have such a trial. - The in-process path (`--no-restart`, or no Gateway answering) uses the requested channel, else the saved `update.channel` (`readUpdateChannelConfig`), else `dev`, as the existing CLI does. The Gateway path passes the checkout's tag and branch facts, as the existing handler does, so a configless checkout on a stable tag stays on stable. - After publishing a Git release, `git worktree repair` records it at its final path, so `git worktree list` and a later `git worktree prune` see the serving release where it is. - `prefix/openclaw` is repointed to the running tree when it does not already resolve there, so a link left from an earlier package install cannot become the rollback target. - Rejected for this PR: carrying the package layout's `lib/node_modules/openclaw` link. That layout belongs to package-release installs, which this PR does not route; the next change moves package installs and owns it. - A new build that exits 78 (it refuses the configuration) during a trial now rolls back like any other failed candidate. Outside a trial, 78 stays terminal. - Rejected again, same reason as the format-1 trial: making `git-install/lib/node_modules/openclaw` follow `prefix/openclaw`. Only the main-only Git-release conversion (openclaw#199706) creates that link, and no release contains it. - A Gateway with `OPENCLAW_NO_RESPAWN` set now refuses `update.run` with `restart-unavailable` before anything is recorded or prepared, as the existing handler does. The prepared release starts only in a new process, which that Gateway cannot start. - `openclaw update --timeout <seconds>` on a Git install is the overall budget again: it bounds how long the CLI follows the run, reaches the Gateway as `update.run` `timeoutMs`, and target resolution, the release build and plugin maintenance get only what remains of it. Preflight and `check-release` keep their own short bounds. - Rejected again, same reason as the format-1 trial: settling legacy `.trial` records in `stale-install.ts`. Only openclaw#199706 writes them; `settleGitReleaseTrial` is in no released build (2026.11.6 `latest`, 2026.10.33 `extended-stable`, 2026.11.10-beta.1 `beta`). - Rejected: routing `--tag` on a Git install to the package flow. The existing Git flow ignores `--tag` ("--tag applies to npm installs only; git updates ignore it"), so the Git route keeps that behavior. - After merging `main`: Control UI and desktop app requests on a Git install show the update in the app instead of the conversation (openclaw#203357), through the same `appUpdateNoticePublisher` owner as package installs. - A manual `update.run` on a Git install during a scheduled campaign adopts the campaign through its existing owner: it applies the pinned commit, records `trigger: campaign` with the campaign ID, binds the run, and refuses a mismatched `--sha` or a campaign already applying, as package installs do. - Rejected a third time: settling legacy `.trial` records (same reason as above). - Rejected: restoring the plugin cohort across a trial rollback. Removing the cohort is the approved design (plugins are non-fatal). After a rollback the previous release runs with plugins maintained for the new core; a plugin that cannot load stays off for that boot. Listed under accepted edge cases. - Updating without a Gateway (`--no-restart`, or none answering) reads the checkout's tag and branch facts, as the Gateway route does, so a stable-tag checkout with no saved `update.channel` stays on stable instead of preparing `dev`. - `openclaw update --no-restart --json` no longer prints the human "is ready" line before the JSON result. - Deferred: carrying `--accept-capabilities` through `update.run` (a protocol change); listed under accepted edge cases. - `openclaw update` delegates to `update.run` only when the call targets the configured local Gateway (`isImplicitLocalGatewayTarget`). With `gateway.mode=remote` or a Gateway URL override it prepares this checkout in-process instead of updating the remote installation. - `check-release` and `update plugins` run through the existing process owner (`runCommandWithTimeout` with process-tree termination), so a timeout ends npm and every descendant and waits for them before the step settles. - A linked Git worktree gets the root-level `.openclaw-launcher` marker (its `.git` is a file); only a main working tree uses `.git/openclaw-launcher`. Before, the marker went to the main working tree, so the linked worktree never forwarded. Not covered by a new test: it needs a full release build through publish. - Deferred with `--accept-capabilities`: binding `update.run` to the CLI's checkout. When the configured local Gateway runs another installation than the checkout the CLI runs from, the Gateway updates its own installation. Matching them needs the admitted root in `update.run` (a protocol change). The previous in-place Git updater had the same mismatch: it updated the invoking checkout and restarted the configured service. - A Git install is already current only when the serving build's commit (`resolveLoadedCommitHash`) matches the target, not when the checkout's `HEAD` does. A checkout pulled to the target without a rebuild still runs the old build, so it now prepares the release. An unknown build commit prepares a release too. - The Git route honors `update.run` `restartDelayMs` when it restarts into a prepared release or after changed plugins, as the package route does. ## Merge danger - Two-way door for the code: a revert restores the old Git update path. The forwarder that reads the launcher marker ships in this change, so after a revert the checkout's `openclaw.mjs` runs the checkout again and the old updater updates it in place; the `git-install/` prefix is left unused. A revert was not exercised. - One-way parts: a converted install has a `git-install/` prefix with releases, the launcher and a forwarding marker beside the checkout; a revert leaves them in place. No schema, stored-row or protocol version change. - Blast radius: Git installs only (source checkouts updating with `openclaw update`, `update.run` and automatic updates). Package installs keep the existing path. Co-authored-by: Ayaan Zaidi <[email protected]>




Update toast demo
openclaw-update-lifecycle.mp4
43-second WebUI recording with a test Gateway:
/update, preparation, progress, restart, reconnection, success and failure. The failure stays visible until dismissed and does not return after reload.What changed
Update acknowledgments from a WebUI or desktop conversation were rendered as English, emoji-prefixed assistant messages. Route these lifecycle notices through the existing durable update record and show one persistent top-right toast. It shows preparation, the active phase, reconnection, and the outcome without a timeout. The result can be dismissed or opened in Settings → Updates.
The Gateway records the presentation choice from the admitted transport rather than message content. Native iOS/Android, third-party channels, and unclassified callers retain their existing delivery. The toast uses Control UI localization; new strings fall back to English until catalog refresh. No database migration.
Evidence
git diff --checkpassed. Independent Codex autoreview of the production patch reported no P0–P2 findings.Draft: no native desktop end-to-end run, real provider-mediated update, or stable-version upgrade was performed. Nothing was deployed.
Maintainer verification
An isolated Gateway and production Chromium build passed notification progress, an actual Gateway restart and reconnect, persistent success and failure, dismissal across reload, Updates navigation, and a replacement Gateway without a stale notification. These runs used synthetic update records; no installed updater or live deployment was run.
A late immutable-install refusal now publishes its terminal receipt to the same app notification without adding a chat reply. The pre-admission and API paths retain their behavior. The affected Gateway suites, CI test typecheck, lint, and independent review passed after the repair.