Skip to content

Commit e3de98a

Browse files
authored
feat(update): scheduled update campaigns with countdown, dev-channel auto-update, and Updates settings page (#120506)
* feat(update): scheduled update campaigns with countdown, dev-channel auto-update, and Updates settings page * fix(ui): satisfy update campaign deadcode checks * feat(update): extend scheduled update campaigns * test(ui): include Updates page in settings sidebar search expectations * fix(update): end campaigns when apply fails * fix(update): pin dev campaign applies to the announced commit * test(ui): align update e2e fixtures * fix(update): pin adopted dev updates to the announced commit * docs(update): document automatic dev update campaigns * fix(ui): gate automatic dev updates on git installs * fix(gateway): scope detailed update metadata to read-capable clients * fix(gateway): break post-attach madge cycle with a leaf client-lookup type * chore(protocol): regenerate clients after rebase * test(gateway): update method tail after rebase * fix(update): preserve campaign target and hold state * test(update): align adoption mocks and split handoff suite * test(update): route split handoff suites on Windows
1 parent 6cdb818 commit e3de98a

79 files changed

Lines changed: 5608 additions & 397 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayProtocol.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ enum class GatewayMethod(
509509
TasksDismiss("tasks.dismiss"),
510510
AuditRunInspect("audit.run.inspect"),
511511
SessionsArchiveMany("sessions.archiveMany"),
512+
UpdateHold("update.hold"),
512513
}
513514

514515
enum class GatewayEvent(

‎apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift‎

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,8 @@ public struct Snapshot: Codable, Sendable {
14361436
public let statedir: String?
14371437
public let sessiondefaults: [String: AnyCodable]?
14381438
public let authmode: AnyCodable?
1439-
public let updateavailable: [String: AnyCodable]?
1439+
public let updateavailable: UpdateAvailable?
1440+
public let updateschedule: UpdateScheduleState?
14401441

14411442
public init(
14421443
presence: [PresenceEntry],
@@ -1448,7 +1449,8 @@ public struct Snapshot: Codable, Sendable {
14481449
statedir: String? = nil,
14491450
sessiondefaults: [String: AnyCodable]? = nil,
14501451
authmode: AnyCodable? = nil,
1451-
updateavailable: [String: AnyCodable]? = nil)
1452+
updateavailable: UpdateAvailable? = nil,
1453+
updateschedule: UpdateScheduleState? = nil)
14521454
{
14531455
self.presence = presence
14541456
self.health = health
@@ -1460,6 +1462,7 @@ public struct Snapshot: Codable, Sendable {
14601462
self.sessiondefaults = sessiondefaults
14611463
self.authmode = authmode
14621464
self.updateavailable = updateavailable
1465+
self.updateschedule = updateschedule
14631466
}
14641467

14651468
private enum CodingKeys: String, CodingKey {
@@ -1473,6 +1476,7 @@ public struct Snapshot: Codable, Sendable {
14731476
case sessiondefaults = "sessionDefaults"
14741477
case authmode = "authMode"
14751478
case updateavailable = "updateAvailable"
1479+
case updateschedule = "updateSchedule"
14761480
}
14771481
}
14781482

@@ -17899,6 +17903,120 @@ public struct ChatErrorEvent: Codable, Sendable {
1789917903

1790017904
public struct UpdateStatusParams: Codable, Sendable {}
1790117905

17906+
public struct UpdateStatusResult: Codable, Sendable {
17907+
public let sentinel: AnyCodable
17908+
public let updateavailable: AnyCodable
17909+
public let schedule: UpdateScheduleState?
17910+
17911+
public init(
17912+
sentinel: AnyCodable,
17913+
updateavailable: AnyCodable,
17914+
schedule: UpdateScheduleState? = nil)
17915+
{
17916+
self.sentinel = sentinel
17917+
self.updateavailable = updateavailable
17918+
self.schedule = schedule
17919+
}
17920+
17921+
private enum CodingKeys: String, CodingKey {
17922+
case sentinel
17923+
case updateavailable = "updateAvailable"
17924+
case schedule
17925+
}
17926+
}
17927+
17928+
public struct UpdateAvailable: Codable, Sendable {
17929+
public let currentversion: String
17930+
public let latestversion: String
17931+
public let channel: String
17932+
public let currentsha: String?
17933+
public let upstreamref: String?
17934+
public let upstreamsha: String?
17935+
public let commitsbehind: Int?
17936+
public let commits: [[String: AnyCodable]]?
17937+
17938+
public init(
17939+
currentversion: String,
17940+
latestversion: String,
17941+
channel: String,
17942+
currentsha: String? = nil,
17943+
upstreamref: String? = nil,
17944+
upstreamsha: String? = nil,
17945+
commitsbehind: Int? = nil,
17946+
commits: [[String: AnyCodable]]? = nil)
17947+
{
17948+
self.currentversion = currentversion
17949+
self.latestversion = latestversion
17950+
self.channel = channel
17951+
self.currentsha = currentsha
17952+
self.upstreamref = upstreamref
17953+
self.upstreamsha = upstreamsha
17954+
self.commitsbehind = commitsbehind
17955+
self.commits = commits
17956+
}
17957+
17958+
private enum CodingKeys: String, CodingKey {
17959+
case currentversion = "currentVersion"
17960+
case latestversion = "latestVersion"
17961+
case channel
17962+
case currentsha = "currentSha"
17963+
case upstreamref = "upstreamRef"
17964+
case upstreamsha = "upstreamSha"
17965+
case commitsbehind = "commitsBehind"
17966+
case commits
17967+
}
17968+
}
17969+
17970+
public struct UpdateScheduleState: Codable, Sendable {
17971+
public let channel: String
17972+
public let autoenabled: Bool
17973+
public let install: [String: AnyCodable]?
17974+
public let target: AnyCodable?
17975+
public let campaign: [String: AnyCodable]?
17976+
17977+
public init(
17978+
channel: String,
17979+
autoenabled: Bool,
17980+
install: [String: AnyCodable]? = nil,
17981+
target: AnyCodable? = nil,
17982+
campaign: [String: AnyCodable]? = nil)
17983+
{
17984+
self.channel = channel
17985+
self.autoenabled = autoenabled
17986+
self.install = install
17987+
self.target = target
17988+
self.campaign = campaign
17989+
}
17990+
17991+
private enum CodingKeys: String, CodingKey {
17992+
case channel
17993+
case autoenabled = "autoEnabled"
17994+
case install
17995+
case target
17996+
case campaign
17997+
}
17998+
}
17999+
18000+
public struct UpdateHoldParams: Codable, Sendable {}
18001+
18002+
public struct UpdateHoldResult: Codable, Sendable {
18003+
public let ok: Bool
18004+
public let schedule: UpdateScheduleState?
18005+
18006+
public init(
18007+
ok: Bool,
18008+
schedule: UpdateScheduleState? = nil)
18009+
{
18010+
self.ok = ok
18011+
self.schedule = schedule
18012+
}
18013+
18014+
private enum CodingKeys: String, CodingKey {
18015+
case ok
18016+
case schedule
18017+
}
18018+
}
18019+
1790218020
public struct UpdateRunParams: Codable, Sendable {
1790318021
public let sessionkey: String?
1790418022
public let deliverycontext: [String: AnyCodable]?

‎docs/gateway/configuration-reference.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ writer is best-effort, not a lossless compliance archive.
13701370

13711371
- `channel`: release channel - `"stable"`, `"extended-stable"`, `"beta"`, or `"dev"`. Extended-stable is package-only: foreground commands own installation, while the Gateway may emit read-only update hints.
13721372
- `checkOnStart`: check for npm updates when the gateway starts (default: `true`). Stored extended-stable selections use the same read-only hint and 24-hour hint schedule.
1373-
- `auto.enabled`: enable background auto-update for stable and beta package installs (default: `false`). Extended-stable never applies automatically.
1373+
- `auto.enabled`: enable background auto-update campaigns for stable and beta package installs and dev git installs (default: `false`). Extended-stable never applies automatically.
13741374

13751375
---
13761376

‎docs/install/development-channels.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ install paths:
4747
For `dev` git installs, the default checkout is `~/openclaw` (or
4848
`$OPENCLAW_HOME/openclaw` when `OPENCLAW_HOME` is set); override with
4949
`OPENCLAW_GIT_DIR`.
50+
Automatic update campaigns pin the upstream commit they announce, so the
51+
displayed list previews up to five commits from the exact target installed even
52+
if `main` advances during the countdown. A manual
53+
`openclaw update --channel dev` still targets the current upstream `main`.
5054

5155
<Tip>
5256
To keep stable and dev in parallel, use two separate checkouts and point each gateway at its own.

‎docs/install/updating.md‎

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,41 @@ Off by default. Enable it in `~/.openclaw/openclaw.json`:
263263
}
264264
```
265265

266-
| Channel | Behavior |
267-
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- |
268-
| `stable` | Applies after a built-in delay with deterministic jitter for a spread rollout. |
269-
| `extended-stable` | Checks for a read-only update hint on startup and every 24 hours when `checkOnStart` is enabled. Never applies automatically. |
270-
| `beta` | Checks on a built-in interval and applies immediately. |
271-
| `dev` | No automatic apply. Use `openclaw update` manually. |
266+
You can also choose the update channel and enable automatic updates from
267+
**Settings → Updates** (`/settings/updates`) in the Control UI.
268+
269+
| Channel | Behavior |
270+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
271+
| `stable` | After a built-in delay with deterministic jitter for a spread rollout, announces an update campaign. |
272+
| `extended-stable` | Checks for a read-only update hint on startup and every 24 hours when `checkOnStart` is enabled. Never applies automatically. |
273+
| `beta` | Checks on a built-in interval and announces an update campaign as soon as a newer release is available. |
274+
| `dev` | With `auto.enabled`, git installs check hourly. When upstream commits are available, the Gateway announces an update campaign pinned to the exact announced commit. |
275+
276+
### Update campaigns
277+
278+
When an automatic update is due, the campaign waits for active work to finish,
279+
then starts a one-minute countdown. A 15-minute hard deadline starts the update
280+
even if work remains, using the normal restart drain and session-recovery path.
281+
282+
An admin can use **Hold 1 h** once to postpone the campaign and shift its hard
283+
deadline, or choose **Update now** from the sidebar update card or
284+
**Settings → Updates**. For a `dev` git install, the campaign installs the exact
285+
commit it announced. The displayed list previews up to five commits from that
286+
fixed target and does not move if upstream `main` advances during the countdown.
287+
288+
Every failed apply ends the campaign so the UI does not remain on
289+
**Updating…**. Failures after a managed-service handoff starts are also recorded
290+
in the restart sentinel and surface after the Gateway returns; direct
291+
unsupervised failures remain in the running Gateway's logs.
292+
293+
`OPENCLAW_NO_AUTO_UPDATE=1` and external-supervisor mode disable automatic
294+
applies entirely. Startup update hints can still run unless
295+
`update.checkOnStart` is also disabled.
272296

273297
The gateway also logs an update hint on startup (disable with
274298
`update.checkOnStart: false`). Stored extended-stable selections use this
275299
read-only hint path and the existing 24-hour hint interval, but never invoke
276300
automatic installation, handoff, restart, stable delay/jitter, or beta polling.
277-
For downgrade or incident recovery, set `OPENCLAW_NO_AUTO_UPDATE=1` in the gateway environment to block automatic applies even when `update.auto.enabled` is configured. Startup update hints can still run unless `update.checkOnStart` is also disabled.
278301

279302
Package-manager updates requested through the live Gateway control-plane
280303
(`update.run`) do not replace the package tree inside the running Gateway

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,7 @@
19051905
"test:unit:fast:audit": "node scripts/test-unit-fast-audit.mjs",
19061906
"test:voicecall:closedloop": "node scripts/test-voicecall-closedloop.mjs",
19071907
"test:watch": "node scripts/test-projects.mjs --watch",
1908-
"test:windows:ci": "node scripts/test-projects.mjs src/shared/runtime-import.test.ts src/config/sessions/session-accessor.sqlite-archive.worker.test.ts src/infra/sqlite-snapshot.test.ts src/infra/ssh-client.windows.test.ts src/infra/update-managed-service-handoff.test.ts src/infra/exec-allowlist-pattern.test.ts src/infra/fs-safe-remove.test.ts src/snapshot/local-repository.windows.test.ts src/state/openclaw-database-paths.windows.test.ts src/commands/backup-verify.test.ts src/infra/state-migrations.legacy-session-store.test.ts src/test-utils/openclaw-test-state.test.ts src/agents/sessions/windows-git-bash-path.test.ts src/agents/bash-tools.exec.script-preflight.test.ts src/process/exec.windows.test.ts src/process/exec.windows.integration.test.ts src/process/windows-command.test.ts src/infra/windows-install-roots.test.ts src/node-host/invoke-system-run-allowlist.test.ts src/daemon/schtasks.startup-fallback.test.ts extensions/lobster/src/lobster-runner.test.ts extensions/mxc/test/mxc-backend.test.ts extensions/mxc/test/sandbox-policy-loader.test.ts test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts test/scripts/direct-run-entrypoints.test.ts test/scripts/format-generated-module.test.ts test/scripts/npm-runner.test.ts test/scripts/openclaw-cross-os-installer.windows.test.ts test/scripts/openclaw-cross-os-release-workflow.test.ts test/scripts/pnpm-runner.test.ts test/scripts/run-with-env.test.ts test/scripts/ts-topology.test.ts test/scripts/ui.test.ts test/scripts/vitest-process-group.test.ts",
1908+
"test:windows:ci": "node scripts/test-projects.mjs src/shared/runtime-import.test.ts src/config/sessions/session-accessor.sqlite-archive.worker.test.ts src/infra/sqlite-snapshot.test.ts src/infra/ssh-client.windows.test.ts src/infra/update-managed-service-handoff-command.test.ts src/infra/update-managed-service-handoff-lifecycle.test.ts src/infra/exec-allowlist-pattern.test.ts src/infra/fs-safe-remove.test.ts src/snapshot/local-repository.windows.test.ts src/state/openclaw-database-paths.windows.test.ts src/commands/backup-verify.test.ts src/infra/state-migrations.legacy-session-store.test.ts src/test-utils/openclaw-test-state.test.ts src/agents/sessions/windows-git-bash-path.test.ts src/agents/bash-tools.exec.script-preflight.test.ts src/process/exec.windows.test.ts src/process/exec.windows.integration.test.ts src/process/windows-command.test.ts src/infra/windows-install-roots.test.ts src/node-host/invoke-system-run-allowlist.test.ts src/daemon/schtasks.startup-fallback.test.ts extensions/lobster/src/lobster-runner.test.ts extensions/mxc/test/mxc-backend.test.ts extensions/mxc/test/sandbox-policy-loader.test.ts test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts test/scripts/direct-run-entrypoints.test.ts test/scripts/format-generated-module.test.ts test/scripts/npm-runner.test.ts test/scripts/openclaw-cross-os-installer.windows.test.ts test/scripts/openclaw-cross-os-release-workflow.test.ts test/scripts/pnpm-runner.test.ts test/scripts/run-with-env.test.ts test/scripts/ts-topology.test.ts test/scripts/ui.test.ts test/scripts/vitest-process-group.test.ts",
19091909
"test:windows:schtasks:integration": "node scripts/run-with-env.mjs CI_WINDOWS_SCHTASKS_INTEGRATION=1 OPENCLAW_E2E_VERBOSE=1 OPENCLAW_VITEST_MAX_WORKERS=1 -- node scripts/run-vitest.mjs src/daemon/schtasks.integration.e2e.test.ts",
19101910
"tool-display:check": "node --import tsx scripts/tool-display.ts --check",
19111911
"tool-display:write": "node --import tsx scripts/tool-display.ts --write",

‎packages/gateway-protocol/src/schema-export-registry.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ export {
309309
ConfigSchemaResponseSchema,
310310
ConfigSchemaLookupResultSchema,
311311
UpdateStatusParamsSchema,
312+
UpdateStatusResultSchema,
313+
UpdateAvailableSchema,
314+
UpdateScheduleStateSchema,
315+
UpdateHoldParamsSchema,
316+
UpdateHoldResultSchema,
312317
SystemAgentChatParamsSchema,
313318
SystemAgentChatQuestionSchema,
314319
SystemAgentChatResultSchema,

‎packages/gateway-protocol/src/schema/config.test.ts‎

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { Value } from "typebox/value";
22
import { describe, expect, it } from "vitest";
3-
import { ConfigSchemaLookupResultSchema, ConfigSchemaResponseSchema } from "./config.js";
3+
import {
4+
ConfigSchemaLookupResultSchema,
5+
ConfigSchemaResponseSchema,
6+
UpdateAvailableSchema,
7+
UpdateHoldParamsSchema,
8+
UpdateHoldResultSchema,
9+
UpdateScheduleStateSchema,
10+
UpdateStatusResultSchema,
11+
} from "./config.js";
412

513
const response = {
614
schema: {},
@@ -45,3 +53,128 @@ describe("ConfigSchemaLookupResultSchema", () => {
4553
).toBe(true);
4654
});
4755
});
56+
57+
describe("update protocol schemas", () => {
58+
it("accepts package and git schedule targets", () => {
59+
expect(
60+
Value.Check(UpdateScheduleStateSchema, {
61+
channel: "beta",
62+
autoEnabled: true,
63+
install: { kind: "package" },
64+
target: { kind: "package", version: "2026.8.1-beta.1" },
65+
campaign: {
66+
id: "campaign-1",
67+
state: "countdown",
68+
announcedAtMs: 1,
69+
applyAtMs: 60_001,
70+
forceAtMs: 900_001,
71+
updatedAtMs: 1,
72+
},
73+
}),
74+
).toBe(true);
75+
expect(
76+
Value.Check(UpdateScheduleStateSchema, {
77+
channel: "dev",
78+
autoEnabled: true,
79+
install: { kind: "git" },
80+
target: {
81+
kind: "git",
82+
upstreamRef: "origin/main",
83+
upstreamSha: "abcdef1234",
84+
commitsBehind: 3,
85+
},
86+
}),
87+
).toBe(true);
88+
});
89+
90+
it("validates the additive update.status result", () => {
91+
expect(
92+
Value.Check(UpdateStatusResultSchema, {
93+
sentinel: null,
94+
updateAvailable: {
95+
currentVersion: "2026.8.1",
96+
latestVersion: "2026.8.1",
97+
channel: "dev",
98+
currentSha: "1234567890",
99+
upstreamRef: "origin/main",
100+
upstreamSha: "abcdef1234",
101+
commitsBehind: 3,
102+
commits: [
103+
{ sha: "abc1234", subject: "First change" },
104+
{ sha: "def5678", subject: "Second change" },
105+
],
106+
},
107+
schedule: {
108+
channel: "dev",
109+
autoEnabled: true,
110+
target: {
111+
kind: "git",
112+
upstreamRef: "origin/main",
113+
upstreamSha: "abcdef1234",
114+
commitsBehind: 3,
115+
},
116+
},
117+
}),
118+
).toBe(true);
119+
expect(
120+
Value.Check(UpdateStatusResultSchema, {
121+
sentinel: null,
122+
updateAvailable: null,
123+
schedule: {
124+
channel: "dev",
125+
autoEnabled: true,
126+
target: { kind: "git", upstreamRef: "origin/main", commitsBehind: -1 },
127+
},
128+
}),
129+
).toBe(false);
130+
});
131+
132+
it("accepts optional bounded dev commit summaries", () => {
133+
const availability = {
134+
currentVersion: "2026.8.1",
135+
latestVersion: "2026.8.1",
136+
channel: "dev",
137+
currentSha: "1234567890",
138+
upstreamRef: "origin/main",
139+
upstreamSha: "abcdef1234",
140+
commitsBehind: 6,
141+
};
142+
expect(Value.Check(UpdateAvailableSchema, availability)).toBe(true);
143+
expect(
144+
Value.Check(UpdateAvailableSchema, {
145+
...availability,
146+
commits: [{ sha: "abc1234", subject: "First change" }],
147+
}),
148+
).toBe(true);
149+
expect(
150+
Value.Check(UpdateAvailableSchema, {
151+
...availability,
152+
commits: Array.from({ length: 6 }, (_, index) => ({
153+
sha: `abc123${index}`,
154+
subject: `Change ${index}`,
155+
})),
156+
}),
157+
).toBe(false);
158+
});
159+
160+
it("validates update.hold params and result", () => {
161+
expect(Value.Check(UpdateHoldParamsSchema, {})).toBe(true);
162+
expect(
163+
Value.Check(UpdateHoldResultSchema, {
164+
ok: true,
165+
schedule: {
166+
channel: "beta",
167+
autoEnabled: true,
168+
campaign: {
169+
id: "campaign-1",
170+
state: "waiting-for-idle",
171+
announcedAtMs: 1,
172+
holdUntilMs: 3_600_001,
173+
forceAtMs: 4_500_001,
174+
updatedAtMs: 1,
175+
},
176+
},
177+
}),
178+
).toBe(true);
179+
});
180+
});

0 commit comments

Comments
 (0)