From c0ba8c84a834929df21f2eaabf8271989c58cb0f Mon Sep 17 00:00:00 2001 From: Louie0806 Date: Mon, 2 Nov 2026 00:30:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(config):=20ship=20the=20incremental=20?= =?UTF-8?q?turn=20lane=20at=20100%=20=E2=80=94=20a=20fresh=20install=20is?= =?UTF-8?q?=20delta-by-default=20(#3248)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The incremental lane (hosts send only the conversation delta instead of re-sending full history every turn, #3248/#5155/#5156) shipped with `rollout.features.pluginIncrementalTurns: { percent: 0 }`, so every install had to be switched on by an operator. All four defects that originally blocked it are closed and fixed: #3343 (marker divert had no loopback validation), #3433 (dsh-native was not wired to wireMessagesLookAnthropic, so the OpenAI lane silently dropped tool_calls), #3352 (opencode native got zero savings) and #3369 (one transient failure permanently demoted the client). The baked-in plan is now `percent: 100`: a new user installs, starts, and the lane is live with no config file, no env var and no panel action. This is safe by construction because the fast path only takes over when EVERY verification matches — body shape (`incrementalTurnBodyShape`), the host's GET probe, the unified-storage sidecar and the ack. Any miss falls the whole turn back onto the unchanged full-resend path, byte for byte, so the default changes only how many bytes the HOST SENDS (the #5156 saving), never a correctness guarantee. Same for the security surface: shaped turns must pass `adminGateDenial` (loopback-only, #3343) before `applyTurn`, so turning the default on widens nothing. Escape hatches are unchanged and still ordered env > config > baked-in percent > fail-closed: the file key `rollout.features.pluginIncrementalTurns` (a boolean or a percent) and `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0`. Tests: the probe case in tests/incremental-lane.test.ts flips to the new contract (default reports enabled, env "0" turns it off); the 503 case is driven through the env escape hatch instead of the baked-in plan; a GA row in tests/rollout.test.ts pins the shipped percent plus both hatches; and tests/incremental-lane-default-on.test.ts drives the production default end to end over a clean XDG root with NO config file (real featureEnabled / incrementalTurnsEnabled / GET /__bili/plugin/turn). Negative control: with the plan reverted to 0, cases 1/2/5 go red while both escape-hatch cases stay green. --- CHANGELOG.md | 8 ++ src/rollout.ts | 12 +- tests/incremental-lane-default-on.test.ts | 129 ++++++++++++++++++++++ tests/incremental-lane.test.ts | 26 +++-- tests/rollout.test.ts | 19 ++++ 5 files changed, 178 insertions(+), 16 deletions(-) create mode 100644 tests/incremental-lane-default-on.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b28c8d421..b24852ab9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,14 @@ Versions follow the merge of a `*_release-v*` branch; CI publishes to npm on tag ### Added - **消息时间戳渲染默认开启(#4313 后续)**:此前 `compress.messageTimestamps` 为可选特性(默认关,线上字节与特性前逐字节一致)。生产会话的缓存审计(同会话开关前后命中率均 95.0%、无一条时间戳导致的前缀重写 miss、全部异常可归因上游 TTL 驱逐)证实存戳渲染跨轮逐字节稳定,故默认翻转为**开**:`time=` 压缩标签属性、回执指纹行 `[起 – 止]` 覆盖跨度、摘要 Occurred 行对所有人默认可见(每条消息首次出现时铸一次不可变墙钟戳,渲染只读存戳不读墙钟)。关闭方式不变:文件 `compress.messageTimestamps: false` 或 `BILI_MESSAGE_TIMESTAMPS=0`,关闭后每个出站字节与 pre-#4313 master 一致。升级用户的一次性代价:标志首次解析为开的那个重启后,每个活跃会话付一次冻结前缀缓存重写(旧消息补上 time= 属性 + 提示词变体切换),之后稳定。测试基线:tests/preload-test-env.mjs 整套件 pin 显示门控关,字节对比型金标保持特性前形态;issue4313 toggle 套件按新契约翻转并新增 message-timestamps-default-on.test.ts 钉住生产默认路径。 +### #3248 — 增量车道 GA:全新安装开箱即用 + +- **行为变更(旧→关→开)**:增量车道(宿主只发对话增量、不再每轮全量重发历史,#3248/#5155/#5156)此前 `rollout.features.pluginIncrementalTurns` 打包值为 `percent: 0`——**每个安装都要运营者手动开**。四个当年阻塞它的缺陷已全部关闭并修复:#3343(marker divert 缺回环校验,安全)、#3433(dsh-native 未接入 `wireMessagesLookAnthropic`,OpenAI 车道会丢 `tool_calls`)、#3352(opencode 原生零收益)、#3369(一次瞬时失败永久降级)。现在打包值改为 **`percent: 100`**:新装用户无需任何配置文件、环境变量或面板操作,装上即走增量车道。 +- **为什么默认翻转是安全的**:快车道只在**全部**验证命中时接手——请求体形状(`incrementalTurnBodyShape`)、宿主 GET 探针、统一存储 sidecar、回执。任何一项不满足就整轮回落到原有的全量重发路径,字节与从前完全一致。所以这个默认值只改变**宿主发出多少字节**(#5156 的收益),不改变任何正确性保证。安全面同理:形状化请求在进入 `applyTurn` 之前先过 `adminGateDenial` 回环校验(#3343),非回环/隧道/不可信来源一律 403,默认开启不扩大攻击面。 +- **单一开关 + 两个逃生口**:文件 `rollout.features.pluginIncrementalTurns: false`(或任意 percent 灰度)、环境变量 `BILI_ROLLOUT_=0`。两者语义与顺序不变:env > config > 打包 percent > 关闭(fail closed)。 +- **升级提示**:已在跑增量车道的安装字节不变(它们本来就开着);从默认关升上来的安装,第一个回合起即走增量路径,无需重启以外的任何操作。需要保回旧行为的用户设上面任一逃生口即可。 +- 测试:`tests/incremental-lane.test.ts` 的探针用例按新契约翻转(默认报 enabled,env `0` 才关);503 用例改由 env 逃生口驱动;新增 `tests/rollout.test.ts` 内的 GA 打包值 + 双逃生口断言,以及 `tests/incremental-lane-default-on.test.ts`(干净 XDG 根、无配置文件、真实 `featureEnabled`/`incrementalTurnsEnabled`/`GET /__bili/plugin/turn` 三段驱动;反向对照证明默认回退到 0 时 1/2/5 三条必须变红)。 + ### #5079 — `prompt_cache_key` 自注入默认关闭,`promptCache.routing` 一个开关管住两条 wire - **行为变更(旧→新)**:此前 bili 在插件车道对一切目的地默认给请求体盖 `prompt_cache_key=<会话 id>`(#2218/#2649 定案,Responses wire 仅对 `api.openai.com` 注入)。由于大量服务见到该字段会直接拒绝、且这类服务无法枚举,**默认反转为关闭**:`promptCache.routing` 缺省值从 `"auto"` 变为 `"disabled"`(无法识别的值同样落到 `"disabled"`)。客户端自带的 key 不受影响:任何模式下都原样转发(A/B 探测记忆对已证实拒收的 origin+model 组合照常撤键)。 diff --git a/src/rollout.ts b/src/rollout.ts index 3a1586736d..057e0ea8df 100644 --- a/src/rollout.ts +++ b/src/rollout.ts @@ -48,11 +48,13 @@ export interface RolloutPlan { export const ROLLOUT_FEATURES: Record = { // #3248 incremental turns: lets a native extension send only the delta of // a conversation (marker `x-bili-plugin-turn` on ordinary model requests) - // once enabled for this install. Default 0% — every client keeps the - // byte-identical full-resend behavior. Operators force it on with - // `rollout.features.pluginIncrementalTurns: true` (or a percent), or - // `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=1`. - pluginIncrementalTurns: { percent: 0 }, + // once enabled for this install. Default 100% — GA: the full-resend path + // is still what runs whenever any verification misses (body shape, probe, + // sidecar, ack), so the default changes only how many bytes the host + // sends (#5156), never a correctness guarantee. Escape hatches: + // `rollout.features.pluginIncrementalTurns: false` (or a percent), or + // `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0`. + pluginIncrementalTurns: { percent: 100 }, // #4804 WS delta continuation: codex/opencode WebSocket clients that keep a // previous_response_id checkpoint stop reconstructing full history on every // turn — the session augments the delta with the server-committed previous diff --git a/tests/incremental-lane-default-on.test.ts b/tests/incremental-lane-default-on.test.ts new file mode 100644 index 0000000000..52623d8d06 --- /dev/null +++ b/tests/incremental-lane-default-on.test.ts @@ -0,0 +1,129 @@ +// #3248/#5156 GA follow-up (nails the PRODUCTION default end-to-end): a fresh +// install must answer "the incremental lane is enabled" from the version's +// baked-in rollout plan alone — no BILI_ROLLOUT_* env var, no +// `rollout.features` entry in the config file, no operator action. Both escape +// hatches (file `enabled: false`, env "0") must still turn the lane off. +// +// This drives the honest production expressions instead of copies of their +// predicates: a fresh XDG root with NO config file, the real `featureEnabled` / +// `incrementalTurnsEnabled` entry points, and a real `startServer` asked through +// its real GET probe on the turn path. +import assert from "node:assert/strict"; +import http from "node:http"; +import { once } from "node:events"; +import test from "node:test"; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { defaultConfig } from "acp-kernel"; +import { startServer } from "../src/server.ts"; +import type { ProxyOptions } from "../src/config.ts"; +import { SessionStore, _setStoreForTest } from "../src/persist.ts"; +import { _resetPluginStateForTest } from "../src/plugin.ts"; +import { _resetSessionsForTest } from "../src/session.ts"; +import { _setForTest as _setRegistryForTest } from "../src/registry.ts"; +import { resetToolRingForTest } from "../src/tool-ring.ts"; +import { __resetIncrementalLaneForTests, incrementalTurnsEnabled } from "../src/incremental-lane.ts"; +import { ROLLOUT_FEATURES, featureEnabled, resolveRollout, rolloutEnvName, rolloutInstallId } from "../src/rollout.ts"; + +process.env.NODE_ENV = "test"; + +const FEATURE = "pluginIncrementalTurns"; +const ENV_VAR = rolloutEnvName(FEATURE); +const testRoot = mkdtempSync(join(tmpdir(), "bili-incr-ga-")); +test.after(() => rmSync(testRoot, { recursive: true, force: true })); + +const KEYS = [ENV_VAR, "BILI_CONFIG_FILE", "XDG_STATE_HOME", "XDG_DATA_HOME", "XDG_CACHE_HOME", "XDG_CONFIG_HOME", "BILI_STORAGE_UNIFIED"]; +const savedEnv = new Map(); +for (const key of KEYS) savedEnv.set(key, process.env[key]); +test.after(() => { + for (const [key, value] of savedEnv) { + if (value === undefined) delete process.env[key]; + else process.env[key] = value; + } +}); + +/** A believable fresh install: an empty config dir, so loadConfigFile() carries + * no `rollout` section at all — the state a new user's machine is in. */ +function freshInstall(): string { + const dir = mkdtempSync(join(testRoot, "root-")); + for (const key of ["XDG_STATE_HOME", "XDG_DATA_HOME", "XDG_CACHE_HOME", "XDG_CONFIG_HOME"]) process.env[key] = dir; + mkdirSync(join(dir, "billion-context"), { recursive: true }); + delete process.env[ENV_VAR]; + delete process.env.BILI_CONFIG_FILE; + return dir; +} + +test("GA default: the baked-in plan ships the lane at 100%, not behind a canary", () => { + const plan = ROLLOUT_FEATURES[FEATURE]; + assert.ok(plan !== undefined, "the feature must be registered in the version plan"); + assert.equal(plan.percent, 100, "the version plan must ship the lane at 100% (GA)"); +}); + +test("GA default: a fresh install with no config file resolves the lane ON", () => { + freshInstall(); + assert.equal(featureEnabled(FEATURE), true, "no operator action may be required for a fresh install"); + const decision = resolveRollout(FEATURE, { id: rolloutInstallId() }); + assert.equal(decision.enabled, true); + assert.equal(decision.source, "bucket", "GA still resolves through the bucketing tier (100% = every bucket)"); +}); + +test("GA default: escape hatch 1 — file `enabled: false` still turns the lane off", () => { + const dir = freshInstall(); + writeFileSync(join(dir, "billion-context", "billion-context.json"), + JSON.stringify({ rollout: { features: { [FEATURE]: { enabled: false } } } }), "utf8"); + assert.equal(featureEnabled(FEATURE), false, "a user who opted out must stay off"); +}); + +test("GA default: escape hatch 2 — env \"0\" resolves off through the top tier", () => { + freshInstall(); + process.env[ENV_VAR] = "0"; + try { + assert.equal(featureEnabled(FEATURE), false); + const decision = resolveRollout(FEATURE, { id: rolloutInstallId() }); + assert.equal(decision.source, "env", "the env tier is the top of the ladder"); + assert.equal(decision.enabled, false); + } finally { + delete process.env[ENV_VAR]; + } +}); + +test("GA default: the real GET probe on the turn path reports the lane enabled", async () => { + const dir = freshInstall(); + process.env.BILI_STORAGE_UNIFIED = "full"; + _resetSessionsForTest(); + _resetPluginStateForTest(); + resetToolRingForTest(); + __resetIncrementalLaneForTests(); + const store = new SessionStore({ dir: join(dir, "sessions"), enabled: true, debounceMs: 60000 }); + _setStoreForTest(store); + _setRegistryForTest({}); + const upstream = http.createServer((req, res) => { + req.on("data", () => undefined); + req.on("end", () => { + res.writeHead(200, { "content-type": "application/json" }); + res.end(JSON.stringify({ id: "msg_test", role: "assistant", content: [{ type: "text", text: "answer" }], usage: { input_tokens: 10, output_tokens: 1 } })); + }); + }); + upstream.listen(0, "127.0.0.1"); + await once(upstream, "listening"); + const addr = upstream.address(); + assert.ok(addr !== null && typeof addr === "object"); + const upstreamUrl = `http://127.0.0.1:${addr.port}`; + const proxy = await startServer({ port: 0, host: "127.0.0.1", upstream: upstreamUrl, routes: { [upstreamUrl]: { models: { "claude-test": { context: 400000 } } } }, modelContextLimit: 400000, kernelConfig: defaultConfig(400000), compress: { injectTool: true, injectNudge: false }, promptCache: { routing: "auto" }, sessionHeader: "x-acp-session", log: false, debug: false, passthrough: false, autoUpdate: false, mitm: { enabled: false, domains: [] } } as ProxyOptions); + if (!(proxy as unknown as { listening?: boolean }).listening) await once(proxy, "listening"); + const base = `http://127.0.0.1:${(proxy.address() as { port: number }).port}`; + try { + assert.equal(incrementalTurnsEnabled(), true, "the effective gate must resolve the lane on for a fresh install"); + const response = await fetch(`${base}/__bili/plugin/turn`, { method: "GET", headers: { "x-bili-plugin": "dsh" } }); + assert.equal(response.status, 200); + const body = (await response.json()) as { enabled?: boolean; feature?: string; storage?: string }; + assert.equal(body.feature, FEATURE); + assert.equal(body.storage, "unified", "full mode keeps the sidecar gate live"); + assert.equal(body.enabled, true, "a fresh install must see the lane enabled with no operator action"); + } finally { + await new Promise((resolve) => proxy.close(() => resolve())); + store.closeQuietly(); + await new Promise((resolve) => upstream.close(() => resolve())); + } +}); diff --git a/tests/incremental-lane.test.ts b/tests/incremental-lane.test.ts index 2408a2831d..0f4ff5d270 100644 --- a/tests/incremental-lane.test.ts +++ b/tests/incremental-lane.test.ts @@ -329,18 +329,18 @@ test("incremental lane: legacy-only storage answers 503 with the enablement hint test("incremental marker divert: probe reports the rollout state", async () => { const h = await harness("full"); try { - const off = await h.probe(); - assert.equal(off.status, 200); - const offBody = off.body as { ok: boolean; enabled: boolean; feature: string; protocol: number }; - assert.equal(offBody.ok, true); - assert.equal(offBody.feature, "pluginIncrementalTurns"); - assert.equal(offBody.protocol, 1); - assert.equal(offBody.enabled, false, "default rollout percent is 0 — probe must report disabled"); - process.env.BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS = "1"; + const on = await h.probe(); + assert.equal(on.status, 200); + const onBody = on.body as { ok: boolean; enabled: boolean; feature: string; protocol: number }; + assert.equal(onBody.ok, true); + assert.equal(onBody.feature, "pluginIncrementalTurns"); + assert.equal(onBody.protocol, 1); + assert.equal(onBody.enabled, true, "GA default is 100% — the probe reports the lane enabled with no operator action"); + process.env.BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS = "0"; try { - const on = await h.probe(); - assert.equal(on.status, 200); - assert.equal((on.body as { enabled: boolean }).enabled, true, "env force flips the probe"); + const off = await h.probe(); + assert.equal(off.status, 200); + assert.equal((off.body as { enabled: boolean }).enabled, false, "the env escape hatch still turns the lane off"); } finally { delete process.env.BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS; } @@ -402,6 +402,9 @@ test("incremental marker divert: marker on a non-incremental body rides the norm }); test("incremental marker divert: rollout off answers 503 on shaped turns only", async () => { + // GA is ON by default (src/rollout.ts), so the OFF path is driven through + // the env escape hatch instead of relying on the baked-in plan. + process.env.BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS = "0"; const h = await harness("full"); try { const shaped = await h.markerTurn("/v1/messages", { conversationId: "conv-marker-off", sinceSeq: 0, request: { max_tokens: 512 }, messages: [userTurn(1)] }); @@ -411,6 +414,7 @@ test("incremental marker divert: rollout off answers 503 on shaped turns only", const plain = await h.markerRaw("/v1/messages", { model: "claude-test", max_tokens: 512, messages: [{ role: "user", content: "plain while off" }] }); assert.equal(plain.status, 200); } finally { + delete process.env.BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS; await h.close(); } }); diff --git a/tests/rollout.test.ts b/tests/rollout.test.ts index b96c96d187..adeac9b349 100644 --- a/tests/rollout.test.ts +++ b/tests/rollout.test.ts @@ -379,6 +379,25 @@ test("derivedInstallId: discriminates hosts/users — no cross-machine collision assert.equal(a, rollout.derivedInstallId("C:\\Users\\dog", "DESKTOP-ABC", "dog"), "deterministic across restarts"); }); +test("pluginIncrementalTurns ships GA: the baked-in plan is 100% and both escape hatches still work", () => { + // #3248/#5156: the incremental lane is GA. A fresh install must answer + // "enabled" from the baked-in plan alone — no env var, no config file. + const id = randomUUID(); + const shipped = rollout.ROLLOUT_FEATURES.pluginIncrementalTurns?.percent; + assert.equal(shipped, 100, "the version plan ships the lane at 100% (GA), not behind a canary"); + const on = rollout.resolveRollout("pluginIncrementalTurns", { id, env: {}, file: {} }); + assert.equal(on.enabled, true, "a fresh install enables the lane with no operator action"); + assert.equal(on.source, "bucket", "GA still resolves through the bucketing tier (percent 100 = every bucket)"); + // Escape hatch 1: the config boolean forces it off for an install. + const cfg = rollout.resolveRollout("pluginIncrementalTurns", { id, env: {}, file: { features: { pluginIncrementalTurns: { enabled: false } } } }); + assert.equal(cfg.enabled, false, "config enabled:false still turns the lane off"); + assert.equal(cfg.source, "config"); + // Escape hatch 2: the env tier wins over everything. + const env = rollout.resolveRollout("pluginIncrementalTurns", { id, env: { BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS: "0" }, file: {} }); + assert.equal(env.enabled, false, "BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0 still turns the lane off"); + assert.equal(env.source, "env"); +}); + test("cleanup hooks", () => { // Restore env for other suites sharing this process (defensive). if (previousConfigFile === undefined) delete process.env.BILI_CONFIG_FILE; From 3cf026c750eb1a2cb03f707f9a56c507c042f8b0 Mon Sep 17 00:00:00 2001 From: ci-check Date: Mon, 2 Nov 2026 02:20:47 +0800 Subject: [PATCH 2/3] fix: align rollout docs with the incremental-lane GA default (#3248) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review spot-fix on top of c0ba8c84a — docs only, zero code: - PLUGIN.md (en+zh): the incremental-turns gating sentence still said "default 0 percent / force on"; now states the GA default (100 percent) with the opt-out hatches (file false/percent, BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0) and the legacy-only-sidecar carve-out. - CHANGELOG.md: the GA entry named the env escape hatch as the literal placeholder BILI_ROLLOUT_=0; replaced with the real var name. - CONFIGURATION.md + CONFIGURATION.zh-CN.md: added the missing rollout.features.pluginIncrementalTurns rows (config table + env table, en+zh) so the canonical reference documents the key whose default flipped. --- CHANGELOG.md | 2 +- CONFIGURATION.md | 2 ++ CONFIGURATION.zh-CN.md | 2 ++ PLUGIN.md | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b24852ab9d..202c858a71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ Versions follow the merge of a `*_release-v*` branch; CI publishes to npm on tag - **行为变更(旧→关→开)**:增量车道(宿主只发对话增量、不再每轮全量重发历史,#3248/#5155/#5156)此前 `rollout.features.pluginIncrementalTurns` 打包值为 `percent: 0`——**每个安装都要运营者手动开**。四个当年阻塞它的缺陷已全部关闭并修复:#3343(marker divert 缺回环校验,安全)、#3433(dsh-native 未接入 `wireMessagesLookAnthropic`,OpenAI 车道会丢 `tool_calls`)、#3352(opencode 原生零收益)、#3369(一次瞬时失败永久降级)。现在打包值改为 **`percent: 100`**:新装用户无需任何配置文件、环境变量或面板操作,装上即走增量车道。 - **为什么默认翻转是安全的**:快车道只在**全部**验证命中时接手——请求体形状(`incrementalTurnBodyShape`)、宿主 GET 探针、统一存储 sidecar、回执。任何一项不满足就整轮回落到原有的全量重发路径,字节与从前完全一致。所以这个默认值只改变**宿主发出多少字节**(#5156 的收益),不改变任何正确性保证。安全面同理:形状化请求在进入 `applyTurn` 之前先过 `adminGateDenial` 回环校验(#3343),非回环/隧道/不可信来源一律 403,默认开启不扩大攻击面。 -- **单一开关 + 两个逃生口**:文件 `rollout.features.pluginIncrementalTurns: false`(或任意 percent 灰度)、环境变量 `BILI_ROLLOUT_=0`。两者语义与顺序不变:env > config > 打包 percent > 关闭(fail closed)。 +- **单一开关 + 两个逃生口**:文件 `rollout.features.pluginIncrementalTurns: false`(或任意 percent 灰度)、环境变量 `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0`。两者语义与顺序不变:env > config > 打包 percent > 关闭(fail closed)。 - **升级提示**:已在跑增量车道的安装字节不变(它们本来就开着);从默认关升上来的安装,第一个回合起即走增量路径,无需重启以外的任何操作。需要保回旧行为的用户设上面任一逃生口即可。 - 测试:`tests/incremental-lane.test.ts` 的探针用例按新契约翻转(默认报 enabled,env `0` 才关);503 用例改由 env 逃生口驱动;新增 `tests/rollout.test.ts` 内的 GA 打包值 + 双逃生口断言,以及 `tests/incremental-lane-default-on.test.ts`(干净 XDG 根、无配置文件、真实 `featureEnabled`/`incrementalTurnsEnabled`/`GET /__bili/plugin/turn` 三段驱动;反向对照证明默认回退到 0 时 1/2/5 三条必须变红)。 diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 402c0cea19..c00efb37a9 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -102,6 +102,7 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed | `rollout.features.salt` | string | the feature name | — | Hash salt for bucketing. Changing it re-randomizes the whole cohort (the only way to reshuffle; raising percent alone never reshuffles). | | `rollout.features.base` | string | unset (roll out over everyone) | — | Nested rollout: evaluate this feature only inside the named feature's enabled cohort, so the percent is relative to that population (roll B out to A's users; chains allowed, cycles fail closed). | | `rollout.features.pluginLaneServerHistory` | boolean \| number | 0 (off) | BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY | Plugin-lane server-owned history (#4491): for enabled installs, (a) plugin-lane requests may carry an internal `biliMsgIds` array parallel to `messages` that pins message identity to client-supplied ids (always stripped before upstream forwarding; malformed arrays are ignored with a warning, id-poisoning shapes hard-fail on the incremental lane); (b) the loopback-only `POST /__bili/plugin/render` endpoint serves the outbound prefix rendered from the unified transcript (folded regions collapse to summary anchors; any desync degrades to a non-2xx so the shim falls back to its local history); (c) the incremental-lane probe advertises `serverHistory`. Default 0% — no behavior change until rolled out. | +| `rollout.features.pluginIncrementalTurns` | boolean \| number | 100 (GA) | BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS | Incremental turn lane (#3248/#5155/#5156): native plugin hosts send only the conversation delta each turn instead of re-sending full history; bili rebuilds the outbound body from the unified transcript and folds once. GA default 100%; any verification miss (body shape, GET probe, unified sidecar, ack) falls the whole turn back onto the byte-identical full-resend path, and legacy-only storage keeps the lane off regardless. Opt out with false (or a percent) or BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0. | | `maskHosts` | boolean | true | BILI_LOG_MASK_HOSTS | Mask non-public target hosts in logs as ; credential headers are always masked regardless. | | `security.adminRelay` | boolean | false | — | Let an embedding host (dsh web today) relay the ENTIRE /__bili/ admin surface through its own entry origin so a remote browser can open the panel (#3373). Fail-closed, file-only. The relayed hop reaches the proxy as a local non-browser client (loopback source + loopback Host, no Origin), so the admin gate stays unchanged; enabling it exposes config editing and credential writes to whoever can reach the host web entry — protect that entry (auth / reverse proxy) first. | | `subagentSplit` | boolean | true | BILI_SUBAGENT_SPLIT | Claude Code subagents get their own session namespace (\|sub:) instead of queueing behind the main session. | @@ -1912,6 +1913,7 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes | `BILI_RESIGN_PASSTHROUGH` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | | `BILI_RESUME_INHERITANCE` | `resumeInheritance` | true | | `BILI_ROLLOUT_` | `rollout.features.enabled` | unset (bucket math decides) | +| `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS` | `rollout.features.pluginIncrementalTurns` | 100 (GA) | | `BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY` | `rollout.features.pluginLaneServerHistory` | 0 (off) | | `BILI_SESSION_CONTENT_STORE_PIN` | `sessions.contentStorePin` | false | | `BILI_SESSION_GC` | `sessions.gc.enabled` | false | diff --git a/CONFIGURATION.zh-CN.md b/CONFIGURATION.zh-CN.md index bd72671bec..542336434c 100644 --- a/CONFIGURATION.zh-CN.md +++ b/CONFIGURATION.zh-CN.md @@ -102,6 +102,7 @@ | `rollout.features.salt` | string | the feature name | — | 分桶哈希盐。修改它会重新随机整个分组(唯一的洗牌方式;仅上调 percent 永不洗牌)。 | | `rollout.features.base` | string | unset (roll out over everyone) | — | 嵌套灰度:仅在所指特性的已入组人群内评估本特性,percent 相对该人群(B 只放量给 A 的用户;允许链式,环路判为关)。 | | `rollout.features.pluginLaneServerHistory` | boolean \| number | 0(关) | BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY | 插件车道服务端正史(#4491):对已放量的安装,(a) 插件车道请求可携带与 `messages` 平行的内部字段 `biliMsgIds`,把消息身份钉在客户端提供的 id 上(转发上游前一律剥掉;格式错误的数组告警后忽略,身份投毒形态在增量车道直接硬失败);(b) 仅回环可达的 `POST /__bili/plugin/render` 端点从统一存储渲染出站前缀(折叠区收敛为摘要锚点;任何失步都返回非 2xx,shim 退回本地历史);(c) 增量车道探测响应通告 `serverHistory`。默认 0%,放量前无行为变化。 | +| `rollout.features.pluginIncrementalTurns` | boolean \| number | 100(GA) | BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS | 增量轮次车道(#3248/#5155/#5156):原生插件宿主每轮只发对话增量、不再全量重发历史;bili 从统一转录重建出站体并只折叠一次。GA 默认 100%;任何一项验证不满足(请求体形状、GET 探针、统一存储 sidecar、回执)整轮回落到字节一致的全量重发路径,legacy-only 存储则始终不走本车道。关闭设 false(或任意 percent)或 BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0。 | | `maskHosts` | boolean | true | BILI_LOG_MASK_HOSTS | 日志中把非公开目标主机遮成 ;凭据头无论此开关如何总是遮盖。 | | `security.adminRelay` | boolean | false | — | 允许宿主(当前为 dsh web)把它自己入口域名下的整个 /__bili/ 管理面中继到本机代理,使远程浏览器能打开面板(#3373)。默认关闭、仅配置文件。中继跳到达代理时是本机非浏览器客户端(回环源地址 + 回环 Host、无 Origin 头),管理端门槛不变;开启后,凡能访问宿主 web 入口的人都能改配置、写凭据——请先给入口加鉴权/反代。 | | `subagentSplit` | boolean | true | BILI_SUBAGENT_SPLIT | Claude 子代理拥有独立会话命名空间(\|sub:),不再排队在主会话锁后。 | @@ -1895,6 +1896,7 @@ ACP 原生 agent(当前为 `pi` 扩展)会在每个进程内向代理上报 | `BILI_RESIGN_PASSTHROUGH` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | | `BILI_RESUME_INHERITANCE` | `resumeInheritance` | true | | `BILI_ROLLOUT_` | `rollout.features.enabled` | unset (bucket math decides) | +| `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS` | `rollout.features.pluginIncrementalTurns` | 100 (GA) | | `BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY` | `rollout.features.pluginLaneServerHistory` | 0 (off) | | `BILI_SESSION_CONTENT_STORE_PIN` | `sessions.contentStorePin` | false | | `BILI_SESSION_GC` | `sessions.gc.enabled` | false | diff --git a/PLUGIN.md b/PLUGIN.md index 1985e674c1..82bd69b56c 100644 --- a/PLUGIN.md +++ b/PLUGIN.md @@ -207,9 +207,9 @@ Lineage-only declaration (#2408): a host that cannot drive the full fork protoco Incremental turns (#3248; not yet advertised in the plugin manifest — detect by trying the endpoint and handling the 503): a host that keeps its own full local history may stop resending it. `POST /__bili/plugin/turn` (same `/__bili/` gate; headers `x-bili-plugin` + optional `x-bili-plugin-model`, `x-bili-plugin-context-window`, `x-bili-plugin-max-output`) with `{ conversationId, sinceSeq, resync?, system?, path?, request, messages }`. The first turn (or any recovery) sends `sinceSeq: 0` + the full `messages[]` (`resync: true` is implied on seed — a wholesale replacement never 409s and works whether the canonical is empty or already live); every later turn sends ONLY what the client added since the last ack — including the previous assistant reply (client-owned). `request` carries anthropic params (model, max_tokens, temperature, top_p, top_k, stop_sequences, stream, tools, tool_choice, metadata, thinking, service_tier, parallel_tool_calls); `system` is sticky (omit to keep the last one); `path` defaults to `/v1/messages` (bare relative rides the lane's default upstream; the `/bili//…` form is explicit). The response is the upstream body streamed through, with `x-bili-applied-seq` = the canonical length after applying the delta — echo that value as the next turn's `sinceSeq`. `409 { error: "seq-mismatch" | "turn-in-flight", serverSeq }` means the client MUST recover with a resync turn (`sinceSeq: serverSeq` if it still has the history, else `resync: true` full seed). `503` means the lane runs without `storage.unified` (the canonical log lives in the unified messages table). The lane owns no session identity of its own: the assembled request carries the client's own `x-bili-plugin-conversation`, so incremental and normal full-resend traffic for one conversation share one session, one fold ledger and one canonical — switching modes needs no ceremony, and a conversation may interleave them (e.g. fall back to full resend while a resync is pending). Folding, nudges, tools and the plugin tool endpoints all work unchanged on the assembled body; the model never sees the difference. v1 caveats: the canonical log is the session's messages table — a turn is acked after the assembled body is persisted (best-effort immediate flush; a crash in between surfaces as 409 → resync), and the pipeline still walks the assembled prefix (O(full) CPU, cheap and zero-hit — the server-authored fast path is tracked on #3248). A `resync: true` that replaces a diverged canonical records a base-seq epoch (`session_ext` key `inc:base-seq`): the stale branch's rows stay in the append-only log for audit, but cold rebuilds slice past them — one resync heals, restarts included. On legacy-only storage (no ext surface) the marker degrades and cold rebuilds serve the full row union (409 → resync once, as before). -Marker divert (#3248 phase 2 — native extensions): instead of switching the provider URL to the turn endpoint, a host may send the incremental body on its ORDINARY model request. Stamp `x-bili-plugin-turn: 1` on the request (the lane requires `x-bili-plugin` too, as for every plugin signal); the body shape — top-level `conversationId` + `sinceSeq` + `messages`, no top-level `model` — is the final word: a marker'd body that is NOT incremental-shaped rides the normal pipeline byte-identically, so a host may stamp the marker whenever the feature is enabled and only convert turns it wants. Incremental-SHAPED turns are lane traffic and carry the same trust class as the direct turn endpoint (#3343): non-loopback / tunnel / untrusted-origin callers get 403 on them (their capability probe already 403s, so a well-behaved host never sends deltas from afar), and management prefixes (`/__bili/`, `/__acp/`) never ride the divert. The lane forwards the assembled request to the ORIGINAL request path (bare or `/bili/…` — no provider reconfiguration). Capability probe: `GET /__bili/plugin/turn` → `{ ok, protocol: 1, feature: "pluginIncrementalTurns", enabled, storage }` (loopback-gated like every `/__bili/` surface; a 404 = older server, stay full-resend). Gating: rollout feature `pluginIncrementalTurns` (default 0% = every install byte-identical to before) — enable with `rollout.features.pluginIncrementalTurns: true` (or a percent) in the bili config, or `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=1`; the feature additionally requires a live unified sidecar (shadow or full). When disabled mid-flight the lane answers 503 on incremental-shaped turns — fall back to a plain full-resend request. Reference host wiring: pi rides its `before_provider_headers` (marker) + `before_provider_request` (payload replacement) + `after_provider_response` (ack) extension events; dsh-native rides the fetch patch's `beforeSend` (body conversion) + `headersFor` (marker) + `onResponse` (ack). pi-native inherits the pi wiring unchanged (same extension factory — only proxy discovery differs). opencode rides its `http.request` hook (an `incremental` adapter callback appended after routing/stamping swaps the request body via `replaceRequestPayload` and stamps the marker on the replaced request; acks land on the fetch intercept's `onResponse`). omp has no header events at all — its native adapter reads the extension-stamped `prompt_cache_key` body field as the conversation id inside `beforeSend`, stamps the plugin headers directly on the request init (identity upgrades, never forks: wire mode already resolves the same value via `preferPromptCacheKeyIdentity`), and acks on `onResponse`. Non-Anthropic wire shapes (OpenAI `tool_calls`/`role:"tool"`) are detected by `wireMessagesLookAnthropic` and left on full resend — the lane's message ingestion is the anthropic wire. Planned turns are single-in-flight per URL and age out after 30s (a network-dead request must not block the URL forever). The shared client state machine lives in `src/agent/incremental-client.ts` (probe TTL cache, prefix-hash diffing, sticky system, per-conversation dead flag) — new native hosts should reuse it rather than re-implement the diffing. +Marker divert (#3248 phase 2 — native extensions): instead of switching the provider URL to the turn endpoint, a host may send the incremental body on its ORDINARY model request. Stamp `x-bili-plugin-turn: 1` on the request (the lane requires `x-bili-plugin` too, as for every plugin signal); the body shape — top-level `conversationId` + `sinceSeq` + `messages`, no top-level `model` — is the final word: a marker'd body that is NOT incremental-shaped rides the normal pipeline byte-identically, so a host may stamp the marker whenever the feature is enabled and only convert turns it wants. Incremental-SHAPED turns are lane traffic and carry the same trust class as the direct turn endpoint (#3343): non-loopback / tunnel / untrusted-origin callers get 403 on them (their capability probe already 403s, so a well-behaved host never sends deltas from afar), and management prefixes (`/__bili/`, `/__acp/`) never ride the divert. The lane forwards the assembled request to the ORIGINAL request path (bare or `/bili/…` — no provider reconfiguration). Capability probe: `GET /__bili/plugin/turn` → `{ ok, protocol: 1, feature: "pluginIncrementalTurns", enabled, storage }` (loopback-gated like every `/__bili/` surface; a 404 = older server, stay full-resend). Gating: rollout feature `pluginIncrementalTurns` (GA: default 100% — opt out with `rollout.features.pluginIncrementalTurns: false` (or a percent) in the bili config, or `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0`); the feature additionally requires a live unified sidecar (shadow or full), so legacy-only storage stays on the full-resend path regardless. When disabled mid-flight the lane answers 503 on incremental-shaped turns — fall back to a plain full-resend request. Reference host wiring: pi rides its `before_provider_headers` (marker) + `before_provider_request` (payload replacement) + `after_provider_response` (ack) extension events; dsh-native rides the fetch patch's `beforeSend` (body conversion) + `headersFor` (marker) + `onResponse` (ack). pi-native inherits the pi wiring unchanged (same extension factory — only proxy discovery differs). opencode rides its `http.request` hook (an `incremental` adapter callback appended after routing/stamping swaps the request body via `replaceRequestPayload` and stamps the marker on the replaced request; acks land on the fetch intercept's `onResponse`). omp has no header events at all — its native adapter reads the extension-stamped `prompt_cache_key` body field as the conversation id inside `beforeSend`, stamps the plugin headers directly on the request init (identity upgrades, never forks: wire mode already resolves the same value via `preferPromptCacheKeyIdentity`), and acks on `onResponse`. Non-Anthropic wire shapes (OpenAI `tool_calls`/`role:"tool"`) are detected by `wireMessagesLookAnthropic` and left on full resend — the lane's message ingestion is the anthropic wire. Planned turns are single-in-flight per URL and age out after 30s (a network-dead request must not block the URL forever). The shared client state machine lives in `src/agent/incremental-client.ts` (probe TTL cache, prefix-hash diffing, sticky system, per-conversation dead flag) — new native hosts should reuse it rather than re-implement the diffing. -中文增量要点(#3248):`POST /__bili/plugin/turn`,首次/恢复用 `sinceSeq:0` 全量(种子隐含 `resync:true`,永不 409);此后每轮只发新增(含上一轮 assistant 回复,客户端自持)。响应即上游原文,`x-bili-applied-seq` 为应用后的长度,下一轮作 `sinceSeq` 回传。409 必须按 serverSeq 对齐或全量重同步;503 表示未开 storage.unified。会话身份沿用客户端自己的 conversation id——增量与全量重发同一会话可任意切换,折叠/工具/状态栏不变。阶段 2(标记分流):普通模型请求上盖 `x-bili-plugin-turn: 1` 头 + 增量形状 body(顶层 conversationId/sinceSeq/messages、无顶层 model)即可,增量形状 turn 属 lane 流量,与直连 turn 端点同信任级(#3343):非回环/隧道/不可信源一律 403(其探针本就 403,正常宿主不会远程发增量);管理前缀(`/__bili/`、`/__acp/`)永不走分流。lane 按原始 URL 转发;探针 `GET /__bili/plugin/turn`;开关 rollout `pluginIncrementalTurns`(默认 0%=零变化,`BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=1` 或配置强制开)。客户端状态机在 src/agent/incremental-client.ts,新宿主复用勿重写。已接宿主:pi/pi-native(同一扩展工厂,后者零代码继承)、dsh-native(fetch 补丁 beforeSend/headersFor/onResponse)、opencode(http.request 钩子 incremental 适配回调换 body+盖章)、omp(无头事件通道,读 body 里 prompt_cache_key 当会话 id,直接在 init 上盖章);OpenAI 工具形状(tool_calls/role:tool)自动回退全量重发;每 URL 单飞行+30s 过期。 +中文增量要点(#3248):`POST /__bili/plugin/turn`,首次/恢复用 `sinceSeq:0` 全量(种子隐含 `resync:true`,永不 409);此后每轮只发新增(含上一轮 assistant 回复,客户端自持)。响应即上游原文,`x-bili-applied-seq` 为应用后的长度,下一轮作 `sinceSeq` 回传。409 必须按 serverSeq 对齐或全量重同步;503 表示未开 storage.unified。会话身份沿用客户端自己的 conversation id——增量与全量重发同一会话可任意切换,折叠/工具/状态栏不变。阶段 2(标记分流):普通模型请求上盖 `x-bili-plugin-turn: 1` 头 + 增量形状 body(顶层 conversationId/sinceSeq/messages、无顶层 model)即可,增量形状 turn 属 lane 流量,与直连 turn 端点同信任级(#3343):非回环/隧道/不可信源一律 403(其探针本就 403,正常宿主不会远程发增量);管理前缀(`/__bili/`、`/__acp/`)永不走分流。lane 按原始 URL 转发;探针 `GET /__bili/plugin/turn`;开关 rollout `pluginIncrementalTurns`(已 GA:默认 100%,`rollout.features.pluginIncrementalTurns: false` 或 `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0` 可关;另需统一存储 sidecar 在线,legacy-only 存储不受影响)。客户端状态机在 src/agent/incremental-client.ts,新宿主复用勿重写。已接宿主:pi/pi-native(同一扩展工厂,后者零代码继承)、dsh-native(fetch 补丁 beforeSend/headersFor/onResponse)、opencode(http.request 钩子 incremental 适配回调换 body+盖章)、omp(无头事件通道,读 body 里 prompt_cache_key 当会话 id,直接在 init 上盖章);OpenAI 工具形状(tool_calls/role:tool)自动回退全量重发;每 URL 单飞行+30s 过期。 中文集成要点:fork 协议现为 2(服务端同时接受 1);先读取 manifest 能力及 snapshot,按原文、role、工具身份确认匹配前缀,仅提交该前缀的 orderedMessages,不猜测多模态分支点。被 `compress.protectedTools` 硬排除的消息在两个数组中均为 `"ref": null`(参与顺序与身份、无地址 ref),与其他前缀条目一样逐字提交;ref 合法值仅 `mNNNNN` 字符串或 `null`。父 revision 变化必须重新取快照并重新匹配。子会话使用独立稳定 id,首次请求可追加尚未出站的模型回复,不能重置继承的 refs/blocks。手动摘要使用 snapshot 的 refs 和 `expectedRevision: snapshot.parentRevision` 调用公开 tool;摘要期间历史发生变化时返回 409,不执行旧摘要。状态栏读取 `contextTokens`、`contextTokensSource`、`contextTokensAt`、`model`、`contextLimit`、`contextGeneration`、`sessionId` 与 `sessionRevision`,不得用累计账单 input/cache 冒充有效上下文。手动 compress/decompress 后为独立时间及 generation 的 estimate,不改累计账单或 last-usage 基线;下一次正数 usage 才恢复 usage,零值或缺失 usage 不得复活旧观测。未知来源返回 unavailable,tokens/time/generation 为 null。 From f8c0a88cc2a47435bfb264308041d4ead2fadcdb Mon Sep 17 00:00:00 2001 From: ci-check Date: Mon, 2 Nov 2026 02:39:56 +0800 Subject: [PATCH 3/3] fix: route pluginIncrementalTurns doc rows through the config seed (#3248) Follow-up to 3cf026c: CONFIGURATION.md / CONFIGURATION.zh-CN.md carry generated blocks () that CI rewrites from website/config-reference/*.yaml via tools/gen-config-docs.mjs and diff-checks, so hand-edited rows inside those blocks fail the gate. - add rollout.features.pluginIncrementalTurns to website/config-reference/rollout.yaml (group behavior; env BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS; default "100 (on)") - regenerate the marked blocks with the repo's own generator at this head (node tools/gen-config-docs.mjs generate); site dict/html are untouched because the entry carries no id/site_group --- CONFIGURATION.md | 4 ++-- CONFIGURATION.zh-CN.md | 4 ++-- website/config-reference/rollout.yaml | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index c00efb37a9..f29b1ecc30 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -102,7 +102,7 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed | `rollout.features.salt` | string | the feature name | — | Hash salt for bucketing. Changing it re-randomizes the whole cohort (the only way to reshuffle; raising percent alone never reshuffles). | | `rollout.features.base` | string | unset (roll out over everyone) | — | Nested rollout: evaluate this feature only inside the named feature's enabled cohort, so the percent is relative to that population (roll B out to A's users; chains allowed, cycles fail closed). | | `rollout.features.pluginLaneServerHistory` | boolean \| number | 0 (off) | BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY | Plugin-lane server-owned history (#4491): for enabled installs, (a) plugin-lane requests may carry an internal `biliMsgIds` array parallel to `messages` that pins message identity to client-supplied ids (always stripped before upstream forwarding; malformed arrays are ignored with a warning, id-poisoning shapes hard-fail on the incremental lane); (b) the loopback-only `POST /__bili/plugin/render` endpoint serves the outbound prefix rendered from the unified transcript (folded regions collapse to summary anchors; any desync degrades to a non-2xx so the shim falls back to its local history); (c) the incremental-lane probe advertises `serverHistory`. Default 0% — no behavior change until rolled out. | -| `rollout.features.pluginIncrementalTurns` | boolean \| number | 100 (GA) | BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS | Incremental turn lane (#3248/#5155/#5156): native plugin hosts send only the conversation delta each turn instead of re-sending full history; bili rebuilds the outbound body from the unified transcript and folds once. GA default 100%; any verification miss (body shape, GET probe, unified sidecar, ack) falls the whole turn back onto the byte-identical full-resend path, and legacy-only storage keeps the lane off regardless. Opt out with false (or a percent) or BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0. | +| `rollout.features.pluginIncrementalTurns` | boolean \| number | 100 (on) | BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS | Incremental turn lane (#3248): for enabled installs, native plugin hosts send only the conversation delta each turn (with the host-msgid envelope) instead of re-sending the whole history; bili rebuilds the outbound request from the unified transcript through the normal fold/render pipeline. GA since this version — fresh installs are delta-by-default. Installs without the unified-storage sidecar stay on full-resend automatically (probe reports storage=legacy-only). Opt out with false / a percent override, or BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0. | | `maskHosts` | boolean | true | BILI_LOG_MASK_HOSTS | Mask non-public target hosts in logs as ; credential headers are always masked regardless. | | `security.adminRelay` | boolean | false | — | Let an embedding host (dsh web today) relay the ENTIRE /__bili/ admin surface through its own entry origin so a remote browser can open the panel (#3373). Fail-closed, file-only. The relayed hop reaches the proxy as a local non-browser client (loopback source + loopback Host, no Origin), so the admin gate stays unchanged; enabling it exposes config editing and credential writes to whoever can reach the host web entry — protect that entry (auth / reverse proxy) first. | | `subagentSplit` | boolean | true | BILI_SUBAGENT_SPLIT | Claude Code subagents get their own session namespace (\|sub:) instead of queueing behind the main session. | @@ -1913,7 +1913,7 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes | `BILI_RESIGN_PASSTHROUGH` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | | `BILI_RESUME_INHERITANCE` | `resumeInheritance` | true | | `BILI_ROLLOUT_` | `rollout.features.enabled` | unset (bucket math decides) | -| `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS` | `rollout.features.pluginIncrementalTurns` | 100 (GA) | +| `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS` | `rollout.features.pluginIncrementalTurns` | 100 (on) | | `BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY` | `rollout.features.pluginLaneServerHistory` | 0 (off) | | `BILI_SESSION_CONTENT_STORE_PIN` | `sessions.contentStorePin` | false | | `BILI_SESSION_GC` | `sessions.gc.enabled` | false | diff --git a/CONFIGURATION.zh-CN.md b/CONFIGURATION.zh-CN.md index 542336434c..62a241840b 100644 --- a/CONFIGURATION.zh-CN.md +++ b/CONFIGURATION.zh-CN.md @@ -102,7 +102,7 @@ | `rollout.features.salt` | string | the feature name | — | 分桶哈希盐。修改它会重新随机整个分组(唯一的洗牌方式;仅上调 percent 永不洗牌)。 | | `rollout.features.base` | string | unset (roll out over everyone) | — | 嵌套灰度:仅在所指特性的已入组人群内评估本特性,percent 相对该人群(B 只放量给 A 的用户;允许链式,环路判为关)。 | | `rollout.features.pluginLaneServerHistory` | boolean \| number | 0(关) | BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY | 插件车道服务端正史(#4491):对已放量的安装,(a) 插件车道请求可携带与 `messages` 平行的内部字段 `biliMsgIds`,把消息身份钉在客户端提供的 id 上(转发上游前一律剥掉;格式错误的数组告警后忽略,身份投毒形态在增量车道直接硬失败);(b) 仅回环可达的 `POST /__bili/plugin/render` 端点从统一存储渲染出站前缀(折叠区收敛为摘要锚点;任何失步都返回非 2xx,shim 退回本地历史);(c) 增量车道探测响应通告 `serverHistory`。默认 0%,放量前无行为变化。 | -| `rollout.features.pluginIncrementalTurns` | boolean \| number | 100(GA) | BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS | 增量轮次车道(#3248/#5155/#5156):原生插件宿主每轮只发对话增量、不再全量重发历史;bili 从统一转录重建出站体并只折叠一次。GA 默认 100%;任何一项验证不满足(请求体形状、GET 探针、统一存储 sidecar、回执)整轮回落到字节一致的全量重发路径,legacy-only 存储则始终不走本车道。关闭设 false(或任意 percent)或 BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0。 | +| `rollout.features.pluginIncrementalTurns` | boolean \| number | 100(开) | BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS | 增量回合车道(#3248):对已放量的安装,原生插件宿主每回合只发对话增量(带宿主 msgid 信封),不再整段重发历史;bili 从统一 transcript 重建出站请求并走正常折叠/渲染管道。本版本起 GA——全新安装开箱即增量。没有统一存储 sidecar 的安装自动保持全量重发(探测响应 storage=legacy-only)。用 false / percent 覆盖或 BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0 可关。 | | `maskHosts` | boolean | true | BILI_LOG_MASK_HOSTS | 日志中把非公开目标主机遮成 ;凭据头无论此开关如何总是遮盖。 | | `security.adminRelay` | boolean | false | — | 允许宿主(当前为 dsh web)把它自己入口域名下的整个 /__bili/ 管理面中继到本机代理,使远程浏览器能打开面板(#3373)。默认关闭、仅配置文件。中继跳到达代理时是本机非浏览器客户端(回环源地址 + 回环 Host、无 Origin 头),管理端门槛不变;开启后,凡能访问宿主 web 入口的人都能改配置、写凭据——请先给入口加鉴权/反代。 | | `subagentSplit` | boolean | true | BILI_SUBAGENT_SPLIT | Claude 子代理拥有独立会话命名空间(\|sub:),不再排队在主会话锁后。 | @@ -1896,7 +1896,7 @@ ACP 原生 agent(当前为 `pi` 扩展)会在每个进程内向代理上报 | `BILI_RESIGN_PASSTHROUGH` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | | `BILI_RESUME_INHERITANCE` | `resumeInheritance` | true | | `BILI_ROLLOUT_` | `rollout.features.enabled` | unset (bucket math decides) | -| `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS` | `rollout.features.pluginIncrementalTurns` | 100 (GA) | +| `BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS` | `rollout.features.pluginIncrementalTurns` | 100 (on) | | `BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY` | `rollout.features.pluginLaneServerHistory` | 0 (off) | | `BILI_SESSION_CONTENT_STORE_PIN` | `sessions.contentStorePin` | false | | `BILI_SESSION_GC` | `sessions.gc.enabled` | false | diff --git a/website/config-reference/rollout.yaml b/website/config-reference/rollout.yaml index 4db7387164..f3b64d3937 100644 --- a/website/config-reference/rollout.yaml +++ b/website/config-reference/rollout.yaml @@ -57,3 +57,11 @@ entries: group: behavior desc_en: "Plugin-lane server-owned history (#4491): for enabled installs, (a) plugin-lane requests may carry an internal `biliMsgIds` array parallel to `messages` that pins message identity to client-supplied ids (always stripped before upstream forwarding; malformed arrays are ignored with a warning, id-poisoning shapes hard-fail on the incremental lane); (b) the loopback-only `POST /__bili/plugin/render` endpoint serves the outbound prefix rendered from the unified transcript (folded regions collapse to summary anchors; any desync degrades to a non-2xx so the shim falls back to its local history); (c) the incremental-lane probe advertises `serverHistory`. Default 0% — no behavior change until rolled out." desc_zh: "插件车道服务端正史(#4491):对已放量的安装,(a) 插件车道请求可携带与 `messages` 平行的内部字段 `biliMsgIds`,把消息身份钉在客户端提供的 id 上(转发上游前一律剥掉;格式错误的数组告警后忽略,身份投毒形态在增量车道直接硬失败);(b) 仅回环可达的 `POST /__bili/plugin/render` 端点从统一存储渲染出站前缀(折叠区收敛为摘要锚点;任何失步都返回非 2xx,shim 退回本地历史);(c) 增量车道探测响应通告 `serverHistory`。默认 0%,放量前无行为变化。" + - key: rollout.features.pluginIncrementalTurns + type: "boolean | number" + default: "100 (on)" + default_zh: "100(开)" + env: BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS + group: behavior + desc_en: "Incremental turn lane (#3248): for enabled installs, native plugin hosts send only the conversation delta each turn (with the host-msgid envelope) instead of re-sending the whole history; bili rebuilds the outbound request from the unified transcript through the normal fold/render pipeline. GA since this version — fresh installs are delta-by-default. Installs without the unified-storage sidecar stay on full-resend automatically (probe reports storage=legacy-only). Opt out with false / a percent override, or BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0." + desc_zh: "增量回合车道(#3248):对已放量的安装,原生插件宿主每回合只发对话增量(带宿主 msgid 信封),不再整段重发历史;bili 从统一 transcript 重建出站请求并走正常折叠/渲染管道。本版本起 GA——全新安装开箱即增量。没有统一存储 sidecar 的安装自动保持全量重发(探测响应 storage=legacy-only)。用 false / percent 覆盖或 BILI_ROLLOUT_PLUGIN_INCREMENTAL_TURNS=0 可关。"