Skip to content

Commit e3c40ef

Browse files
authored
feat(update): notify extended-stable availability (#100438)
* docs(update): clarify extended-stable notifications * feat(update): notify extended-stable availability * fix(update): isolate notification state * fix(docs): align update channel table * fix(update): refresh after channel switch * fix(update): satisfy notification checks * test(update): prove loopback notification path * test(update): fix loopback server lifecycle * fix(update): refresh extended stable without cache * fix(update): retain extended stable throttle marker
1 parent ad833d7 commit e3c40ef

8 files changed

Lines changed: 687 additions & 83 deletions

File tree

‎docs/cli/update.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ from outside the Gateway process tree. If the handoff is unavailable,
155155
`update.run` returns a structured response with the safe shell command to run
156156
manually.
157157

158-
Extended-stable is deliberately excluded from startup checks and background
159-
auto-update scheduling. Explicit foreground updates, bare foreground updates
160-
with stored `update.channel: "extended-stable"`, on-demand status, and managed
158+
Stored extended-stable selections receive read-only startup and 24-hour update
159+
hints when `update.checkOnStart` is enabled. These checks never apply an update,
160+
start a handoff, restart the Gateway, use stable delay/jitter, or use beta
161+
polling cadence. Explicit foreground updates, bare foreground updates with
162+
stored `update.channel: "extended-stable"`, on-demand status, and their managed
161163
Gateway handoff remain supported.
162164

163165
When a local managed Gateway service is installed and restart is enabled,

‎docs/gateway/configuration-reference.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,12 +1212,12 @@ rows. Query them with [`openclaw audit`](/cli/audit) or the
12121212
}
12131213
```
12141214

1215-
- `channel`: release channel - `"stable"`, `"extended-stable"`, `"beta"`, or `"dev"`. Extended-stable is a package-only, foreground/on-demand channel; it is skipped by startup checks and background auto-update.
1216-
- `checkOnStart`: check for npm updates when the gateway starts (default: `true`).
1217-
- `auto.enabled`: enable background auto-update for package installs (default: `false`).
1215+
- `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.
1216+
- `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.
1217+
- `auto.enabled`: enable background auto-update for stable and beta package installs (default: `false`). Extended-stable never applies automatically.
12181218
- `auto.stableDelayHours`: minimum delay in hours before stable-channel auto-apply (default: `6`; max: `168`).
12191219
- `auto.stableJitterHours`: extra stable-channel rollout spread window in hours (default: `12`; max: `168`).
1220-
- `auto.betaCheckIntervalHours`: how often beta-channel checks run in hours (default: `1`; max: `24`).
1220+
- `auto.betaCheckIntervalHours`: how often beta-channel checks run in hours (default: `1`; max: `24`). Stable delay/jitter and beta polling settings do not apply to extended-stable.
12211221

12221222
---
12231223

‎docs/install/development-channels.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ OpenClaw ships four update channels:
1212

1313
- **stable**: npm dist-tag `latest`. Recommended for most users.
1414
- **extended-stable**: npm dist-tag `extended-stable`. A net-new, trailing
15-
supported-month package channel. It is package-only and foreground-only in
16-
this release.
15+
supported-month package channel. It is package-only, and installation is
16+
foreground-only. A stored selection receives read-only update hints when
17+
`update.checkOnStart` is enabled, but never applies automatically.
1718
- **beta**: npm dist-tag `beta`. Falls back to `latest` when `beta` is missing
1819
or older than the current stable release.
1920
- **dev**: moving head of `main` (git). npm dist-tag `dev` when published. `main`

‎docs/install/updating.md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ when the beta tag is missing or its version is older than the latest stable
3434
release. Use `--tag beta` for a one-off package update pinned to the raw npm
3535
beta dist-tag instead.
3636

37-
`--channel extended-stable` is package-only and foreground-only. OpenClaw reads
38-
the public npm `extended-stable` selector, verifies the selected exact package,
39-
and installs that exact version. Missing or inconsistent registry data fails
40-
closed; it never falls back to `latest`. If the selected version is older than
41-
the installed version, the normal downgrade confirmation still applies.
37+
`--channel extended-stable` is package-only, and installation remains
38+
foreground-only. OpenClaw reads the public npm `extended-stable` selector,
39+
verifies the selected exact package, and installs that exact version. Missing
40+
or inconsistent registry data fails closed; it never falls back to `latest`.
41+
If the selected version is older than the installed version, the normal
42+
downgrade confirmation still applies. The CLI persists the channel after a
43+
successful core update; a direct `npm install -g openclaw@extended-stable`
44+
does not update `update.channel`.
4245
After the core swap, eligible official npm plugins with bare/default or
4346
`latest` intent converge to that exact core version. Exact pins and explicit
4447
non-`latest` tags, third-party plugins, and non-npm sources remain unchanged.
@@ -213,12 +216,14 @@ Off by default. Enable it in `~/.openclaw/openclaw.json`:
213216
| Channel | Behavior |
214217
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
215218
| `stable` | Waits `stableDelayHours` (default: 6), then applies with deterministic jitter across `stableJitterHours` (default: 12) for a spread rollout. |
216-
| `extended-stable` | No startup check or automatic apply. Use `openclaw update` or `openclaw update status` manually. |
219+
| `extended-stable` | Checks for a read-only update hint on startup and every 24 hours when `checkOnStart` is enabled. Never applies automatically. |
217220
| `beta` | Checks every `betaCheckIntervalHours` (default: 1) and applies immediately. |
218221
| `dev` | No automatic apply. Use `openclaw update` manually. |
219222

220-
The gateway also logs an update hint on startup (disable with `update.checkOnStart: false`).
221-
Stored extended-stable selections skip startup and background resolution entirely.
223+
The gateway also logs an update hint on startup (disable with
224+
`update.checkOnStart: false`). Stored extended-stable selections use this
225+
read-only hint path and the existing 24-hour hint interval, but never invoke
226+
automatic installation, handoff, restart, stable delay/jitter, or beta polling.
222227
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.
223228

224229
Package-manager updates requested through the live Gateway control-plane

‎src/config/schema.help.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ export const FIELD_HELP: Record<string, string> = {
7171
update:
7272
"Update-channel and startup-check behavior for keeping OpenClaw runtime versions current. Use conservative channels in production and more experimental channels only in controlled environments.",
7373
"update.channel":
74-
'Update channel for git + npm installs ("stable", "extended-stable", "beta", or "dev"). Extended-stable is package-only and foreground-only.',
75-
"update.checkOnStart": "Check for npm updates when the gateway starts (default: true).",
76-
"update.auto.enabled": "Enable background auto-update for package installs (default: false).",
74+
'Update channel for git + npm installs ("stable", "extended-stable", "beta", or "dev"). Extended-stable is package-only: installation is foreground-only, with optional read-only startup hints.',
75+
"update.checkOnStart":
76+
"Check for npm updates when the gateway starts, including read-only extended-stable hints (default: true).",
77+
"update.auto.enabled":
78+
"Enable background auto-update for stable and beta package installs; extended-stable never auto-applies (default: false).",
7779
"update.auto.stableDelayHours":
7880
"Minimum delay before stable-channel auto-apply starts (default: 6).",
7981
"update.auto.stableJitterHours":
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// Proves startup update discovery through the real extended-stable registry resolver.
2+
import http from "node:http";
3+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
4+
import { closeOpenClawStateDatabaseForTest } from "../state/openclaw-state-db.js";
5+
import {
6+
createOpenClawTestState,
7+
type OpenClawTestState,
8+
} from "../test-utils/openclaw-test-state.js";
9+
import type { UpdateCheckResult } from "./update-check.js";
10+
11+
vi.mock("./openclaw-root.js", async () => {
12+
const actual = await vi.importActual<typeof import("./openclaw-root.js")>("./openclaw-root.js");
13+
return {
14+
...actual,
15+
resolveOpenClawPackageRoot: vi.fn(async () => "/opt/openclaw"),
16+
};
17+
});
18+
19+
vi.mock("./update-check.js", async () => {
20+
const actual = await vi.importActual<typeof import("./update-check.js")>("./update-check.js");
21+
return {
22+
...actual,
23+
checkUpdateStatus: vi.fn(async () => ({
24+
root: "/opt/openclaw",
25+
installKind: "package",
26+
packageManager: "npm",
27+
}) satisfies UpdateCheckResult),
28+
};
29+
});
30+
31+
vi.mock("../version.js", () => ({
32+
VERSION: "1.0.0",
33+
}));
34+
35+
describe("extended-stable startup update integration", () => {
36+
let testState: OpenClawTestState;
37+
let server: http.Server | undefined;
38+
39+
beforeEach(async () => {
40+
server = undefined;
41+
testState = await createOpenClawTestState({
42+
layout: "state-only",
43+
prefix: "openclaw-update-startup-integration-",
44+
env: {
45+
NODE_ENV: "test",
46+
NPM_CONFIG_REGISTRY: undefined,
47+
OPENCLAW_UPDATE_PACKAGE_SPEC: undefined,
48+
VITEST: undefined,
49+
},
50+
});
51+
});
52+
53+
afterEach(async () => {
54+
const activeServer = server;
55+
if (activeServer) {
56+
await new Promise<void>((resolve, reject) => {
57+
activeServer.close((error) => (error ? reject(error) : resolve()));
58+
});
59+
}
60+
closeOpenClawStateDatabaseForTest();
61+
await testState.cleanup();
62+
});
63+
64+
it("emits a read-only hint after verifying a newer exact loopback package", async () => {
65+
const requests: string[] = [];
66+
const registryServer = http.createServer((request, response) => {
67+
requests.push(request.url ?? "");
68+
response.writeHead(200, { "content-type": "application/json" });
69+
response.end(JSON.stringify({ version: "2.0.0" }));
70+
});
71+
server = registryServer;
72+
await new Promise<void>((resolve) => {
73+
registryServer.listen(0, "127.0.0.1", resolve);
74+
});
75+
const address = registryServer.address();
76+
if (!address || typeof address === "string") {
77+
throw new Error("expected loopback registry address");
78+
}
79+
process.env.OPENCLAW_UPDATE_PACKAGE_SPEC = "openclaw";
80+
process.env.NPM_CONFIG_REGISTRY = `http://127.0.0.1:${address.port}/`;
81+
82+
const { runGatewayUpdateCheck, resetUpdateAvailableStateForTest } =
83+
await import("./update-startup.js");
84+
resetUpdateAvailableStateForTest();
85+
const log = { info: vi.fn() };
86+
const onUpdateAvailableChange = vi.fn();
87+
const runAutoUpdate = vi.fn();
88+
89+
await runGatewayUpdateCheck({
90+
cfg: { update: { channel: "extended-stable", auto: { enabled: true } } },
91+
log,
92+
isNixMode: false,
93+
allowInTests: true,
94+
onUpdateAvailableChange,
95+
runAutoUpdate,
96+
});
97+
98+
expect(requests).toEqual(["/openclaw/extended-stable", "/openclaw/2.0.0"]);
99+
expect(onUpdateAvailableChange).toHaveBeenCalledWith({
100+
currentVersion: "1.0.0",
101+
latestVersion: "2.0.0",
102+
channel: "extended-stable",
103+
});
104+
expect(log.info).toHaveBeenCalledWith(
105+
"update available (extended-stable): v2.0.0 (current v1.0.0). Run: openclaw update",
106+
);
107+
expect(runAutoUpdate).not.toHaveBeenCalled();
108+
});
109+
});

0 commit comments

Comments
 (0)