From d31a7b25ca613bbbf90744a7b20e4b1d63ae8e74 Mon Sep 17 00:00:00 2001 From: ci-check Date: Sat, 24 Oct 2026 17:42:53 +0800 Subject: [PATCH 1/3] fix: resolve providers.* config for path-style lane requests (#4501) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Path-style lane requests (POST /v1/messages straight at the proxy's default upstream — no /bili/ tunnel, no absolute form, non-MITM) get no route back from resolveUpstream(), so every providers.* lookup keyed on route?.rewrittenUrl silently missed: models..output/.context never applied, the #3438 mid-band collapse rescue stayed unarmed, and its "NO known output ceiling" warn could not be silenced by declaring the model's max output. Reconstruct the full destination URL (opts.upstream + path) once in handle() as providerDestUrl and use it as the single config-matching basis for the output ceiling, context limit, operator window tuning, registry host, passthrough routing, and per-provider compress settings. Also stop firing the #3438 mid-band warn when a ceiling IS known (value >= ceiling is a healthy state, not a missing-ceiling gap). Tests: unit coverage of the warn gate in side-request-isolation.test.ts plus end-to-end proof in the new issue4501-pathstyle-config.test.ts that a path-style dsh-lane request now resolves the declared output ceiling and restores a collapsed mid-band budget up to it. --- src/server/handle.ts | 21 ++- src/server/side-request.ts | 2 +- tests/issue4501-pathstyle-config.test.ts | 155 +++++++++++++++++++++++ tests/side-request-isolation.test.ts | 25 ++++ 4 files changed, 195 insertions(+), 8 deletions(-) create mode 100644 tests/issue4501-pathstyle-config.test.ts diff --git a/src/server/handle.ts b/src/server/handle.ts index 03b465a04b..4e27d22e74 100644 --- a/src/server/handle.ts +++ b/src/server/handle.ts @@ -277,6 +277,12 @@ async function handleRequest( let responsesCompact: boolean; let route: ReturnType; let upstreamOrigin: string; + /** #4501: full destination URL this request forwards to — the single basis for + * matching providers.* config keys. Path-style requests (no /bili/ tunnel, no + * absolute form, non-MITM) leave resolveUpstream undefined so route?.rewrittenUrl + * alone misses every per-provider declaration; reconstruct opts.upstream + path + * there so config resolves identically across all request forms. */ + let providerDestUrl: string; let protocol: WireProtocol | null; /** Gemini's model, resolved from the request path (its body never carries * one). Undefined for every other protocol. */ @@ -326,6 +332,7 @@ async function handleRequest( } } upstreamOrigin = route ? route.upstream : /^https?:\/\//i.test(url) ? new URL(url).origin : opts.upstream; + providerDestUrl = route ? route.rewrittenUrl : /^https?:\/\//i.test(urlPath) ? urlPath : `${opts.upstream}${urlPath}`; // #1909: user-declared wire protocol (providers[].protocol) // outranks the built-in suffix heuristics — explicit intent beats // inference. Looked up by the FULL destination URL (route.rewrittenUrl @@ -666,7 +673,7 @@ async function handleRequest( const model = requestModel; reqModelId = typeof model === "string" ? model : undefined; if (model) { - const embeddedUrl = route?.rewrittenUrl; + const embeddedUrl = providerDestUrl; // Native-window resolution order: (0) per-request TIER EVIDENCE // that this request runs on an expanded tier — (a) the client's // `anthropic-beta` larger-context negotiation (context-1m-… → @@ -822,7 +829,7 @@ async function handleRequest( // #661: route-scoped passthrough — the global flag's semantics, limited to // requests whose upstream URL matches a provider route with // `passthrough: true` (upstreams that fingerprint the request body). - const routePassthrough = !opts.passthrough && findRoute(opts.routes, route?.rewrittenUrl)?.passthrough === true; + const routePassthrough = !opts.passthrough && findRoute(opts.routes, providerDestUrl)?.passthrough === true; if (routePassthrough && hopMarker === undefined && protocol && parsed) { log("info", `[route-passthrough] ${maskUrlsInText(route?.rewrittenUrl ?? "")} matches a passthrough route — forwarding verbatim, kernel bypassed`); } @@ -1849,13 +1856,13 @@ async function handleRequest( // The plugin-stamped lane is the live path; the clientHint arm is defensive — // it matches only if some dsh build's wire identity is literally "dsh". const dshRestoreLane = pluginAgent === "dsh" || session.metadata.clientHint === "dsh"; - restoreOutputBudget(parsed, session, log, resolveKnownOutputCeiling(req.headers, parsed as Record, opts.routes, route?.rewrittenUrl, opts.sessionHeader, requestModel), dshRestoreLane); + restoreOutputBudget(parsed, session, log, resolveKnownOutputCeiling(req.headers, parsed as Record, opts.routes, providerDestUrl, opts.sessionHeader, requestModel), dshRestoreLane); } // #896: the per-scope output-headroom cap (compress.outputHeadroomMaxPct, // three-level merge; default 0.25, aligned with billion-context-pi). // Resolved once here so the side-request guard below AND the main-path // reservation measure against the SAME capped window. - const headroomCap = resolveOutputHeadroomCap(resolveCompress(opts.routes, route?.rewrittenUrl, (parsed as { model?: string }).model, opts.compress).outputHeadroomMaxPct); + const headroomCap = resolveOutputHeadroomCap(resolveCompress(opts.routes, providerDestUrl, (parsed as { model?: string }).model, opts.compress).outputHeadroomMaxPct); // #1729: dsh native compaction guard — a compaction summarize call // (replayed prefix + COMPACTION_INSTRUCTION as the final user message) // is refused BEFORE any pipeline work: not forwarded, kernel state @@ -2164,8 +2171,8 @@ async function handleRequest( const fbModel = (parsed as { model?: string }).model; if (fbModel) { let host: string | undefined; - try { host = route?.rewrittenUrl ? new URL(route.rewrittenUrl).host : undefined; } catch { host = undefined; } - const cfgOut = resolveConfiguredOutputLimit(opts.routes, route?.rewrittenUrl, fbModel); + try { host = providerDestUrl ? new URL(providerDestUrl).host : undefined; } catch { host = undefined; } + const cfgOut = resolveConfiguredOutputLimit(opts.routes, providerDestUrl, fbModel); const regOut = peekRegistryOutputLimit(fbModel, host); const budget = cfgOut !== undefined ? cfgOut : regOut; if (typeof budget === "number" && budget > 0) { @@ -2274,7 +2281,7 @@ async function handleRequest( // #1820: this prepare consumes one unit of post-rebuild anchor // validity (the last one deletes it — see session.ts). tickPostRebuildAnchor(session); - const cs = resolveCompress(opts.routes, route?.rewrittenUrl, requestModel, opts.compress); + const cs = resolveCompress(opts.routes, providerDestUrl, requestModel, opts.compress); // #2228: model-decided nudge timing — resolved through the standard // three-level compress cascade; presence of the object enables the // side-call decision path at tier-1 arms (off unless explicitly set). diff --git a/src/server/side-request.ts b/src/server/side-request.ts index c1b80004dd..451a78ad65 100644 --- a/src/server/side-request.ts +++ b/src/server/side-request.ts @@ -457,7 +457,7 @@ export function restoreOutputBudget( clearNoCeilingDegraded(session, modelName); // #3438: dsh-lane mid-band with NO known ceiling — bili cannot judge // collapse from intent here, so forward verbatim but surface the gap once. - if (dshLane === true && Array.isArray(p.tools) && p.tools.length > 0 && noteDshMidBandNoCeilingWarning(session.id, modelName)) { + if (dshLane === true && ceiling === undefined && Array.isArray(p.tools) && p.tools.length > 0 && noteDshMidBandNoCeilingWarning(session.id, modelName)) { log("warn", `[${session.id}] dsh-lane main request carries output budget ${value} with NO known output ceiling for model=${modelName} — cannot tell a raw-history collapse from deliberate intent, forwarding verbatim; declare the model's max output (providers..models."${modelName}".output) to arm the mid-band collapse rescue (#3438)`); } return; diff --git a/tests/issue4501-pathstyle-config.test.ts b/tests/issue4501-pathstyle-config.test.ts new file mode 100644 index 0000000000..db42fcf2e4 --- /dev/null +++ b/tests/issue4501-pathstyle-config.test.ts @@ -0,0 +1,155 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import http from "node:http"; +import { once } from "node:events"; +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 { _setForTest as setRegistryForTest } from "../src/registry.ts"; +import { _resetSessionsForTest, getSession } from "../src/session.ts"; + +// #4501: providers..models..output (and .context) were unreadable for +// PATH-STYLE lane requests — POST /v1/chat/completions straight at the proxy's +// default upstream, no /bili/ tunnel, no absolute form, non-MITM. handle() keyed +// every providers.* lookup on route?.rewrittenUrl, which resolveUpstream() leaves +// undefined for exactly those requests, so resolveKnownOutputCeiling fell through +// to the registry (no entry for e.g. deepseek-flash) and the ceiling stayed +// unknown: the #3438 mid-band rescue was never armed and its "NO known output +// ceiling" warn could not be silenced by config. The fix reconstructs the full +// destination URL (opts.upstream + path) as the single config-matching basis. +// These pin it end-to-end: a path-style dsh-lane request now resolves the declared +// output ceiling and restores a collapsed mid-band budget up to it. + +const MODEL = "deepseek-flash"; +const CEILING = 384_000; +const SESSION = "issue-4501-sess"; + +interface Rig { + proxyPort: number; + upstreamPort: number; + proxy: http.Server; + upstream: http.Server; + lastBody: Record | null; +} + +async function startRig(declaredOutput?: number): Promise { + const rig: Rig = { proxyPort: 0, upstreamPort: 0, proxy: null as unknown as http.Server, upstream: null as unknown as http.Server, lastBody: null }; + const upstream = http.createServer((req, res) => { + const chunks: Buffer[] = []; + req.on("data", (c: Buffer) => chunks.push(c)); + req.on("end", () => { + rig.lastBody = JSON.parse(Buffer.concat(chunks).toString("utf8")) as Record; + res.writeHead(200, { "content-type": "application/json" }); + res.end(JSON.stringify({ + id: "cmpl-4501", object: "chat.completion", created: 0, model: MODEL, + choices: [{ index: 0, message: { role: "assistant", content: "ok" }, finish_reason: "stop" }], + usage: { prompt_tokens: 100, completion_tokens: 5, total_tokens: 105 }, + })); + }); + }); + upstream.listen(0, "127.0.0.1"); + await once(upstream, "listening"); + const upstreamPort = (upstream.address() as { port: number }).port; + // The proxy's DEFAULT upstream origin — a path-style request forwards to + // opts.upstream + urlPath, and providers.* keys must match that same URL. + const origin = `http://127.0.0.1:${upstreamPort}`; + + _setStoreForTest(new SessionStore({ enabled: false })); + setRegistryForTest({}); + _resetSessionsForTest(); + const proxy = await startServer({ + port: 0, + host: "127.0.0.1", + upstream: origin, + routes: declaredOutput !== undefined + ? { [origin]: { models: { [MODEL]: { output: declaredOutput } } } } + : { [origin]: {} }, + modelContextLimit: 1_000_000, + kernelConfig: defaultConfig(1_000_000), + compress: { injectTool: true, injectNudge: true }, + promptCache: { routing: "auto" }, + sessionHeader: "x-acp-session", + log: false, + debug: false, + passthrough: false, + autoUpdate: false, + compat: { roles: {} }, + streamErrorShape: "protocol", + passthroughSource: null, + autoRestartOnUpdate: false, + updateTag: "latest", + advisoryCheck: false, + releaseNotesCheck: false, + mitm: { enabled: false, domains: [] }, + } as ProxyOptions); + await once(proxy, "listening"); + rig.proxy = proxy; rig.upstream = upstream; rig.proxyPort = (proxy.address() as { port: number }).port; rig.upstreamPort = upstreamPort; + return rig; +} + +async function closeRig(rig: Rig): Promise { + rig.proxy.close(); + rig.proxy.closeIdleConnections?.(); + await once(rig.proxy, "close"); + rig.upstream.close(); + rig.upstream.closeIdleConnections?.(); + await once(rig.upstream, "close"); +} + +const TOOL = [{ type: "function", function: { name: "bash", description: "run a command", parameters: { type: "object", properties: {} } } }]; +const HEADERS: Record = { + "content-type": "application/json", + "x-acp-session": SESSION, + "x-bili-plugin": "dsh", + "x-bili-plugin-conversation": SESSION, +}; + +test("#4501: path-style dsh-lane request resolves the configured output ceiling and restores the mid-band budget", async () => { + const rig = await startRig(CEILING); + try { + // PATH-STYLE: POST straight at the proxy's default upstream — no /bili/, + // no absolute form. This is the dsh desktop shape that lost the config. + const url = `http://127.0.0.1:${rig.proxyPort}/v1/chat/completions`; + // 8192 sits above the <=200 starve gate but far below the declared 384K + // ceiling: on the dsh lane (host stamps maxTokens by contract) that is the + // raw-history collapse signature #3438 exists to rescue. + const body = { model: MODEL, max_tokens: 8192, tools: TOOL, messages: [{ role: "user", content: "hello" }] }; + const r = await fetch(url, { method: "POST", headers: HEADERS, body: JSON.stringify(body) }); + assert.equal(r.status, 200); + await r.text(); + + const fwd = rig.lastBody; + assert.ok(fwd, "upstream received the request"); + assert.equal(fwd?.max_tokens, CEILING, "the declared output ceiling floors the restore on a PATH-STYLE request (#4501)"); + + const s = getSession(SESSION); + assert.ok(s, "session row exists"); + assert.equal(s.metadata.outputBudgetDegraded, undefined, "a resolved ceiling leaves no no-ceiling degraded state behind"); + } finally { + await closeRig(rig); + } +}); + +test("#4501 control: the SAME path-style request with NO declared ceiling forwards the mid-band value verbatim (pre-fix behaviour)", async () => { + const rig = await startRig(undefined); + try { + const url = `http://127.0.0.1:${rig.proxyPort}/v1/chat/completions`; + const body = { model: MODEL, max_tokens: 8192, tools: TOOL, messages: [{ role: "user", content: "hello" }] }; + const r = await fetch(url, { method: "POST", headers: HEADERS, body: JSON.stringify(body) }); + assert.equal(r.status, 200); + await r.text(); + + const fwd = rig.lastBody; + assert.ok(fwd, "upstream received the request"); + assert.equal(fwd?.max_tokens, 8192, "with no known ceiling bili cannot judge collapse from intent — forwarded verbatim"); + const s = getSession(SESSION); + assert.ok(s, "session row exists"); + // The unrescuable mid-band takes the healthy branch (collapse needs a + // known ceiling), which poisons the high-water with the starved value — + // the exact #4501 impact-2 residue a declared ceiling prevents. + assert.equal(s.metadata.outputBudgetHighWater, 8192, "the verbatim mid-band poisons the high-water with the starved value"); + } finally { + await closeRig(rig); + } +}); diff --git a/tests/side-request-isolation.test.ts b/tests/side-request-isolation.test.ts index 234ada5e07..725e880ce5 100644 --- a/tests/side-request-isolation.test.ts +++ b/tests/side-request-isolation.test.ts @@ -458,6 +458,31 @@ test("restoreOutputBudget: the <=200 starve log keeps its original wording, the assert.ok(lines.some((l) => l.includes("#3438: dsh-lane mid-band collapse")), "the mid-band restore names itself"); }); +test("restoreOutputBudget: a KNOWN ceiling with value >= ceiling is healthy — no spurious 'NO known output ceiling' warn (#4501)", () => { + _resetDshMidBandWarningsForTest(); + const warns: string[] = []; + const log = (lvl: string, msg: string): void => { if (lvl === "warn") warns.push(msg); }; + const tools = [{ name: "t" }]; + const M = "prov/capped-model"; + const CEIL = 131_072; + const midBandWarns = (): number => warns.filter((w) => w.includes("NO known output ceiling")).length; + // Pre-#4501 the mid-band warn fired on any dsh-lane tool-carrying budget in + // the healthy branch — including when a ceiling WAS known (value >= ceiling) — + // spamming operators who had declared one. A known ceiling makes it healthy. + const s = metaSession("dsh-cap-known"); + const atCap = { max_tokens: CEIL, tools, model: M }; + restoreOutputBudget(atCap, s, log, CEIL, true); + assert.equal(atCap.max_tokens, CEIL, "at-ceiling value passes untouched"); + assert.equal(midBandWarns(), 0, "a KNOWN ceiling suppresses the mid-band warn"); + const over = { max_tokens: CEIL + 1, tools, model: M }; + restoreOutputBudget(over, s, log, CEIL, true); + assert.equal(over.max_tokens, CEIL + 1, "above-ceiling passes verbatim (not a collapse)"); + assert.equal(midBandWarns(), 0, "above-ceiling is also not a missing-ceiling gap"); + const s2 = metaSession("dsh-cap-none"); + restoreOutputBudget({ max_tokens: CEIL, tools, model: M }, s2, log, undefined, true); + assert.equal(midBandWarns(), 1, "no ceiling -> the warn still fires exactly once"); +}); + test("resolveKnownOutputCeiling: runtime-info > launcher > declared > registry rank order (#1840)", () => { _resetPluginStateForTest(); setRegistryForTest({ "stepfun/step-5-preview": { limit: { context: 1_000_000, output: 1_000_000 } } }); From 1f5d0237973218dda9aae9479afa69b94b63b868 Mon Sep 17 00:00:00 2001 From: ci-check Date: Sat, 24 Oct 2026 18:33:06 +0800 Subject: [PATCH 2/3] fix: name the path-style destination in the route-passthrough log; reuse providerDestUrl for the #3211 pairing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-up on #4501/#4510 — two small cleanups on top of the new single config-matching basis; no behavior change beyond the log text: - the #661 route-passthrough log line still masked route?.rewrittenUrl, which is undefined for path-style matches. Now that #4501 makes those matches possible, the line would have logged an empty URL; it names providerDestUrl instead. - the #3211 calibration pairing recomputed the full destination URL inline; it now reuses providerDestUrl (identical value) so the single matching basis stays single. --- src/server/handle.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/handle.ts b/src/server/handle.ts index 4e27d22e74..8dd7b5e0b2 100644 --- a/src/server/handle.ts +++ b/src/server/handle.ts @@ -831,7 +831,7 @@ async function handleRequest( // `passthrough: true` (upstreams that fingerprint the request body). const routePassthrough = !opts.passthrough && findRoute(opts.routes, providerDestUrl)?.passthrough === true; if (routePassthrough && hopMarker === undefined && protocol && parsed) { - log("info", `[route-passthrough] ${maskUrlsInText(route?.rewrittenUrl ?? "")} matches a passthrough route — forwarding verbatim, kernel bypassed`); + log("info", `[route-passthrough] ${maskUrlsInText(providerDestUrl)} matches a passthrough route — forwarding verbatim, kernel bypassed`); } // #300: `hopMarker !== undefined` means an upstream bili already processed // this request — skip the whole pipeline (prepared stays null) so the @@ -2339,7 +2339,7 @@ async function handleRequest( // provider field); an absent policy stores undefined and // clears any stale slot from a previous route. { - const destUrl = route ? route.rewrittenUrl : /^https?:\/\//i.test(urlPath) ? urlPath : `${opts.upstream}${urlPath}`; + const destUrl = providerDestUrl; const calibPolicy = findRoute(opts.routes, destUrl)?.calibration; session.stats.lastCalibrationPolicy = calibPolicy; session.stats.lastCalibrationPolicyOrigin = calibPolicy ? destUrl : undefined; From 6a5b94bad09aedcf3c7e5d1ea2967171bd63403f Mon Sep 17 00:00:00 2001 From: ci-check Date: Sat, 24 Oct 2026 19:15:49 +0800 Subject: [PATCH 3/3] fix: seed the pluginLaneServerHistory rollout row so docs-sync regenerates it - tools/gen-config-docs.mjs: drop the stale backtick ban on desc_en/desc_zh (these fields render only into markdown tables, where backticks are valid inline code); add optional default_zh for zh-localized default cells. - website/config-reference/rollout.yaml: add the rollout.features.pluginLaneServerHistory entry reproducing #4491's committed row byte-exactly (EN+ZH). - Regenerate CONFIGURATION.md / CONFIGURATION.zh-CN.md (param-ref row + env-map row). --- CONFIGURATION.md | 2 +- CONFIGURATION.zh-CN.md | 2 +- tools/gen-config-docs.mjs | 9 +++++---- website/config-reference/rollout.yaml | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 0b3fd4faa7..10e95b6e2c 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -100,7 +100,7 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed | `rollout.features.percent` | number | the version's baked-in plan | — | Percent of installs (0–100, fractional allowed) that see the feature. Monotonic: raising the percent never drops an already-enabled install; the bucket is prefix-stable per install. | | `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.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. | | `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. | diff --git a/CONFIGURATION.zh-CN.md b/CONFIGURATION.zh-CN.md index aecaa3be10..608d0a2096 100644 --- a/CONFIGURATION.zh-CN.md +++ b/CONFIGURATION.zh-CN.md @@ -100,7 +100,7 @@ | `rollout.features.percent` | number | the version's baked-in plan | — | 看到该特性的安装占比(0–100,支持小数)。单调:上调比例不会把已入组的安装踢出;每台安装的桶值是前缀稳定的。 | | `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 (off) | BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY | 插件车道服务端正史(#4491):对已放量的安装,(a) 插件车道请求可携带与 messages 平行的内部字段 biliMsgIds,把消息身份钉在客户端提供的 id 上(转发上游前一律剥掉;格式错误的数组告警后忽略,身份投毒形态在增量车道直接硬失败);(b) 仅回环可达的 POST /__bili/plugin/render 端点从统一存储渲染出站前缀(折叠区收敛为摘要锚点;任何失步都返回非 2xx,shim 退回本地历史);(c) 增量车道探测响应通告 serverHistory。默认 0%,放量前无行为变化。 | +| `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%,放量前无行为变化。 | | `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:),不再排队在主会话锁后。 | diff --git a/tools/gen-config-docs.mjs b/tools/gen-config-docs.mjs index 3100f7d7ed..5ea304ad22 100644 --- a/tools/gen-config-docs.mjs +++ b/tools/gen-config-docs.mjs @@ -114,9 +114,9 @@ function validate(entries, file, idMap) { if (typeof e[f] !== "string" || e[f] === "") fail(ctx + ": missing or empty field " + f); } if (!GROUPS.some((g) => g[0] === e.group)) fail(ctx + ': unknown group "' + e.group + '"'); - for (const f of ["desc_en", "desc_zh"]) { - if (e[f].includes("`")) fail(ctx + ": backtick forbidden in " + f); - } + // desc_* flow ONLY into the markdown tables below, where backticks are valid inline code. + if (typeof e.default_zh === "string" && e.default_zh === "") fail(ctx + ": empty default_zh"); + if (typeof e.default_zh !== "undefined" && typeof e.default_zh !== "string") fail(ctx + ": default_zh must be a string"); const hasId = typeof e.id === "string" && e.id !== ""; const hasRender = typeof e.render === "string"; const hasSiteGroup = typeof e.site_group === "string"; @@ -178,7 +178,8 @@ function genParamRef(entries, lang) { const dep = e.deprecated === true ? (lang === "zh" ? " _(已弃用)_" : " _(deprecated)_") : ""; const envCol = e.kind === "env-only" ? "—" : e.env && e.env.length ? e.env.join(", ") : "—"; const desc = lang === "zh" ? e.desc_zh : e.desc_en; - out.push("| `" + e.key + "` | " + mdCell(e.type) + " | " + mdCell(e.default) + " | " + mdCell(envCol) + " | " + mdCell(desc) + dep + " |"); + const def = lang === "zh" && typeof e.default_zh === "string" ? e.default_zh : e.default; + out.push("| `" + e.key + "` | " + mdCell(e.type) + " | " + mdCell(def) + " | " + mdCell(envCol) + " | " + mdCell(desc) + dep + " |"); } out.push(""); } diff --git a/website/config-reference/rollout.yaml b/website/config-reference/rollout.yaml index 3074652e99..4db7387164 100644 --- a/website/config-reference/rollout.yaml +++ b/website/config-reference/rollout.yaml @@ -52,7 +52,8 @@ entries: - key: rollout.features.pluginLaneServerHistory type: "boolean | number" default: "0 (off)" + default_zh: "0(关)" env: BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY 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%,放量前无行为变化。" + 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%,放量前无行为变化。"