Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/release-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ jobs:
;;
esac

- name: Verify release-notes entry (#1870)
# Fail at DISPATCH time, not publish time: the version being released
# must already have a tiered entry (model-written summary) in
# release-notes/package.json — part of the release prep, same PR as
# the version bump. Prereleases (dev channel) are exempt.
run: |
VER="${{ steps.version.outputs.version }}"
case "$VER" in
*-*) echo "prerelease $VER — release-notes gate skipped"; exit 0 ;;
esac
node -e "
const notes = require('./release-notes/package.json').billionContextReleaseNotes;
const entry = notes && notes.releases && notes.releases.find((e) => e.version === process.argv[1]);
if (!entry) {
console.error('release ' + process.argv[1] + ' has no release-notes entry (tier + model-written summary). Add it to release-notes/package.json and merge to master BEFORE dispatching the release — see release-notes/README.md (#1870).');
process.exit(1);
}
console.log('release-notes entry ok:', entry.version, '[' + entry.tier + ']', entry.summary.slice(0, 80));
" "$VER"

- name: Bump version
run: |
node -e '
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Publish Release Notes

# #1870: publishes the companion release-notes package whenever release-notes/
# changes. Mirrors advisories.yml: the git copy keeps a placeholder version; the
# real version is derived from the registry (max of local and published) + 1
# patch, so every push yields a fresh version without committing version churn.
#
# Entries describe releases that ALREADY exist on npm (the release gate in
# release.yml enforces that the version being published has an entry HERE
# first), so there is no existence gate on this side.
#
# 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.

on:
push:
branches: [master]
paths:
- "release-notes/**"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: npm ci

- name: Validate release-notes payload
run: |
node -e "
const semver = require('semver');
const p = require('./release-notes/package.json').billionContextReleaseNotes;
if (!p || p.schema !== 1 || !Array.isArray(p.releases)) {
console.error('invalid billionContextReleaseNotes payload (need schema:1 + releases array)');
process.exit(1);
}
if (p.releases.length === 0 || p.releases.length > 20) {
console.error('releases must hold 1..20 entries (got ' + p.releases.length + ')');
process.exit(1);
}
const seen = new Set();
for (const e of p.releases) {
if (!semver.valid(e.version)) {
console.error('invalid version:', JSON.stringify(e.version));
process.exit(1);
}
if (seen.has(e.version)) {
console.error('duplicate entry for', e.version);
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));
process.exit(1);
}
if (typeof e.summary !== 'string' || !e.summary.trim()) {
console.error(e.version, ': summary must be a non-empty string');
process.exit(1);
}
if (e.summary.length > 400) {
console.error(e.version, ': summary too long (' + e.summary.length + ' chars, cap 400)');
process.exit(1);
}
if (e.date !== undefined && !/^\\d{4}-\\d{2}-\\d{2}$/.test(e.date)) {
console.error(e.version, ': date must be YYYY-MM-DD, got', JSON.stringify(e.date));
process.exit(1);
}
}
"

- name: Publish next patch
working-directory: release-notes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
LATEST=$(npm view billion-context-release-notes version 2>/dev/null || echo "0.0.0")
LOCAL=$(node -p "require('./package.json').version")
NEXT=$(node -e "const s=require('semver');const base=s.gt(process.argv[1],process.argv[2])?process.argv[1]:process.argv[2];const v=base.split('.');v[2]=String(Number(v[2])+1);console.log(v.join('.'))" "$LOCAL" "$LATEST")
npm version "$NEXT" --no-git-tag-version --allow-same-version
npm publish --access public
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ jobs:
echo "prerelease=false" >> $GITHUB_OUTPUT
fi

- 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).
# Fails BEFORE tagging/publishing so nothing ships invisible.
if: steps.check.outputs.is_release == 'true' && steps.pre.outputs.prerelease == 'false'
run: |
VER="${{ steps.version.outputs.version }}"
node -e "
const notes = require('./release-notes/package.json').billionContextReleaseNotes;
const entry = notes && notes.releases && notes.releases.find((e) => e.version === process.argv[1]);
if (!entry) {
console.error('release ' + process.argv[1] + ' has no release-notes entry (tier + model-written summary). Add it to release-notes/package.json in the release PR — see release-notes/README.md (#1870).');
process.exit(1);
}
console.log('release-notes entry ok:', entry.version, '[' + entry.tier + ']', entry.summary.slice(0, 80));
" "$VER"

- name: Create tag
if: steps.check.outputs.is_release == 'true'
run: |
Expand Down
2 changes: 2 additions & 0 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ 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_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). |
| `BILI_REPLAY_RETRY_BASE_MS` | Base backoff delay (ms) for replay retries after a transient upstream rejection (default `1500`; set `0` to disable the delay). See #189. Also drives the main-path transport-retry backoff (#1688). |
Expand Down
2 changes: 2 additions & 0 deletions CONFIGURATION.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
| `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_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` 的路径(旧版 / 共享文件)。 |
| `BILI_REPLAY_RETRY_BASE_MS` | 回放重试的基础退避延迟(毫秒):上游瞬时拒绝后重试(默认 `1500`;设 `0` 关闭延迟)。见 #189。同时驱动主路径传输重试的退避(#1688)。 |
Expand Down
52 changes: 52 additions & 0 deletions release-notes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# billion-context-release-notes (companion payload, #1870)

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

Companion package mechanics mirror `advisories/` (#1481):

- The payload lives in the custom field `billionContextReleaseNotes` of this
package's packument; `latest` on npm is the live doc.
- CI (`.github/workflows/release-notes.yml`) validates and publishes a new
patch version of this package on every push to `master` touching
`release-notes/**`. The `version` field here is a placeholder — never bump
it by hand.

## Entry shape (schema 1)

| Field | Required | Notes |
|----------|----------|----------------------------------------------------|
| version | yes | Exact released version (semver) |
| date | no | `YYYY-MM-DD` release date |
| tier | yes | `routine` (default) or `recommended` (restart soon)|
| 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.

## 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.
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`
re-checks before tagging/publishing. A stable release without an entry
fails the run. Prereleases (dev channel) are exempt.

Example entry:

```json
{
"version": "0.1.180",
"date": "2026-10-02",
"tier": "recommended",
"summary": "OpenCode WebSocket traffic is intercepted again — compression and usage stats no longer silently no-op on OpenCode ≥ 2.0.20 (#1844)."
}
```
40 changes: 40 additions & 0 deletions release-notes/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "billion-context-release-notes",
"version": "0.0.0",
"description": "Tiered, model-written release notes for billion-context. Read-only companion payload consumed by the proxy's #1870 visibility watcher; version number is bumped by CI on every publish (the field itself is meaningless).",
"private": false,
"publishConfig": {
"access": "public",
"provenance": false
},
"billionContextReleaseNotes": {
"schema": 1,
"updated": "2026-10-01",
"releases": [
{
"version": "0.1.179",
"date": "2026-10-01",
"tier": "recommended",
"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",
"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."
},
{
"version": "0.1.177",
"date": "2026-10-01",
"tier": "routine",
"summary": "dsh: stale landing page after restart fixed (#1787); no-op for other hosts."
},
{
"version": "0.1.176",
"date": "2026-10-01",
"tier": "recommended",
"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."
}
]
}
}
26 changes: 25 additions & 1 deletion src/acp-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { getUnrecognizedPathStats } from "./server/observability.js";
import { ccrEnabled, ccrLoopConfig, contentStoreOf } from "./store.js";
import { coveredRefSpan } from "./decompress-shared.js";
import { preCompactionArchiveOf, type Session } from "./session.js";
import { VERSION } from "./version.js";
import { describeAdvisory, getAdvisoryState } from "./advisory.js";
import { getUpdateVisibility } from "./update-notes.js";
import { VERSION } from "./version.js";

export interface AcpStatusCtx {
core: CompressionCore;
Expand Down Expand Up @@ -147,6 +148,29 @@ export function handleAcpStatus(args: Record<string, unknown>, ctx: AcpStatusCtx
extra.push("");
extra.push(`CRITICAL ADVISORY (instance-level): bili is auto-updating through the self-updater's safety chain — ${describeAdvisory(adv.active, adv.lastError)}. Live state: GET /__bili/status → advisory.`);
}
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.
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}).`);
} else {
lines.push(`UPDATE AVAILABLE (instance-level): newer recommended release on the channel — running ${upd.runningVersion}.`);
}
for (const e of upd.span) {
lines.push(` · ${e.version} [${e.tier}] ${e.summary}`);
}
if (!upd.pendingRestart) {
lines.push(` Update with: npm install -g billion-context@${upd.span[upd.span.length - 1]?.version ?? "latest"}`);
}
lines.push("Live state: GET /__bili/status → update.");
extra.push(...lines);
}
const blind = getBlindTunnelStats();
if (blind.total > 0) {
// #897: CONNECT traffic to non-MITM hosts was blind-relayed — it never
Expand Down
13 changes: 13 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { log as loggerLog } from "./logger.js";
import { createAutoRestartHandler } from "./restart.js";
import { checkForUpdate, startAutoUpdate } from "./update.js";
import { startAdvisoryWatcher, getAdvisoryState, advisoryDeferring, advisoryBlocksVersion } from "./advisory.js";
import { startReleaseNotesWatcher } from "./update-notes.js";
import { resolveProxy } from "./upstream-proxy.js";
import { runMcpStdio } from "./mcp.js";
import { PLUGIN_AGENTS, isPluginAgent, pluginInstall, pluginRemove, pluginStatusAll, pluginUpdate, type PluginAgent } from "./plugin-install.js";
Expand Down Expand Up @@ -630,4 +631,16 @@ export async function main(): Promise<void> {
}),
});
}
// #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.
if (opts.releaseNotesCheck) {
startReleaseNotesWatcher({
packageName: PACKAGE_NAME,
currentVersion: VERSION,
releaseNotesUrl: opts.releaseNotesUrl,
resolveProxy: (url) => resolveProxy(opts.routes, opts.proxy, url, opts.proxyFallback),
});
}
}
Loading
Loading