diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 3d299a01b3..64775b19c6 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -12,9 +12,10 @@ name: Publish Release Notes # Doc shape (schema 1): # releases: newest-first; ≤20 entries (consumers cap the same way); # fields: version (exact tag), date (YYYY-MM-DD), tier, summary. -# tier: "routine" (default) | "recommended" (worth restarting soon). -# Critical defects stay in advisories/ (#1481) — this doc never claims -# critical. +# tier: "routine" (default) | "recommended" (restart-soon, record-only) +# | "critical" (serious defect users must act on — the only tier +# users ever see, #1977). Force-upgradeable defects stay in +# advisories/ (#1481) — entries here never trigger the safety chain. on: push: @@ -60,8 +61,8 @@ jobs: process.exit(1); } seen.add(e.version); - if (e.tier !== 'routine' && e.tier !== 'recommended') { - console.error(e.version, ': tier must be routine|recommended, got', JSON.stringify(e.tier)); + if (e.tier !== 'routine' && e.tier !== 'recommended' && e.tier !== 'critical') { + console.error(e.version, ': tier must be routine|recommended|critical, got', JSON.stringify(e.tier)); process.exit(1); } if (typeof e.summary !== 'string' || !e.summary.trim()) { diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0aeafe6e48..ca323c21bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,7 +75,7 @@ jobs: - name: Verify release-notes entry (#1870) # Visibility gate: every stable release must carry a tiered, # user-meaningful entry in release-notes/package.json (the entry is - # part of the release prep PR, model-written, tier routine|recommended). + # part of the release prep PR, model-written, tier routine|recommended|critical). # Fails BEFORE tagging/publishing so nothing ships invisible. if: steps.check.outputs.is_release == 'true' && steps.pre.outputs.prerelease == 'false' run: | diff --git a/CONFIGURATION.md b/CONFIGURATION.md index f64eb05267..30262bb061 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -809,7 +809,7 @@ Environment variables take precedence over the config file. They are useful for | `BILI_MODEL_INFO_RETRY_MS` | Cooldown (ms) before the dsh native plugin re-resolves the current model's context window after a resolve that failed or returned no window (#1812/#1836): a cached entry without a window is not final — instead of latching headerless for the process lifetime, the next request after this cooldown triggers a retry. Default `30000`; non-numeric or negative values fall back to `30000`. Test hook — shortened by the dsh-native unit test so it never waits wall-clock; leave unset in production. | | `BILI_ADVISORY_CHECK` | Set to `0` to disable the critical-defect advisory watcher (#1481). Default ON — it runs independently of `ACP_AUTO_UPDATE` so that installs with auto-update off still get force-updated out of a known-broken version range. Fail-open: an unreachable/malformed source only warns, never blocks model traffic. File-config key: `advisoryCheck`. | | `BILI_ADVISORY_URL` | Override for the advisory document URL. Default: the companion package `billion-context-advisories` on the configured registry (`BILI_UPDATE_REGISTRY` aware). File-config key: `advisoryUrl`. | -| `BILI_RELEASE_NOTES_CHECK` | Set to `0` to disable the tiered release-notes visibility watcher (#1870). Default ON — pure visibility: fetches the companion release-notes doc and surfaces "update ready — restart to finish" (disk newer than running) or "recommended update available" on `acp_status` and the `/acp` panel. Never installs, never restarts; fail-open. File-config key: `releaseNotesCheck`. | +| `BILI_RELEASE_NOTES_CHECK` | Set to `0` to disable the release-notes visibility watcher (#1870). Default ON — pure visibility, silent by default (#1977): fetches the companion release-notes doc and surfaces "CRITICAL update ready — restart to finish" (disk newer than running) or "critical update available" on `acp_status` and the `/acp` panel ONLY when the pending span contains a `critical`-tier entry; routine/recommended releases never surface. Never installs, never restarts; fail-open. File-config key: `releaseNotesCheck`. | | `BILI_RELEASE_NOTES_URL` | Override for the release-notes document URL. Default: the companion package `billion-context-release-notes` on the configured registry (`BILI_UPDATE_REGISTRY` aware). File-config key: `releaseNotesUrl`. | | ~~`BILI_HOST_USAGE_CREDIT`~~ / ~~`hostUsageCredit`~~ | **Removed in #660.** Used to select the host-facing usage mode. The #408 uncompressed-baseline backfill is gone entirely — every host now reports the actually-forwarded (post-fold) request as provider-measured (matches `[acp-usage] input=`). Old values left in env or the config file are ignored; remove them. See the "Bug history lesson" section of PR #691. | | `ACP_PROVIDERS` | Path to an external `providers.json` (legacy / shared file). | diff --git a/CONFIGURATION.zh-CN.md b/CONFIGURATION.zh-CN.md index d916721e59..ef43881495 100644 --- a/CONFIGURATION.zh-CN.md +++ b/CONFIGURATION.zh-CN.md @@ -808,7 +808,7 @@ | `BILI_MODEL_INFO_RETRY_MS` | dsh 原生模型窗口解析失败(或解析结果不带窗口)后的重试冷却(毫秒,#1812/#1836):匹配的缓存条目没有 context window 时不视为最终结果 —— 不再让整个进程生命周期 latching 成无 header 状态,而是该冷却过期后由下一个请求触发重新解析。默认 `30000`;非数字或负值回退 `30000`。测试钩子 —— dsh-native 单元测试用它缩短冷却、避免真实等待;生产环境保持 unset。 | | `BILI_ADVISORY_CHECK` | 设为 `0` 禁用严重缺陷公告监视器(#1481)。默认开启 —— 它独立于 `ACP_AUTO_UPDATE` 运行,确保关闭了自动更新的安装也能被强制移出已知缺陷版本范围。fail-open:公告源不可达/格式错误只告警,绝不阻断模型流量。文件配置键:`advisoryCheck`。 | | `BILI_ADVISORY_URL` | 公告文档 URL 覆盖。默认:已配置 registry(感知 `BILI_UPDATE_REGISTRY`)上的伴生包 `billion-context-advisories`。文件配置键:`advisoryUrl`。 | -| `BILI_RELEASE_NOTES_CHECK` | 设为 `0` 禁用分级发版说明可见性监视器(#1870)。默认开启 —— 纯可见性:拉取伴生发版说明文档,并在 `acp_status` 与 `/acp` 面板提示「更新已就绪待重启」(磁盘版本新于运行版本)或「存在推荐更新」。绝不安装、绝不重启;fail-open。文件配置键:`releaseNotesCheck`。 | +| `BILI_RELEASE_NOTES_CHECK` | 设为 `0` 禁用发版说明可见性监视器(#1870)。默认开启 —— 纯可见性,且默认静默(#1977):拉取伴生发版说明文档,仅当待更新跨度内含 `critical` 级条目时,才在 `acp_status` 与 `/acp` 面板提示「CRITICAL 更新已就绪待重启」(磁盘版本新于运行版本)或「存在 critical 更新」;routine/recommended 级发版永不上屏。绝不安装、绝不重启;fail-open。文件配置键:`releaseNotesCheck`。 | | `BILI_RELEASE_NOTES_URL` | 发版说明文档 URL 覆盖。默认:已配置 registry(感知 `BILI_UPDATE_REGISTRY`)上的伴生包 `billion-context-release-notes`。文件配置键:`releaseNotesUrl`。 | | ~~`BILI_HOST_USAGE_CREDIT`~~ / ~~`hostUsageCredit`~~ | **#660 已移除。** 曾用于选择宿主可见的用量模式。#408 的未折叠基线回补(backfill)已整体删除 —— 所有宿主现在统一上报“实际转发(后折叠)请求”的 provider 实测用量,与 `[acp-usage] input=` 一致。遗留该环境变量 / 配置键的旧值会被忽略,请删除。教训详见 PR #691 的 “Bug 历史教训” 一节。 | | `ACP_PROVIDERS` | 指向外部 `providers.json` 的路径(旧版 / 共享文件)。 | diff --git a/reference/release.md b/reference/release.md index 8a8f839a01..b1ff255c22 100644 --- a/reference/release.md +++ b/reference/release.md @@ -43,9 +43,12 @@ The Agent does steps 1–6, the human does step 7 (merge). "summary": "what changes FOR THE USER, one line, issue/PR refs" } ``` - - `tier`: `routine` (default) or `recommended` (worth restarting soon — - correctness/cache/self-heal fixes; marketing is NEVER recommended). - Critical defects go to `advisories/`, never here. + - `tier`: `routine` (default) | `recommended` (restart-soon record — + correctness/cache/self-heal fixes; NOT user-visible, marketing is NEVER + recommended) | `critical` (a serious defect users must act on — the only + tier that ever surfaces to users, #1977; use sparingly, when the fix + matters more than the silence). Force-upgradeable defects go to + `advisories/`, never here. - The summary is model-written, ≤400 chars, newest-first order, cap 20 entries. NEVER hand-edit the companion package's own `"version"` field — CI bumps it on publish. diff --git a/release-notes/README.md b/release-notes/README.md index b220861d44..92cdf2e8f1 100644 --- a/release-notes/README.md +++ b/release-notes/README.md @@ -2,9 +2,10 @@ Tiered, model-written release notes consumed by the proxy's visibility watcher (`src/update-notes.ts`): acp_status and the `/acp` panel use them to -tell users and agents "an update is ready — restart to finish" or "a -recommended release exists", with a per-release summary and the user-side -span (everything between the running version and the newest release). +tell users and agents "a critical update is ready — restart to finish" or +"a critical fix is available" — ONLY for `critical`-tier entries (#1977: +silent by default) — with a per-release summary and the user-side span +(everything between the running version and the newest release). Companion package mechanics mirror `advisories/` (#1481): @@ -21,19 +22,31 @@ Companion package mechanics mirror `advisories/` (#1481): |----------|----------|----------------------------------------------------| | version | yes | Exact released version (semver) | | date | no | `YYYY-MM-DD` release date | -| tier | yes | `routine` (default) or `recommended` (restart soon)| +| tier | yes | `routine` (default) / `recommended` (restart soon, record-only) / `critical` (see below) | | summary | yes | One user-meaningful line, ≤400 chars, model-written| -Rules: newest-first, ≤20 entries, no duplicates. `recommended` is for -"worth restarting soon" (correctness/cache fixes, self-heal fixes) — NOT for -marketing. Critical defects stay in `advisories/` — this doc never claims -critical. +Rules: newest-first, ≤20 entries, no duplicates. Tier discipline (#1977): + +- `routine` — default. The overwhelming majority of releases. +- `recommended` — "worth restarting soon" (correctness/cache fixes, + self-heal fixes); RECORD-ONLY since #1977: it feeds the release log but + never surfaces to users. NOT for marketing. +- `critical` — the release fixes a serious defect users must act on + (correctness / data / billing class) that sits BELOW the advisory bar. + The only tier that surfaces (`CRITICAL UPDATE READY/AVAILABLE` on + acp_status + the `/acp` panel). Use sparingly and deliberately — a + nag-per-release here is exactly what #1977 fixed. + +Force-upgradeable critical defects stay in `advisories/` (#1481) — entries +here never trigger the safety chain, they only make an update visible. ## Release process (enforced by gates) 1. **Prep:** as part of the release prep, add the new version's entry to `release-notes/package.json` (tier + summary). The summary is model-written: describe what changes FOR THE USER, cite issue/PR numbers. + Pick the tier per the discipline above — `critical` only for serious + defect fixes users must act on; when in doubt, `routine`. 2. Merge to master. The publish workflow ships the updated doc. 3. Dispatch the one-click release (or merge the release PR). `release-manual.yml` checks the entry at dispatch time; `release.yml` diff --git a/release-notes/package.json b/release-notes/package.json index 9135fa7458..143afca1ec 100644 --- a/release-notes/package.json +++ b/release-notes/package.json @@ -14,25 +14,25 @@ { "version": "0.1.181", "date": "2026-10-03", - "tier": "recommended", + "tier": "routine", "summary": "Window & preflight accuracy wave: dsh context windows resolve again after every resolveModelInfo call failed on a detached receiver (#1943); preflight no longer fires at 59–63% real usage — local estimates are now calibrated against provider-reported usage (#1940, #1933); pi virtual-model selections no longer double-compress (#1962); re-signed SDK-HMAC-SHA256 egress on armed tunnels (#1884)." }, { "version": "0.1.180", "date": "2026-10-02", - "tier": "recommended", + "tier": "routine", "summary": "OpenCode WebSocket traffic is intercepted again — compression and usage stats no longer silently no-op on OpenCode ≥ 2.0.20 (#1844)." }, { "version": "0.1.179", "date": "2026-10-01", - "tier": "recommended", + "tier": "routine", "summary": "Compression is now inherited across agent restart / resume / new-branch forks (#1834): folded summaries survive instead of silently re-expanding on the wire (claude-code and openai-chat wires; codex/gemini in #1853 follow-up)." }, { "version": "0.1.178", "date": "2026-10-01", - "tier": "recommended", + "tier": "routine", "summary": "dsh installs self-heal: profile bundles now converge to the global version automatically (#1803/#1804) — fixes the one-time 'invalid plugin' boot crash after a new bili publish." }, { @@ -44,7 +44,7 @@ { "version": "0.1.176", "date": "2026-10-01", - "tier": "recommended", + "tier": "routine", "summary": "Stability wave: zero-injection session identity keeps the prefix cache hot across fork/resume (#1692/#1611); launcher port hardening (#1756); ACP tag-echo strip no longer eats prose (#1722); responses degenerate-output guard and transport replay retry." } ] diff --git a/src/acp-status.ts b/src/acp-status.ts index 1381bd40ac..ad60e59178 100644 --- a/src/acp-status.ts +++ b/src/acp-status.ts @@ -150,17 +150,20 @@ export function handleAcpStatus(args: Record, ctx: AcpStatusCtx } const upd = getUpdateVisibility(VERSION); if (upd.visible) { - // #1870: the self-updater is a silent courier on native lanes — the - // "Restart to finish" log line never reaches pi/opencode/dsh users, - // so disk runs new while the process runs old. This is the surface - // agents actually poll: tell them a restart is actionable NOW, or - // that a recommended release exists when auto-update is off. + // #1870 + #1977: the self-updater is a silent courier on native + // lanes — the "Restart to finish" log line never reaches + // pi/opencode/dsh users, so disk runs new while the process runs old. + // This is the surface agents actually poll — but by default it is + // SILENT (#1977: not every release deserves the user's attention); + // it only speaks when the span carries a critical-tier entry, + // telling them a restart is actionable NOW, or that a critical fix + // exists while auto-update is off. extra.push(""); const lines: string[] = []; if (upd.pendingRestart) { - lines.push(`UPDATE READY (instance-level): ${upd.diskVersion} downloaded — restart this agent's proxy to finish (running ${upd.runningVersion}).`); + lines.push(`CRITICAL UPDATE READY (instance-level): ${upd.diskVersion} downloaded — restart this agent's proxy to finish (running ${upd.runningVersion}).`); } else { - lines.push(`UPDATE AVAILABLE (instance-level): newer recommended release on the channel — running ${upd.runningVersion}.`); + lines.push(`CRITICAL UPDATE AVAILABLE (instance-level): release with a critical-tier fix on the channel — running ${upd.runningVersion}.`); } for (const e of upd.span) { lines.push(` · ${e.version} [${e.tier}] ${e.summary}`); diff --git a/src/cli.ts b/src/cli.ts index 2886ab6bca..e60631b105 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -631,10 +631,10 @@ export async function main(): Promise { }), }); } - // #1870: tiered release-notes visibility — fetch + cache only (never - // installs, never restarts). Runs independently of autoUpdate for the - // same reason as the advisory watcher: installs with auto-update off - // still deserve to learn a recommended update exists. + // #1870 release-notes visibility (#1977 silent by default) — fetch + + // cache only (never installs, never restarts). Runs independently of + // autoUpdate for the same reason as the advisory watcher: installs with + // auto-update off still deserve to learn when a critical-tier fix exists. if (opts.releaseNotesCheck) { startReleaseNotesWatcher({ packageName: PACKAGE_NAME, diff --git a/src/plugin.ts b/src/plugin.ts index 64f7c01da4..474cbf3130 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -868,9 +868,10 @@ export function handlePluginStatus(conversationId: string, res: import("node:htt } const upd = getUpdateVisibility(VERSION); if (upd.visible) { - // #1870: visibility for the silent courier — one line, same - // before-footer slot as the advisory (remote-doc text; the $-escape - // below already covers it). + // #1870 visibility for the silent courier, #1977 display policy: + // silent unless the span carries a critical-tier entry — one line, + // same before-footer slot as the advisory (remote-doc text; the + // $-escape below already covers it). preFooter.push(describeUpdateReady(upd)); } const webUrl = webSessionUrl(deps.webOrigin, session.id); diff --git a/src/update-notes.ts b/src/update-notes.ts index c3a1108896..9d638e0888 100644 --- a/src/update-notes.ts +++ b/src/update-notes.ts @@ -1,13 +1,18 @@ /** - * Tiered release-notes visibility (#1870). + * Tiered release-notes visibility (#1870, display policy #1977). * * The npm companion package `billion-context-release-notes` (published by CI * from this repo's release-notes/ directory, exactly like the advisories * companion) carries one model-written summary per release with a tier label: - * - routine — default; worth having, no urgency - * - recommended — worth restarting soon (correctness/cache fixes) - * Critical defects stay in the ADVISORY doc (#1481) — it is the only - * authoritative source for force-upgrades; this doc never claims critical. + * - routine — default; worth having, no urgency. Never user-visible. + * - recommended — worth restarting soon; RECORD-ONLY since #1977 — a + * release log, not a nag. Never user-visible. + * - critical — fixes a serious defect users must act on (correctness / + * data / billing class) yet below the advisory bar. The + * ONLY tier that surfaces (#1977: silent by default). + * Force-upgradeable critical defects stay in the ADVISORY doc (#1481) — it + * remains the only authoritative source for forced updates; entries here + * never trigger the safety chain, they only make the update visible. * * Why a watcher at all: the self-updater is a silent courier — it downloads a * new version and writes one log line ("Restart to finish") that native-lane @@ -34,7 +39,7 @@ const SUPPORTED_SCHEMA = 1; /** Producer-side cap (release-notes/README): the doc keeps ~20 entries. */ export const MAX_RELEASE_NOTES_ENTRIES = 20; -export type ReleaseTier = "routine" | "recommended"; +export type ReleaseTier = "routine" | "recommended" | "critical"; export type ReleaseNoteEntry = { /** Exact released version this entry describes. */ @@ -108,7 +113,7 @@ export function parseReleaseNotesDoc(raw: unknown): { entries: ReleaseNoteEntry[ if (typeof item !== "object" || item === null) continue; const e = item as Record; const version = typeof e.version === "string" ? e.version.trim() : ""; - const tier = e.tier === "recommended" || e.tier === "routine" ? e.tier : undefined; + const tier = e.tier === "recommended" || e.tier === "routine" || e.tier === "critical" ? e.tier : undefined; const summary = typeof e.summary === "string" ? e.summary.trim() : ""; if (!semver.valid(version) || tier === undefined || !summary) continue; entries.push({ @@ -159,15 +164,18 @@ export type UpdateVisibility = { pendingRestart: boolean; /** Notes for everything between running and the newest known release. */ span: ReleaseNoteEntry[]; - /** A recommended-tier entry sits in the span — worth updating soon even - * without a pending restart (e.g. auto-update disabled). */ - recommended: boolean; + /** A critical-tier entry sits in the span — the only thing that surfaces + * (#1977): a serious-defect release tells the user even without a + * pending restart (e.g. auto-update disabled), and a pending restart is + * only announced when the pending span contains one. */ + critical: boolean; }; /** Derived, synchronous view for the visibility surfaces (#1870): reads the - * watcher's cached state — no network, no fs. Clean installs (no span, no - * pending restart) yield visible=false and every surface stays - * byte-identical to the pre-#1870 output. */ + * watcher's cached state — no network, no fs. Clean installs, routine-only + * spans and recommended-only spans all yield visible=false (#1977: silent + * by default) and every surface stays byte-identical to the pre-#1870 + * output. */ export function getUpdateVisibility(runningVersion: string): UpdateVisibility & { visible: boolean } { const diskVersion = state.diskVersion; const pendingRestart = @@ -175,29 +183,31 @@ export function getUpdateVisibility(runningVersion: string): UpdateVisibility & semver.valid(diskVersion) === diskVersion && semver.gt(diskVersion, runningVersion); const span = spanNotes(state.entries, runningVersion); - const recommended = span.some((e) => e.tier === "recommended"); + const critical = span.some((e) => e.tier === "critical"); return { runningVersion, ...(diskVersion !== undefined ? { diskVersion } : {}), pendingRestart, span, - recommended, - visible: pendingRestart || recommended, + critical, + visible: critical, }; } /** Shared wording for the /acp panel line — one line, stripper-safe slot is * the caller's job. Kept compact: the panel is small, and acp_status carries - * the full span. */ + * the full span. Only ever rendered for critical spans (#1977); the final + * fallback branch exists for totality (invisible states never reach the + * surfaces, but the function must stay total for future callers). */ export function describeUpdateReady(v: UpdateVisibility): string { const latest = v.span.length > 0 ? v.span[v.span.length - 1].version : v.diskVersion; - const topRec = v.span.find((e) => e.tier === "recommended"); + const topCritical = v.span.find((e) => e.tier === "critical"); if (v.pendingRestart && latest !== undefined) { - const notable = topRec ? ` Notable since ${v.runningVersion}: ${topRec.summary}` : ""; - return `Update ready: ${latest} — restart to finish.${notable}`; + const notable = topCritical ? ` Critical fix since ${v.runningVersion}: ${topCritical.summary}` : ""; + return `Critical update ready: ${latest} — restart to finish.${notable}`; } - if (topRec && latest !== undefined) { - return `Update available: ${latest} (recommended) — ${topRec.summary} (npm install -g billion-context@${latest})`; + if (topCritical && latest !== undefined) { + return `Critical update available: ${latest} — ${topCritical.summary} (npm install -g billion-context@${latest})`; } return `Update available: ${latest ?? "newer version"} — npm install -g billion-context@${latest ?? "latest"}`; } diff --git a/tests/update-notes.test.ts b/tests/update-notes.test.ts index b03a95cd35..fb294f1afa 100644 --- a/tests/update-notes.test.ts +++ b/tests/update-notes.test.ts @@ -3,9 +3,11 @@ // file), so disk runs new while the process runs old. These tests pin the // three behaviors that make the fix safe and useful: // 1. parsing/validation of the remote doc (bad entries skipped, bad doc = error), -// 2. the user-side span + visibility derivation (restart-pending beats -// everything; recommended surfaces even without pending restart; clean -// installs see NOTHING — byte-identical to pre-#1870 output), +// 2. the user-side span + visibility derivation (#1977: silent by +// default — routine/recommended NEVER surface; only a critical-tier +// entry does, and a pending restart is announced only when the pending +// span carries one; clean installs see NOTHING — byte-identical to +// pre-#1870 output), // 3. the two surfaces: acp_status section + /acp panel line before the // footer (stripper-safe), with remote-doc text escaped for replace(). import { test } from "node:test"; @@ -37,13 +39,13 @@ const NEXT = semver.inc(RUNNING, "patch") ?? "0.0.2"; const NEXT2 = semver.inc(NEXT, "patch") ?? "0.0.3"; const SURFACE_ENTRIES: ReleaseNoteEntry[] = [ { version: NEXT2, tier: "routine", summary: "docs and log polish" }, - { version: NEXT, date: "2026-10-02", tier: "recommended", summary: "OpenCode WebSocket traffic intercepted again (#1844)" }, + { version: NEXT, date: "2026-10-02", tier: "critical", summary: "OpenCode WebSocket traffic intercepted again (#1844)" }, { version: RUNNING, tier: "recommended", summary: "compression survives restart/resume forks (#1834)" }, ]; const ENTRIES: ReleaseNoteEntry[] = [ { version: "0.1.181", tier: "routine", summary: "docs and log polish" }, - { version: "0.1.180", date: "2026-10-02", tier: "recommended", summary: "OpenCode WebSocket traffic intercepted again (#1844)" }, + { version: "0.1.180", date: "2026-10-02", tier: "critical", summary: "OpenCode WebSocket traffic intercepted again (#1844)" }, { version: "0.1.179", tier: "recommended", summary: "compression survives restart/resume forks (#1834)" }, ]; @@ -57,14 +59,16 @@ test("#1870 parseReleaseNotesDoc: valid doc parses; malformed entries skip; brok { version: "0.1.180", tier: "urgent", summary: "bad tier skipped" }, { version: "0.1.179", tier: "routine", summary: " " }, { version: "0.1.178", tier: "recommended", date: "2026-10-01", summary: "ok with date" }, + { version: "0.1.177", tier: "critical", date: "2026-10-01", summary: "ok critical accepted (#1977)" }, ], }, }; const parsed = parseReleaseNotesDoc(doc); assert.equal(parsed.error, undefined); - assert.equal(parsed.entries.length, 2); + assert.equal(parsed.entries.length, 3); assert.equal(parsed.entries[0].version, "0.1.181"); assert.equal(parsed.entries[1].date, "2026-10-01"); + assert.equal(parsed.entries[2].tier, "critical", "critical tier accepted (#1977)"); assert.equal(parseReleaseNotesDoc(null).error, "document is not a JSON object"); assert.equal(parseReleaseNotesDoc({}).error, "missing billionContextReleaseNotes object"); @@ -86,7 +90,7 @@ test("#1870 spanNotes: strictly-newer entries, ascending (user-side diff), inval assert.deepEqual(spanNotes(ENTRIES, "garbage"), [], "invalid running version → empty (no crash)"); }); -test("#1870 getUpdateVisibility: pending restart beats everything; recommended-only still visible; clean = invisible", () => { +test("#1977 getUpdateVisibility: silent by default — only critical surfaces; pending restart alone is silent", () => { _resetReleaseNotesWatcherForTest(); try { // Clean install: no disk info, no span → invisible (byte-identical surfaces). @@ -95,20 +99,36 @@ test("#1870 getUpdateVisibility: pending restart beats everything; recommended-o assert.equal(clean.pendingRestart, false); assert.deepEqual(clean.span, []); - // Recommended release exists beyond running version (auto-update off). + // #1977 core: routine/recommended-only span (span from 0.1.180 = + // [0.1.181 routine]) → invisible even though an update exists. _setReleaseNotesStateForTest({ entries: ENTRIES }); - const recOnly = getUpdateVisibility("0.1.179"); + const recOnly = getUpdateVisibility("0.1.180"); assert.equal(recOnly.pendingRestart, false); - assert.equal(recOnly.recommended, true); - assert.equal(recOnly.visible, true, "recommended alone must surface (updater may be off)"); - assert.deepEqual(recOnly.span.map((e) => e.version), ["0.1.180", "0.1.181"]); + assert.equal(recOnly.critical, false); + assert.equal(recOnly.visible, false, "#1977: recommended/routine alone must NOT surface"); + assert.deepEqual(recOnly.span.map((e) => e.version), ["0.1.181"]); - // Disk newer than running → restart-pending, the actionable case. + // Critical entry in the span (auto-update off) → the one case that + // surfaces without a restart pending. + const crit = getUpdateVisibility("0.1.179"); + assert.equal(crit.pendingRestart, false); + assert.equal(crit.critical, true); + assert.equal(crit.visible, true, "critical alone must surface (updater may be off)"); + assert.deepEqual(crit.span.map((e) => e.version), ["0.1.180", "0.1.181"]); + + // Disk newer than running + critical in the pending span → the + // actionable announcement. _setReleaseNotesStateForTest({ entries: ENTRIES, diskVersion: "0.1.181" }); const pending = getUpdateVisibility("0.1.179"); assert.equal(pending.pendingRestart, true); assert.equal(pending.visible, true); + // #1977: disk newer but the pending span is routine/recommended-only + // → restart happens naturally, nothing surfaces. + const pendingQuiet = getUpdateVisibility("0.1.180"); + assert.equal(pendingQuiet.pendingRestart, true); + assert.equal(pendingQuiet.visible, false, "pending restart with no critical entry stays silent"); + // Disk older or equal (edge: rollback / same) → not pending. assert.equal(getUpdateVisibility("0.1.181").pendingRestart, false); _setReleaseNotesStateForTest({ entries: ENTRIES, diskVersion: "0.1.175" }); @@ -123,28 +143,28 @@ test("#1870 getUpdateVisibility: pending restart beats everything; recommended-o } }); -test("#1870 describeUpdateReady: actionable wording + byte-stability", () => { +test("#1977 describeUpdateReady: critical wording + byte-stability", () => { _resetReleaseNotesWatcherForTest(); try { _setReleaseNotesStateForTest({ entries: ENTRIES, diskVersion: "0.1.181" }); const pending = getUpdateVisibility("0.1.179"); const line = describeUpdateReady(pending); - assert.ok(line.startsWith("Update ready: 0.1.181 — restart to finish."), `pending-restart wording (got: ${line})`); - assert.ok(line.includes("#1844"), "top recommended summary carried"); + assert.ok(line.startsWith("Critical update ready: 0.1.181 — restart to finish."), `pending-restart wording (got: ${line})`); + assert.ok(line.includes("#1844"), "top critical summary carried"); assert.equal(line, describeUpdateReady(getUpdateVisibility("0.1.179")), "byte-stable for identical state"); _setReleaseNotesStateForTest({ entries: ENTRIES }); // no disk info const rec = describeUpdateReady(getUpdateVisibility("0.1.179")); - assert.ok(rec.startsWith("Update available: 0.1.181 (recommended) —"), `recommended wording (got: ${rec})`); + assert.ok(rec.startsWith("Critical update available: 0.1.181 —"), `critical wording (got: ${rec})`); assert.ok(rec.includes("npm install -g billion-context@0.1.181"), "manual command when restart cannot finish it"); - // Span with NO recommended entry + no pending restart = invisible; the + // Span with NO critical entry + no pending restart = invisible; the // routine-only branch exists for panel completeness only. const routineOnly = getUpdateVisibility("0.1.178"); // span = 179(rec),… — pick a base where span is routine-only const routineEntries: ReleaseNoteEntry[] = [{ version: "0.2.0", tier: "routine", summary: "polish" }]; _setReleaseNotesStateForTest({ entries: routineEntries }); const ro = getUpdateVisibility("0.1.179"); - assert.equal(ro.recommended, false); + assert.equal(ro.critical, false); assert.equal(ro.visible, false); assert.ok(describeUpdateReady(ro).includes("0.2.0"), "fallback line still names the version"); assert.ok(routineOnly !== undefined); @@ -199,7 +219,7 @@ function mockRes(): { res: http.ServerResponse; status: number; body: string } { return out; } -test("#1870 acp_status: UPDATE READY section lists the span; clean state stays byte-absent", async () => { +test("#1977 acp_status: CRITICAL UPDATE READY section lists the span; clean + non-critical states stay byte-absent", async () => { _resetReleaseNotesWatcherForTest(); const { handleAcpStatus } = await import("../src/acp-status.ts"); try { @@ -207,18 +227,24 @@ test("#1870 acp_status: UPDATE READY section lists the span; clean state stays b const clean = handleAcpStatus({}, ctx); assert.ok(!clean.includes("UPDATE READY") && !clean.includes("UPDATE AVAILABLE"), "no section on a clean install"); + // #1977: a newer disk version with a routine/recommended-only span + // must NOT surface either — silence is the default. + _setReleaseNotesStateForTest({ entries: [SURFACE_ENTRIES[0]], diskVersion: NEXT2 }); + const quiet = handleAcpStatus({}, ctx); + assert.ok(!quiet.includes("UPDATE READY") && !quiet.includes("UPDATE AVAILABLE"), "#1977: pending restart without a critical entry stays silent"); + _setReleaseNotesStateForTest({ entries: SURFACE_ENTRIES, diskVersion: NEXT2 }); const out = handleAcpStatus({}, ctx); - assert.ok(out.includes(`UPDATE READY (instance-level): ${NEXT2} downloaded — restart this agent's proxy to finish`), "actionable headline names the disk version"); + assert.ok(out.includes(`CRITICAL UPDATE READY (instance-level): ${NEXT2} downloaded — restart this agent's proxy to finish`), "actionable headline names the disk version"); assert.ok(out.includes(`(running ${VERSION})`), "names the running version for contrast"); - assert.ok(out.includes(`· ${NEXT} [recommended] OpenCode WebSocket traffic intercepted again (#1844)`), "span renders versions below disk but above running, tier-first"); + assert.ok(out.includes(`· ${NEXT} [critical] OpenCode WebSocket traffic intercepted again (#1844)`), "span renders versions below disk but above running, tier-first"); assert.ok(out.includes(`· ${NEXT2} [routine] docs and log polish`), "span renders up to the disk version the restart will finish"); assert.ok(out.includes("GET /__bili/status → update"), "points at the live-state field"); // No disk info (auto-update off): AVAILABLE wording + manual command. _setReleaseNotesStateForTest({ entries: SURFACE_ENTRIES }); const avail = handleAcpStatus({}, ctx); - assert.ok(avail.includes("UPDATE AVAILABLE (instance-level):"), "available headline when nothing is pending"); + assert.ok(avail.includes("CRITICAL UPDATE AVAILABLE (instance-level):"), "available headline when nothing is pending"); assert.ok(avail.includes(`npm install -g billion-context@${NEXT2}`), "manual update command present"); assert.ok(!avail.includes("UPDATE READY"), "ready wording reserved for the pending-restart case"); } finally { @@ -226,7 +252,7 @@ test("#1870 acp_status: UPDATE READY section lists the span; clean state stays b } }); -test("#1870 /acp panel: one update line BEFORE the footer, stripper-safe, byte-exact when clean; $ survives", async () => { +test("#1977 /acp panel: one critical-update line BEFORE the footer, stripper-safe, byte-exact when clean; $ survives", async () => { _resetReleaseNotesWatcherForTest(); const { _resetSessionsForTest } = await import("../src/session.ts"); const { handlePluginStatus } = await import("../src/plugin.ts"); @@ -241,16 +267,16 @@ test("#1870 /acp panel: one update line BEFORE the footer, stripper-safe, byte-e handlePluginStatus("never-seen", r0.res, deps, true); assert.equal(r0.status, 200); const p0 = JSON.parse(r0.body).panel as string; - assert.ok(!p0.includes("Update ready") && !p0.includes("Update available"), "no update line when clean"); + assert.ok(!p0.includes("Update ready") && !p0.includes("Update available") && !p0.includes("Critical update"), "no update line when clean"); assert.ok(p0.includes(PANEL_BOX_FOOTER), "footer present when clean"); _setReleaseNotesStateForTest({ entries: SURFACE_ENTRIES, diskVersion: NEXT2 }); const r1 = mockRes(); handlePluginStatus("never-seen", r1.res, deps, true); const p1 = JSON.parse(r1.body).panel as string; - assert.ok(p1.includes(`Update ready: ${NEXT2} — restart to finish.`), "panel line present"); + assert.ok(p1.includes(`Critical update ready: ${NEXT2} — restart to finish.`), "panel line present"); assert.ok(p1.includes(PANEL_BOX_FOOTER), "footer still present with the update line"); - assert.ok(p1.indexOf("Update ready") < p1.indexOf(PANEL_BOX_FOOTER), "update line sits BEFORE the footer (stripper anchor)"); + assert.ok(p1.indexOf("Critical update ready") < p1.indexOf(PANEL_BOX_FOOTER), "update line sits BEFORE the footer (stripper anchor)"); const footerEsc = PANEL_BOX_FOOTER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); assert.equal((p1.match(new RegExp(footerEsc, "g")) ?? []).length, 1, "footer appears exactly once"); @@ -258,7 +284,7 @@ test("#1870 /acp panel: one update line BEFORE the footer, stripper-safe, byte-e // byte-exact (same escape the advisory line relies on). const dollarSummary = "saves $5 and echoes $& `$'` verbatim"; _setReleaseNotesStateForTest({ - entries: [{ version: NEXT, tier: "recommended", summary: dollarSummary }], + entries: [{ version: NEXT, tier: "critical", summary: dollarSummary }], diskVersion: NEXT, }); const r2 = mockRes();