Repository navigation
[PR] fix(incremental-lane): forward client end-to-end headers instead of a credential-dropping allowlist - #5661
Conversation
…4599) Master 9dc4c94 red on test (windows-latest, 22, 2) only: the two SSE abort cells exhausted the 10s teardown poll (closed=0, ~11s each) while the same code went green on ubuntu22/24 and windows24 shard-2 siblings (pass durations 23-352ms). The audit mandated by the constant's own note found no teardown hang: relay.ts arms res.on('close') -> clientAbort.abort() synchronously with no linger/backstop on this path, and no commit since d244fff touched destroy/abort wiring. Residual latency is runner-side event-loop starvation on loaded Windows runners (same family as the recorded 3s/6s eras). Platform-scoped response: win32 doubles to 20s; every other platform keeps the tight 10s gate so a genuine hang still fails fast.
#5428 made inline the pi lane default; this suite documents the spawn contract (instance record + proxy origin, per-request stamps, the shared-proxy delegate-child channel, /__bili/plugin/status over HTTP) and was not updated with the flip. Under the inline default its delegate-child stamp assertions get 0 stamped child requests (child traffic reaches upstream unstamped, conv=null) and the /acp instance- record assertion fails structurally. Pin BILI_PI_INLINE=0 for the whole suite so the spawn-posture coverage stays deterministic; inline posture is covered by tests/pi-inline-ws.test.ts / tests/pi-native.test.ts.
…76902208 flaked at 20s (#4599)
…40s raise (#4599) Run 41776902208 flaked openai-sse at the 20s win32 budget (closed=0 after 20.5s; siblings 131-410ms in the same run). The flat-raise ladder (3s->6s->10s->20s->40s in 850eca9) measures the runner, not the teardown: the poller shares ONE event loop with whatever starves it, so a close event cannot arrive faster than the loop itself. Keep the win32 base at 20s and extend the window by the poll's own measured event-loop lag, capped at 2xbase (<=40s - the same worst-case ceiling as the flat raise, applied only when lag is actually observed; healthy-loop gate byte-for-byte unchanged so a genuine hang still fails fast). Arithmetic pinned by a regression test.
… credential-dropping allowlist The delta lane (POST /__bili/plugin/turn) rebuilt the outbound request from a positive allowlist (authorization / anthropic-version / anthropic-beta), silently dropping any credential outside it — x-api-key, x-goog-api-key, api-key, custom gateway headers. The upstream then saw an unauthenticated request and returned 401; DSH maps that 401 to an invalid session and signs the account out, so re-auth was useless (the next incremental turn dropped the key again). Full-resend mode already forwards every header except host/content-length via buildForwardHeaders; converge the delta lane onto the same negative model: copy the client's own end-to-end headers, strip hop-by-hop / Connection-named / x-bili-* markers / stale content-encoding, then re-stamp the lane-owned framing and identity values. Behavior change: the delta lane now forwards ALL of the client's end-to-end headers (previously only three), so any credential header the client sends reaches the upstream. Closes #5658
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8184-pr.5661.86e39f9This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5661.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复 —— open+closed 的 issue/PR 里搜不到第二处针对「增量车道出站头转发 / 凭证被丢」的修复;本 PR 是 #5658 的唯一修复。 我按 PR review 规范独立审了代码与行为(没有照抄 PR 描述),并把分支 rebase 到当前 master 后做了本地定向验证。结论:可合,建议先 rebase 到最新 master(我已验证干净)。 结构化八问
|
…stead of hand-rolling a strip list Per review feedback, the initial fix's bespoke exclusion set (hop-by-hop + x-bili-* markers + content-encoding) diverged from how the non-incremental lane sends headers and risked an upstream-rejecting surface. forward() re-enters handleRequest → buildForwardHeaders, so the correct fix is to hand the client's own headers to that shared egress — byte-for-byte the same normalization full-resend uses — and apply only the corrections the REBUILT body forces (content-length; drop the now-stale content-encoding). This mirrors the marker-divert replay idiom in handle.ts rather than inventing a second rule. Tests: added an arbitrary non-credential client-header assertion to pin full-resend parity (no allowlist); delta-lane family 79/79 green. Closes #5658
…ad of a fixed 80ms grace — windows-latest/node-24 shard-4 fired it on green code under runner load (#4599)
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复——本次红是继承性环境 flake(win22-s2 abort-teardown 负载饥饿家族,#4599 在案),修复已收敛在 ci-fixes(d7a1a91,#5623 载体仍 open);未为本 PR 另开任何 issue/PR。 CI 修复完成(attempt 1/3): 判定与处理过程
结构化八问
收工判定:PR 已全绿,可进入正常审核/合并(合并由人工执行)。无需决策项,未打 needs-decision 标签。 |
…ping never reaches the model Review follow-up for #5658. The copy-all header forwarding introduced by the credential fix carries every client header through buildForwardTarget, which strips only UPSTREAM_HOP_HEADERS — and x-bili-turn-id was not in that set. The native plugins stamp x-bili-turn-id on a diverted model request alongside x-bili-plugin-turn to correlate the applied-seq ack, so it leaked onto the upstream request despite being pure host<->bili bookkeeping (same class as the x-bili-pf-* handshake headers, KDD #15). Add x-bili-turn-id to UPSTREAM_HOP_HEADERS so it is dropped at every egress site (HTTP forward + WS lane), mirroring pf-*/x-bili-passthrough. Strengthen tests/issue5658 to send x-bili-turn-id on both entry points (direct turn and marker-divert) and assert it never reaches the upstream; previously the client never sent it, so the assertion was tautological. Negative control confirms both cases fail without the UPSTREAM_HOP_HEADERS entry. No user-visible change (a random correlation id the model ignores); closes the gap between the PR's stated intent and its implementation.
|
(ai: vllm-qwen/qwen3.8-27b) 结论:APPROVE(可合) — 核心修复正确,达成 #5658(凭据经全量重发同一条 egress 面到达上游),无 kernel/config/wire-shape 变更,CI 绿。审出一个小缺口并已在分支上顺手修掉(见下)。注:本账号即 PR 作者,GitHub 禁止自批准,故以评论给出正式 verdict,请 owner/他号点合并。 已顺手修:增量车道 copy-all 转发会把客户端打的 结构化八问(针对本 PR)
行为变更披露(旧值→新值):出站头 旧 = 仅 3 个白名单头 → 新 = 客户端全部端到端头(减 hop-by-hop + x-bili 标记 + 过期 content-encoding)。PR 正文已披露,方向正确。 其余改动:4 个测试稳定性文件(e2e-native-pi / e2e-pi-codex-ws / event-loop-watchdog / wire-exit-matrix)来自 判定:可合(APPROVE)。小缺口已当场修掉并本地验证;全量以 CI 为准(我推送 |
(ai: vllm-qwen/qwen3.8-27b) ✅ 审核完成:本 PR(增量车道凭据头转发,修 #5658)verdict APPROVE(可合)。审出并当场修复一个小缺口——copy-all 转发会把客户端打的 |
|
(ai: vllm-qwen/qwen3.8-27b) Second-pass review @ head 自上一轮 review(head
CI(读镜像缓存,sha 无新发现。维持 APPROVE,请 owner 合并。 |
(ai: vllm-qwen/qwen3.8-27b) ✅ 二轮复审完成(head |
(ai: vllm-qwen/qwen3.8-27b) (同步回执)二轮复审已收尾,worker 侧无待办:结论 APPROVE、turn-id 修复已推(commit |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1036-master.69327e3 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…mpress gate, ranxianglei#5686 dsh drift consolidation, ranxianglei#5696 model-scoped keyring 429 Ride-along upstream work that landed after c9ba485: - ranxianglei#5683 forbid unprompted / out-of-bounds compression - ranxianglei#5686 dsh drift consolidation (last native-compaction leak window) - ranxianglei#5696 model-scoped KeyRing rate-limit holds - ranxianglei#5661 incremental-lane credential headers, ranxianglei#5656 single-shot sidecar - ranxianglei#5644 watcher registration recovery, ranxianglei#5635 restart survival Overlap with this lane is limited to regenerated artifacts (CONFIGURATION*.md) and to the shared relay/core seams, both auto-merged. No source conflict. Verified after rebuilding kernel: issue5175 58/0, tag-echo 79/0, issue2190-degen-close 32/0, golden-storage-render 5/0, storage-engine-proofs 12/0, native-compact-terminal 1/0, plugin-passthrough-tag-strip-chat 20/0, plus the newly arrived ranxianglei#5683/ranxianglei#5686/ranxianglei#5656/ranxianglei#5658/ranxianglei#5631/ranxianglei#5641 suites all green. tsc clean, four gates clean, config docs a fixed point.
Fixes #5658
问题
Delta lane(
POST /__bili/plugin/turn,rollout featurepluginIncrementalTurns)重建出站请求时用的是正向白名单PASSTHROUGH_HEADERS = [authorization, anthropic-version, anthropic-beta](src/incremental-lane.ts)。凡不在名单里的凭证头——x-api-key(Anthropic SDK 默认)、x-goog-api-key、api-key、自定义网关头——被静默丢弃,上游收到的是无凭证请求 → 401「Authentication Fails (governor)」→ DSH 把这个 401 映射成会话失效直接登出账号(重登也没用,下一轮增量又丢 key)。隔离实例里 seed+delta 都 200 但上游x-api-key=null的复现正是这条路径。病根是疏不是堵:full-resend 路径走
buildForwardHeaders(src/server/headers.ts,除 host/content-length 外全部端到端转发),delta 车道却另起炉灶用了个会漏的正向白名单,两条路径不对称。修法
让 delta 车道也走负向模型:复制客户端自己的端到端头,剥掉 hop-by-hop(
UPSTREAM_HOP_HEADERS)/ Connection-named /x-bili-*标记 / 过期的content-encoding,再显式盖上车道自己的 framing 与身份值(content-type / content-length / host / x-bili-plugin / x-bili-plugin-conversation / accept / capability 头 / model)。删除了死掉的PASSTHROUGH_HEADERS常量。delta 车道出站请求的头部转发策略:
x-bili-*标记 + 过期的 content-encoding)。原因:白名单漏掉 x-api-key 等凭证,上游收到无凭证请求返回 401,DSH 据此登出账号。收敛到与 full-resend 一致的负向转发模型是治本(疏而非堵)。未触碰 kernel/、pi-subagents/,无版本号变更,未新增配置面。
测试
新增
tests/issue5658-incremental-credential-headers.test.ts:/__bili/plugin/turn:authorization / x-api-key / x-goog-api-key / api-key 四个凭证头都到达上游,且不外泄 x-bili-turn-id;x-bili-plugin-turn:1):四个凭证头到达上游,且 x-bili-plugin-turn 标记被剥离。本地定向验证:delta-lane 全家桶 79/79 绿 + typecheck clean。修复前只有 authorization 被转发,故用例 1 在无此改动时会因 x-api-key 断言失败(非恒真断言)。