Skip to content

fix(ui): show app updates outside the conversation - #203357

Merged
vyctorbrzezowski merged 4 commits into
mainfrom
openclaw/cool-langoustine-276293
Nov 22, 2026
Merged

vyctorbrzezowski merged 4 commits into
mainfrom
openclaw/cool-langoustine-276293

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

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

  • Build-backed Chromium test for preparation, processing, reconnect, failure, no timeout, explicit dismissal, and reload. Synthetic Gateway; clean and annotated before/after screenshots.
  • Gateway acknowledgement, restart sentinel, and notice suites: 76 passed; the browser/macOS/iOS routing cases were rerun after mechanically extracting the helper. Slash update command suite: 16 passed.
  • Core/UI types, focused oxlint and formatter, i18n verification, and git diff --check passed. 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.

@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Clean comparison

Before — update notice in the conversation

The old update status appears as an assistant message

After — status in the top-right toast

The update status is shown at top right and the conversation is empty

Annotated comparison

Before: legacy assistant-message notice outlined

After: top-right status toast outlined

Production Control UI builds with a synthetic Gateway and an empty conversation. Before: e201b64f8d7. The new run status is shown during staging; the browser regression also exercises waiting, reconnection, failure, and persistent dismissal.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: M labels Nov 21, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

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

  • Before: An English update acknowledgment appears as an assistant message in the conversation.
  • After: A top-right toast shows “Updating OpenClaw…” and “Staging” without adding a conversation message.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful presentation work with inspected visual evidence, but a definite persistence defect and incomplete runtime and upgrade proof prevent approval.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Preference · Worth it: Yes · Fix scope: Complete
User problem: Operational update messages interrupt browser and desktop conversations and bypass Control UI localization.
Reason: The maintainer-authored direction gives lifecycle status a persistent, actionable presentation while reusing the authoritative update record.

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
Reviewed head: 5111683058532674ea6b08311ccf0253a06a823e

Before merge

  • Preserve noticeSurface when compacting update origins (P2) - The new closed enum also needs protection in update-run-codec.ts. boundedOriginJsonWithNamespaces leaves noticeSurface in admissionDiagnostics, and its preservedTextFields set omits this key. When origin metadata exceeds 16 KiB, boundedJson shortens "app" into a value this schema rejects. The existing ledger overflow case—15 admission checks with 1,000-character details followed by terminal nextAction guidance—reaches this path when noticeSurface is added. persistRun then fails its decode inside the write transaction, preventing progress or terminal settlement and potentially leaving the UI waiting on a running update. Preserve the literal through compaction and extend that existing regression to cover an app-designated run.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Preserve noticeSurface when compacting update origins — src/infra/update-run-schema.ts:298

Tests

  • Missing end-to-end proof: The supplied browser captures do not exercise real Gateway transport classification, restart delivery suppression, or a latest-stable upgrade; red-on-base regression execution is also not shown.
Agent review details

How this fits together

Gateway 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]
Loading

Technical review

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

  • [P2] Preserve noticeSurface when compacting update origins — src/infra/update-run-schema.ts:298
    The new closed enum also needs protection in update-run-codec.ts. boundedOriginJsonWithNamespaces leaves noticeSurface in admissionDiagnostics, and its preservedTextFields set omits this key. When origin metadata exceeds 16 KiB, boundedJson shortens "app" into a value this schema rejects. The existing ledger overflow case—15 admission checks with 1,000-character details followed by terminal nextAction guidance—reaches this path when noticeSurface is added. persistRun then fails its decode inside the write transaction, preventing progress or terminal settlement and potentially leaving the UI waiting on a running update. Preserve the literal through compaction and extend that existing regression to cover an app-designated run.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 41dce5629f27.

Provenance checked

  • Internal update transcript delivery changes intended behavior with a stated reason (9b1d9c2: Provide durable acknowledgment and completion reports across Gateway restarts, including internal sessions.)
  • Shared toast replacement and duration keeps the original intent (98561a5: Stack notifications by identity and lane, preserve actionable notices, and pause their timers during interaction.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/infra/update-run-ledger.test.ts --maxWorkers=1
  • pnpm test src/gateway/server-methods/update.test.ts src/auto-reply/reply/commands-update.test.ts --maxWorkers=1
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/update-run.e2e.test.ts
  • Show the added compaction regression failing before the codec repair and passing afterward.
  • Verify a latest-stable upgrade preserves existing update history and settings while the optional update_runs.origin_json noticeSurface field survives new-run persistence.

What I checked:

PR surface

Source +186, Tests +114, Docs +6. Total +306 across 22 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 17 208 22 +186
Tests 4 118 4 +114
Docs 1 9 3 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 335 29 +306

Preflight source

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

Labels

Label changes:

  • add P2: A useful update-notification improvement has a focused ledger-compaction defect that can prevent progress or terminal settlement for diagnostic-heavy runs.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: A useful update-notification improvement has a focused ledger-compaction defect that can prevent progress or terminal settlement for diagnostic-heavy runs.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

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

Workflow

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

Reviewed November 21, 2026, 7:03 PM ET / November 22, 2026, 00:03 UTC.

@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review November 22, 2026 00:40
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 512573b7984bd8f54cf0b0ed068995b3db0d771c
  • Maintainer: @vyctorbrzezowski
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/admitted-run-operator-authority.types.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/operator-run-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@vyctorbrzezowski
vyctorbrzezowski enabled auto-merge (squash) November 22, 2026 00:54
@vyctorbrzezowski
vyctorbrzezowski merged commit e769225 into main Nov 22, 2026
151 of 154 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the openclaw/cool-langoustine-276293 branch November 22, 2026 01:53
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

obviyus added a commit that referenced this pull request Nov 22, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 22, 2026
* 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
obviyus added a commit that referenced this pull request Nov 22, 2026
- pnpm gateway:validators:gen; picks up update.run noticeInApp from #203357.
obviyus added a commit that referenced this pull request Nov 22, 2026
…#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]>
obviyus added a commit that referenced this pull request Nov 22, 2026
…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]>
obviyus added a commit that referenced this pull request Nov 22, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 23, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 23, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 23, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. security-sensitive-changed size: M 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.

1 participant