You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bili forwards all x-bili-plugin* host headers (and its own chain markers) to upstream model endpoints — egress strip gap | bili 把全部 x-bili-plugin* 宿主头(及自身链标记)转发给上游模型端点——出站剥离缺口 #3905
Activity
ranxianglei commentedon Oct 20, 2026
(ai: vllm-qwen/qwen3.8-27b)
查重: 不重复 —— open+closed 检索 header forward / egress strip / x-bili-plugin 均无同题;本条是 #3884 分析 exposed-tools 通道时发现并独立立项的存量缺口。
标签: bug / scope/wiring / p3 —— 核心出站头处理缺陷(协议接线层);owner 自评「功能面无破坏、安全增量有限」,按卫生/噪声定 p3(若你更看重「私有元数据持续外发第三方」这一外部暴露面,可升 p2,我这边保持可改)。
修复已开 PR: #3915 (Closes #3905)
结构化八问
1. 是什么问题
bili 把宿主(dsh/opencode/pi 等)打在自己请求上的全部
x-bili-plugin*私有头原样转发给了真正的模型供应商。这些头对 provider 毫无意义——等于把宿主私有约定(agent 标记、会话 id、窗口/模型声明,以及 #3884 新增的x-bili-plugin-exposed-tools声明头)每次请求都持续外发出去。2. 什么原因导致的
根本原因是出站剥离逻辑没覆盖主 HTTP 路径。主 HTTP 转发头由
buildForwardTarget()(src/server.ts)构造,它只剔了 content-length/host,其余入站头一律透传;而剥x-bili-*的UPSTREAM_HOP_HEADERS此前只挂在 WS 车道和响应方向,主 HTTP 请求路径漏了。3. 影响范围与严重程度
所有走主 HTTP 车道的会话都受影响(proxy + plugin 两种模式)。功能面无破坏(provider 忽略未知头),属卫生/噪声:宿主私有元数据持续外发第三方。安全增量有限(
x-session-id今天就在转发)。严重度 p3——无功能性破坏;但它是 #3884 新头的「带病上线」前置缺口,新头约束是「不向上游转发」,这个缺口不收掉新头就是带病上线。4. 怎么修复的
在两个出站模型端点构造点统一剥离
x-bili-plugin*族(新增stripBiliPluginHeaders(),按前缀x-bili-plugin精准匹配):buildForwardTarget()——主发送 + 所有重试/refetch 复用同一份头,一处覆盖全部;finalizeResponsesWsUpstreamHeaders()的非 Azure 分支(Azure 分支维持原样全剥x-bili-*,因 OpenCode V2 Azure Responses WebSocket bypasses native ACP interception; status can show stale compressed context #2359 自定义头上限)。关键取舍(为什么不是整族
x-bili-*全剥):我先做了「除 hop/tunnel 外全剥」的版本,实测误伤了x-bili-ws-lane(#3073 的链路握手标记),直接破坏了 codex-responses-ws 的链式探测/自环检测。所以收敛为只剥x-bili-plugin*。x-bili-hop/x-bili-tunnel/x-bili-ws-lane是 bili→bili 协议标记,消费方是下游 bili 的入站决策(#300/#1086),必须存活到下一跳;它们泄漏到终端 provider 无害(provider 忽略、不载密)——这正是 issue 里「二选一」我选的第二项(论证无害后接受现状)。5. 是否有回归问题
审过既有行为逐项:链式探测/自环检测(
x-bili-hop仍可达)、WS 握手标记(x-bili-ws-lane保留)、管理面隧道拒绝(x-bili-tunnel保留)、Azure WS 头上限(#2359 分支未动)、客户端端到端头不受影响。无回归。证据:本地修前 4/5 断言红(证明缺口真实且测试非空转),修后全绿;定向套件 41(chain/hop-by-hop 族)+ 24(本测试 + WS 族)全过;typecheck clean。全量回归以远程 CI 为准。6. 是否破坏缓存
不涉及——出站 header 剥离不影响 prefix cache / 压缩缓存 / 重试游标。
7. 是否改了设计方向
不涉及架构转向。只是把既有的「出站剥离」纪律补到主 HTTP 路径(此前只在 WS/响应方向存在),让两条车道出站面一致。
8. 是否引入了新的配置
不涉及——无新 env/config/默认值,纯出站行为修正。
行为变更披露(旧 → 新)
x-bili-plugin*(marker/conversation/window/model/exposed-tools)x-bili-hop/x-bili-tunnel/x-bili-ws-lanex-session-id收工判定: 缺口已收、双向回归钉死、typecheck 绿,PR #3915 待 CI 全量 + 人工合并。
test: align three stale egress pins with the #3905 strip (#3915)
refactor(loop): strip ranxianglei#3906 streamMarkers hunks — owned by…
fix(degenerate-turn): implement the action-cue + closed-fence gates t…
test(issue3905): cover plugin chat/responses lanes like the ranxiangl…
fix(plugin): announcement-tail detector must read answer prose, not p…
Merge origin/master into fix/announcement-tail-retry (ranxianglei#4935)
fix(loop): retry stalled bare-announcement terminal turns (ranxiangle…
refactor(loop): strip ranxianglei#3906 streamMarkers hunks — owned by…
fix(degenerate-turn): implement the action-cue + closed-fence gates t…
test(issue3905): cover plugin chat/responses lanes like the ranxiangl…
fix(plugin): announcement-tail detector must read answer prose, not p…
fix(loop): restore the streamedMarkers push the ranxianglei#3906 stri…
Merge commit '2153152f0' into HEAD
Merge commit '2153152f0' into HEAD
merge: sync origin/master (36a04a7) into #4785 - union degenerate-tur…
Merge commit '3858b6956' into main lane head
test: arm the opt-in degenerateRetry switch in the #3905 loop suite a…