Skip to content

[PR] fix(fastpath-v6): tunnel-origin requests without the identity channel are cohort exclusions, not faults (#5760) - #5773

Open
ranxianglei wants to merge 1 commit into
2026-11-04_fastpath-v6-msgidfrom
2026-11-06_v6-tunnel-origin-exclusion
Open

ranxianglei wants to merge 1 commit into
2026-11-04_fastpath-v6-msgidfrom
2026-11-06_v6-tunnel-origin-exclusion

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #5760

What this fixes

With the watermarkV6MsgId rollout forced on (rollout.features.watermarkV6MsgId: true / BILI_ROLLOUT_WATERMARK_V6_MSG_ID=1; default 0% off), dsh sessions using URL-prefix / attach mode (profile points at <origin>/bili/<upstream>) get EVERY model request refused with 400 pf_v6_identity_fault:

identity channel incomplete: x-bili-pf-tail-ids absent

The v6 identity hard gate (src/server/fastpath-v6.ts) is fail-loud by design on the premise "lane traffic always comes from a native shim that stamps the pf-* handshake in-process". That premise holds only OFF-tunnel: /bili/ prefix/attach traffic is a plain HTTP client with no in-process fetch interception, so the handshake can never be present there — the lane's entry conditions were met while the gate's premise was false for this population. Result: every turn 400s (five refusals → 60-min park → repeat after hold expiry); fresh processes/stores reset the breaker, which is why the e2e attach run fails stably. The A/B evidence in #5760 (byte-identical 400 on a build containing none of #5732's changes) pins this as inherent to the v6 lane line — hence this lands as a supplement against the lane branch, same pattern as #5721/#5732.

Fix

One structural cohort exclusion in the gate's absent-channel branch: when the request arrived over the /bili/ tunnel (route.tunnel, resolved once from the incoming URL in handle.ts and plumbed through prepareOpenai into the v6 input), an ABSENT identity channel passes silently to the v5/legacy lanes — the same treatment as the carrier-absent exclusion. Nothing else changes:

  • non-tunnel traffic without the channel: hard 400 + breaker count, byte-identical;
  • tunnel traffic WITH the channel (a shimmed host routed through /bili/): enters the gate unchanged, full validation;
  • present-but-bad channels (malformed member / width mismatch / consistency break): faults for ALL origins, unchanged.

Plumbing: route?.tunnel === true (handle.ts — single assignment from the incoming URL) → new optional trailing parameter of prepareOpenai → input.tunnelOrigin on evaluateWatermarkV6 (default undefined ⇒ legacy semantics for every existing caller/test).

Behavior change (flagged per policy)

Tests

New tests/issue5760-v6-tunnel-origin-exclusion.test.ts (hermetic sqlite-sidecar harness mirroring fastpath-v6-msgid.test.ts), both directions per #3617 gate discipline:

  • tunnel + absent channel → null exclusion, zero breaker writes, no world minted, no error/warn log (asserted over 6 consecutive turns);
  • non-tunnel (omitted AND explicit false) + absent channel → 400 fault, breaker fed once per refusal (regression pin);
  • tunnel + sound channel → arm then hit (the exclusion is not over-broad);
  • tunnel + present-but-bad channel → still faults (malformed member, width mismatch);
  • breaker isolation: ten excluded turns never park the lane; a later sound-channel turn on the SAME session arms cleanly.

Existing tests/fastpath-v6-msgid.test.ts + tests/fastpath-v6-tail-window.test.ts pass unchanged (22/22 across the three files locally); typecheck + build green. Full-suite verdict: CI on this head.

Base is the lane branch 2026-11-04_fastpath-v6-msgid (master has no fastpath-v6 lane yet); merge order: this PR → lane branch, then #5652 carries everything to master.

… are cohort exclusions, not faults (#5760)

The v6 identity hard gate assumes lane traffic comes from a native shim that stamps the pf-* handshake. That premise holds only off-tunnel: /bili/ prefix/attach traffic is a plain HTTP client with no in-process fetch interception, so an absent x-bili-pf-tail-ids there is structural — pre-fix every turn 400'd (five refusals then a 60-min park, repeating), making attach-mode sessions unusable whenever the watermarkV6MsgId rollout is forced on.

The gate now passes such requests to the v5/legacy lanes as a silent cohort exclusion (same treatment as the carrier-absent exclusion). Non-tunnel traffic keeps the hard refusal byte-identically; tunnel traffic that DOES carry the channel (a shimmed host routed through /bili/) enters the gate unchanged, and present-but-bad channels stay faults for all origins.
@ranxianglei ranxianglei changed the title fix(fastpath-v6): tunnel-origin requests without the identity channel are cohort exclusions, not faults (#5760) [PR] fix(fastpath-v6): tunnel-origin requests without the identity channel are cohort exclusions, not faults (#5760) Nov 5, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复 —— 91 个在途 [PR] 里只有这一个针对「fastpath-v6 tunnel-origin 排除」这一修复;其余 fastpath-v6 相关 PR(lane 本体 / render-snapshot 演进 / scan-resume)scope 各异,无并列重复。

对象:GitHub PR #5773(head 2026-11-06_v6-tunnel-origin-exclusion ← base 2026-11-04_fastpath-v6-msgid lane 分支;1 commit,4 files,+206/−5),修 GitHub #5760。我独立读了源码路径(没照抄 PR 描述),逐条核过。

八问

  1. 是什么问题:watermarkV6MsgId 灰度打开(>0%)时,dsh 走 URL 前缀/attach(profile 指 <origin>/bili/<upstream>)的会话,每个模型请求都被 v6 身份硬门拒 400 pf_v6_identity_fault(identity channel incomplete: x-bili-pf-tail-ids absent)。
  2. 什么原因:v6 身份硬门 fail-loud 的前提是「车道流量必来自能进程内盖 pf-* 握手的原生 shim」。这前提只在 off-tunnel 成立;/bili/ 前缀流量是纯 HTTP 客户端,没有进程内 fetch 拦截,握手结构上不可能出现 → 入口条件满足但门前提对这批人为假 → 每轮 400 → 5 次触发 60min park → 循环。When the v6 msgid fast path is forcibly enabled, every turn of dsh sessions using the /bili/ prefix (attach/prefix mode) | v6 msgid 快通道强制开启时,dsh 走 /bili/ 前缀(attach/prefix 模式)的会话每一轮都被 400 拒掉 #5760 的 A/B(不含关联改动的构建上字节级一致 400)钉死这是 v6 车道线固有。
  3. 影响面/严重度:默认灰度 0% ⇒ 出厂零影响;放量到 >0% 时,prefix/attach 用户整轮 400(可用性毁灭级)。属放量前必须清的阻断项。
  4. 怎么修:在门的「通道缺失」分支加一个结构性 cohort 排除——请求经 /bili/ tunnel 到达且通道缺失时静默放行到 v5/legacy(与 carrier 缺失同待遇),不再 fault。管道:handle.ts 传 route?.tunnel===true → prepareOpenai 新增可选尾参 → evaluateWatermarkV6(input.tunnelOrigin),默认 undefined⇒旧语义。其余 fault 类对所有 origin 不变;tunnel+有效通道照常进门做完整校验。
  5. 回归:核对了 resolveUpstream——tunnel:true 只对 /bili/ 前缀(server.ts:272)与 forward-proxy 绝对形(:302)置位,MITM/直连无此字段,故排除精确命中「无 shim」人群、不过宽。门的既有分支(config 门 / carrier 缺失 / 结构扫描 / off-tunnel 缺失仍 400+breaker / malformed / width / echo-break / matching·arm·hit)全部不变;off-tunnel 路径字节级不变(tunnelOrigin undefined/false 落原 throw);breaker、world-mint、wire 头未动。CI 绿(镜像缓存:17 checks,0 failed,0 pending;e2e 各道按 env 门控 skip)。
  6. 破坏缓存:不涉及——只决定走 v6 还是 legacy 兜底,不动任何缓存键/重试/游标/去重。
  7. 改设计方向:不涉及转向,是在既有「carrier 缺失=静默排除」机制上补一类结构性排除。
  8. 新配置:无新 env/config/默认值;行为仍由既有 watermarkV6MsgId 灰度(默认 0%)门控,tunnelOrigin 只是内部参数,非用户面旋钮。

一处非阻断观察:排除落在 if (!isSingleHeaderValue(rawIds)),该判断同时覆盖「多值/空串」头——若 tunnel-origin 真发了一个多值 pf-tail-ids,会被静默排除而非 fault。实际不可达(纯客户端不发、正常 shim 只发单值),最坏也只是安全降级到 legacy(永不 400/损坏)。若要严格「present-but-bad 一律 fault」,可把排除收窄为仅 rawIds === undefined;建议维持现状(安全方向、diff 最小),在你自己这条 lane PR 上定夺即可,我不擅自动。

判定:可合。属人工合并(identity/cohort 逻辑 + 协调的 lane 分支收口序列,非自动合并候选)。本地未跑全量(CI 为准),已逐行核源码 + 读 CI 状态。

@ranxianglei

Copy link
Copy Markdown
Owner Author

该PR已按根因归类纳入 [kernel-compression] 根因汇总 #6265,由汇总单统一跟踪处理;本单不再单独跟进,故关闭。如认为归类有误或问题仍未解决,请直接回复,会重新打开。

@ranxianglei

Copy link
Copy Markdown
Owner Author

状态更正(自动化脚本误操作): 本单此前被「纳入根因聚合」流程误关闭, 现重新打开。机器人工作已停, 本单由根因聚合线程统一跟踪, 根因修复落地后请手动关闭或在本单回复「close」。
[automated: re-open after bot-stop-only policy]

@ranxianglei ranxianglei reopened this Nov 12, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

更正说明:本单此前被归类聚合流程误关闭。按「只停机器人、不动 issue 本身」的口径重新打开;本单已被根因聚合线程纳入跟踪,机器人在本单上的工作已停止,不会再有自动处理。归类或纳入有误请直接回复指出。

@ranxianglei

Copy link
Copy Markdown
Owner Author

重新打开:此前被归类聚合脚本误关。按 owner 口径,纳入根因聚合的 issue 只停机器人、不关闭,由根因聚合线程统一跟踪,根因修复落地后统一关闭。
(reopened: absorbed issues must not be closed, only bot work stopped — owner policy 2026-11-12)

@ranxianglei

Copy link
Copy Markdown
Owner Author

(更正)此前按"清理"口径误关闭;按 owner 口径纠正:被根因聚合纳入的 issue 只停机器人、不关闭。本 issue 重新打开,机器人工作已停。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

收到,尊重你的归类决定——本单按你的决定关闭,我不重开。

先说清我的审核立场(供 #6265 记录):我对 PR #5773 的结论不变——修复正确、完整、CI 绿、无回归、可合;从技术侧看 #5760 由本 PR 解决,我这边没有「问题仍未解决」的遗留,不会以此为由重开。

两点事实供 #6265 汇总时参考(不阻断、不重开,是否影响归类由你定):

  1. 修复载体在 host 侧,不是 kernel/:本 PR 的改动落在 src/server/fastpath-v6.ts / handle.ts / prepare-openai.ts(fastpath-v6 车道),不是 kernel/ 改动;且行为受既有 watermarkV6MsgId 灰度门控(默认 0%,出厂零影响)。若 [Root Cause] kernel-compression (auto-maintained, do not manually disable) | [根因] kernel-compression(自动维护,勿手动关闭) #6265 的口径是严格 kernel/ 改动,这条的修复实际在 host 侧,记录时留意即可。
  2. 汇总跟踪 ≠ 修复落地:归类到 [Root Cause] kernel-compression (auto-maintained, do not manually disable) | [根因] kernel-compression(自动维护,勿手动关闭) #6265 统一跟踪没问题,但 When the v6 msgid fast path is forcibly enabled, every turn of dsh sessions using the /bili/ prefix (attach/prefix mode) | v6 msgid 快通道强制开启时,dsh 走 /bili/ 前缀(attach/prefix 模式)的会话每一轮都被 400 拒掉 #5760 对用户的实际解决仍依赖 PR [PR] fix(fastpath-v6): tunnel-origin requests without the identity channel are cohort exclusions, not faults (#5760) #5773 按 lane-branch 序列合入。建议 [Root Cause] kernel-compression (auto-maintained, do not manually disable) | [根因] kernel-compression(自动维护,勿手动关闭) #6265 里保留一项「PR [PR] fix(fastpath-v6): tunnel-origin requests without the identity channel are cohort exclusions, not faults (#5760) #5773 待合入(tunnel-origin 排除)」,避免汇总单收口时这一步被搁置、When the v6 msgid fast path is forcibly enabled, every turn of dsh sessions using the /bili/ prefix (attach/prefix mode) | v6 msgid 快通道强制开启时,dsh 走 /bili/ 前缀(attach/prefix 模式)的会话每一轮都被 400 拒掉 #5760 在灰度放量后仍对 prefix/attach 用户整轮 400。

如这两点不影响你的归类,就按你的决定执行,本单关闭。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

收尾确认(本单结论):

无其他待办。如归类或上述两点需调整,直接回复即可,会重新打开。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

说明:本单已无待办,我处于「等你回复」的空等状态,进程因长时间无动作被看门狗重启了两次——不是卡死或报错。

当前状态(已在上两条说清,这里收口):

无需你再触发我。如需调整归类或我留的两点(修复在 host 侧 src/server/ 非 kernel/;#6265 保留「PR #5773 待合入」项),直接回复即可重开。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant