Repository navigation
[PR] fix: prompt_cache_key self-injection disabled by default, promptCache.routing one switch controls both wires (#5079) | fix: prompt_cache_key 自注入默认关闭,promptCache.routing 一个开关管住两条 wire (#5079) - #5112
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.6748-pr.5112.d4ca00aThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5112.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) docs-sync 红 = 文档与代码默认值漂移。根因已定位并修好(本地已提交、已验证),但 push 被临时网络中断卡住,commit 尚未落到 PR 分支。 一句话:这个 PR(#5079)把 七问:
当前卡点(非代码问题):GitHub 出站通道暂时中断(代理连接反复被重置),连续十余次 push / ls-remote 均失败;修复 commit 下一步:出站恢复后 push 即绿(本 auto-fix lane 还有 attempt 2/2 会自动重试);无需你做任何操作。若长时间未恢复我会再补报。 |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——本 PR 就是 #5079 的实现(同线程已有 triage 批准与完成报告);相关历史 #2218/#2645/#2649/#5104 是同一 pck 机制族的前置 issue,不是平行工单。 标签: 独立 review 进行中(未照抄 issue 结论,diff 逐文件重读)。已发现并在 PR 分支上直接修掉两处问题:
修复后定向验证:typecheck 0 error;issue5079/issue2218/issue2645×2/issue3813 五套 = 27 pass / 0 fail(PR 原 head 上是 26/1)。已 rebase 到当前 master(base 只动了 README,无冲突)。 GitHub 出站网络此刻抖动(push/fetch 间歇失败),推分支 + CI 全量结果稍后补报;CI 绿后给结构化八问最终结论。 |
ceb92ca to
2e26be5
Compare
(ai: vllm-qwen/qwen3.8-27b) 审核进展(第二轮):上一轮 push 后 CI 主流程 test shards 红,拉日志定位到两处新问题——都是本 PR 引入的确定性缺陷,与 master 红绿无关。已修并推上分支(新 head 问题 1(严重):web 客户端 IIFE 里 问题 2: **本地定向验证(新 head):**web 五套件 112 pass / 0 fail,routing 25/25,pck 家族(issue5079/2218/2645×2/3813)27/27,typecheck 0 error。CI 全局结果出来后再报;最终结论按结构化八问给。 |
…ng gates both wires (#5079) The egress key was only useful to a minority of relay upstreams while a large unknown set of services hard-rejects requests carrying it, and that set cannot be enumerated. Flip the default of promptCache.routing from auto to disabled and make it the single switch for bili's OWN key emission on both wires: the chat-wire plugin-lane body stamp now honors it too (previously ungated), and a plugin-lane body key equal to the bound conversation id is recognized as bili machinery echoing back (dsh PI_CACHE_RETENTION stack, omp extension stamp) rather than client intent. Client-supplied keys still forward verbatim in every mode; the egress A/B probe-and-remember is untouched.
…UI switch (#5079) Users upgrading onto relay/account-pool upstreams (workbuddy panel/hub, account pools) must know to re-enable routing or their prefix-cache affinity silently degrades to random routing. The notice is active while the effective routing is disabled and until dismissed per instance (state file upgrade-notices.json, same discipline as host-plugin notices): web banner with dismiss button (POST /__bili/notices/dismiss), acp_status line, and a startup log line. The web config page gains a quick-config switch (disabled/auto/enabled) hot-applied through the existing PUT /__bili/config path; PUT now also refreshes opts.promptCache.
…w signature New suite covers parsePromptCacheRouting defaults, both wire decision matrices (disabled/auto/enabled incl. bili-owned echo vs genuine client key), the responses explicit-key echo rule with identity source, the pck-notice module under XDG_STATE_HOME tmpdirs, and live-proxy egress assertions (default-off strips the stamp but keeps x-session-id; echo stripped; client key verbatim; auto restores stamping). The issue2218 unit matrix adopts the routing/sessionId parameters; its two non-plugin no-key rows flip keep-client->drop (no-op normalization).
CONFIGURATION en/zh: default column and section rewritten for the disabled default, both-wires semantics, client-key rule, entry points. TECHNICAL-NOTES en/zh: policy-reversal section superseding #2649's default-on ruling. CHANGELOG: Unreleased entry with the old->new behavior disclosure.
…5079) The docs-sync CI job regenerates CONFIGURATION.md(+zh) generated blocks from website/config-reference/*.yaml and fails on drift. The #5079 default flip (auto -> disabled) was applied to the generated tables by hand but the seed entry kept default "auto" plus the pre-#5079 descriptions, so every regeneration reverted those four lines. Update the seed (default + en/zh descriptions) so the generator reproduces the committed tables byte-for-byte.
parsePromptCacheRouting mapped every value other than enabled/disabled to disabled — including an explicit "auto". That silently rewrote existing configs that wrote routing:"auto" into the new default-off posture, contradicting the #5079 migration promise (wrote auto/enabled keeps pre-#5079 behavior; only configs that never set it change). The PR's own new test asserts parsePromptCacheRouting("auto") === "auto" and was red on this head. Accept "auto" as a valid value; absent and unknown values still fall back to disabled.
The #5079 banner block re-declared const pb inside renderBanners(), where pb already names the plugin-advisory banner element -> SyntaxError (Identifier 'pb' has already been declared) at IIFE load, which took down every vm-based web suite (web-routing/web-i18n/web-blog-route/ web-handoff-roles/web-trajectory-brush). The embedded IIFE is a string in client.ts, so tsc never type-checks its body; renamed to nb.
The pre-existing parser test pinned the old fallback (unknown -> auto); #5079 flips the default to disabled and the PR's own issue5079 suite asserts the new contract, so this pin now follows it.
45109ef to
d79232d
Compare
(ai: vllm-qwen/qwen3.8-27b) Review 完成,判定:可合。 最后一轮又发现并修掉了 2 处缺陷(#5、#6,见下),连同前两轮已报的 4 处,全部以独立标注 commit 修在 PR 分支上。最新 head 结构化八问
Review 发现并已修的 6 处缺陷(每处独立标注 commit)前两轮已报过 #1–#4(seed 漂移、显式 auto 被解析吞掉、web 内嵌浏览器代码里重复声明变量导致整套 vm 测试崩、旧默认值测试钉未跟进),此处补最后两处:
回归审查清单(②)diff 触碰路径承担的既有行为:keep-client 通道、A/B 消融、Anthropic strip、passthrough、身份提升、PUT /__bili/config 热应用(PR 顺带补上了该路径对 测试有效性(④)新增 issue5079 套件正负成对且断言有牙:两条 wire 的判定矩阵(disabled/auto/enabled × 回显 vs 真客户端 key)+ 真实代理出站断言(port 0 / listen(0),确定性),bug 回归时抓得住;存量 5 套 pck 相关套件本地跑过 27/27。 判定:可合。 本 PR 属默认值/产品策略变更(AGENTS.md §7.4 must-stay-human),CI 绿后合并动作留给 @ranxianglei。 |
(ai: vllm-qwen/qwen3.8-27b) CI 确认:head Review 收工:可合,等 @ranxianglei 合并(默认值变更按 §7.4 留人工)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.911-master.93598ec # this exact build
npm install -g billion-context@master # always the newest merged build
|
(ai: vllm-qwen/qwen3.8-27b)
Closes #5079
是什么
prompt_cache_key只对少数中转站有用,而大量服务见到这个 header/body 字段会直接拒绝请求,这样的服务无法枚举。本 PR 把 bili 自己铸造的 key 默认关掉,并给出一个用户可见的开关(web UI + config + env),升级用户会收到一次性提示。行为变更(旧 → 新,rule 4 披露)
promptCache.routing默认值(两条 wire 同时生效)autodisabledPI_CACHE_RETENTION=long栈、omp 扩展盖章)prompt_cache_key(任何车道、任何模式)config surface
没有新增配置形状——复用既有
promptCache.routing(file /ACP_PROMPT_CACHE_ROUTINGenv / web UI 三入口),仅翻转默认值 auto→disabled,并把它的管辖面从「Responses wire 注入」扩到「两条 wire 上 bili 自铸 key 的全部出口」。web 配置页新增快速配置下拉(disabled/auto/enabled),走既有 PUT/__bili/config热应用路径(该路径现在也会刷新opts.promptCache)。现有配置文件无需迁移:写了auto/enabled的保持原行为;没写的从「auto」变为「disabled」——这正是 issue 要求的策略反转。升级提示(issue 要求:第一次升级到该版本要收到)
一次性通知,有效条件 = 生效 routing 为 disabled 且未被本实例关闭;关闭状态持久化(
upgrade-notices.json,与 host-plugin 通知同一纪律):POST /__bili/notices/dismiss);acp_status输出一行PCK SELF-STAMPING OFF BY DEFAULT (instance-level, #5079);文案点名具体软件(按 issue 要求):workbuddy panel/hub(中转站类)、号池场景——这类上游按该 key 路由前缀缓存,不开启会导致流量随机路由、频繁不命中;直连官方 API 的用户可忽略。
测试
tests/issue5079-pck-default-off.test.ts:parsePromptCacheRouting 默认行、两条 wire 的判定矩阵(disabled/auto/enabled × 回显 vs 真客户端 key)、responses 显式 key 的身份源规则、notice 模块(XDG_STATE_HOME tmpdir)、真实代理出站断言(默认关→body 无 key 但 x-session-id 保留;回显被剥;客户端 key 原样;auto 恢复盖章)。正负成对。tests/issue2218-relay-affinity-signal.test.ts单测矩阵跟进新签名;两个非插件无 key 行的期望 keep-client→drop(删不存在的 key,行为等价)。node --import tsx --test跑 issue5079/issue2218/issue2645/issue3813 四套 = 100 pass / 0 fail;typecheck 0 error。全量回归交 CI。routing:"auto",默认翻转不会波及存量测试语义。回归审查摘要
触碰路径的既有行为逐项过:客户端 key 通道(keep-client)、A/B 消融(drop)、Anthropic wire 剥离(#1403)、passthrough 逐字节转发、入站身份提升——均未改动且有测试钉住;唯一有意的行为变化即上表 1–4 项。