Repository navigation
fix: recognize the dsh title sidecar on the anthropic wire (#3149) - #3153
ranxianglei merged 3 commits into
Conversation
…erTexts (ranxianglei#3153) Review follow-up on the ranxianglei#3153 fix: the PR hoisted the all-wire system-carrier scan into src/util.ts so side-request.ts would not carry a third copy, but the byte-identical private copy in src/server/pi-subagent-channel.ts (ranxianglei#2694) was left behind. Two identical copies of a carrier list whose doc comments both claim parity with estimateWireOverhead is a drift trap — point the channel detector at the shared export instead (logic unchanged, zero behavior delta).
…le (ranxianglei#3153 review) This PR retires tests/dsh-title-side-lane.test.ts (ranxianglei#2503); two of its pins had no replacement — the isSideRequest budget-heuristic boundary around the title body (rc.2 64 caught / alpha.2 4096 missed, the gap the text predicate exists for) and the non-object guard on isDshTitleRequest. Move them next to the new carrier table so the ledger does not shrink with the file.
(ai: vllm-qwen/qwen3.8-27b) Review 进度通报(代码审完,CI 跑完后补结构化八问结论): 代码审核 — 方向成立,根因修对了。
本地定向验证(全部通过): 8 个相关套件 78/78(dsh-title-sidecar-handle / side-lane-truth-table / dsh-title-side-lane / side-lane-invariants / fork-side-request-lane / side-request-isolation / dsh-persona-fingerprint / pi-subagent-channel)+ typecheck 干净。全量回归以远程 CI 为准。 我在你的分支上加了一个标注小修 commit( 小事故披露: 推送过程中我误在主仓建了同名分支并误取消了本 PR 自己的 5 个 CI run(CI 测试矩阵等)——杂分支已删除,5 个 run 已全部 rerun,不影响最终结果。 CI(test 矩阵 + 各 lane)绿后我回八问结论。 |
(ai: vllm-qwen/qwen3.8-27b) 审查完成:可合并。CI 在当前 head 分支现在是 3 个提交(透明起见列一下):
八问:
验证:
结论:可合并,合并动作留给你。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.425-master.5ce3b78 # this exact build
npm install -g billion-context@master # always the newest merged build
|
根因
isDshTitleRequest(#2503)只在messages[]里找role === "system"的条目。而 dsh 0.2.1-alpha.2 的原生(anthropic)lane 上,标题提示词走顶层system字段,messages[]里只有那个 user blob → 谓词返回 false → 标题请求没被sideRequestLike拦下,于是参与 persona 锚定(src/server/handle.ts:832的dshPersona && !sideRequestLike),用标题 prompt 抢走了裸 key;真正的主回合随后 system 变化 + 历史不连续 → fork 到|sub:<fp>(0.1.196 上是src/persona-anchor.ts的 fp 阶梯,master 上是src/session-resolve.ts的顺序解析,两者都会分叉)。第二个后果同 #2156:标题先到时,宿主盖章的 compress / acp_status 会路由进那个幽灵空账本。
#2503 只覆盖了 OpenAI 形状 ——
tests/dsh-title-sidecar-handle.test.ts当时的注释写的是 "the OpenAI wire (dsh's actual shape)",对 dsh 原生 lane 并不成立。修复
src/server/side-request.ts:isDshTitleRequest改为读所有 wire 的 system 载体(顶层systemstring / 文本块数组、instructions、systemInstruction.parts、messages[]/input[]里 role=system|developer),与estimateWireOverhead的载体清单一致;no-tools veto保留。src/util.ts:载体扫描提为共享的systemCarrierTexts(同样的 40 行此前已存在于src/server/pi-subagent-channel.ts,所以这次不再往 side-request.ts 里复制第三份)。src/server/handle.ts:772(sideRequestLike)与src/server/handle.ts:1659(dshTitleSidecar),仍由x-bili-plugin: dsh+agent !== "main"守门。测试
tests/dsh-title-sidecar-handle.test.ts:anthropic wire 的端到端 —— 标题请求(顶层 system、无 tools、budget 4096)先到 → 逐字透传、不占 anchor、stats.requests = 0、无|sub:行;随后带 tools 的主回合拿到裸 key、stats.requests = 1。tests/side-lane-truth-table.test.ts:11 行载体真值表(4 种 wire + developer 角色 + 三条闭合反例)。这一处同时满足 lane-guard(dsh 回归防护:泳道判定真值表 + 侧请求不变量 + dsh e2e lane + 运行时金丝雀 + lane-guard(5 项) #2170)"改了 side-lane 逻辑必须带专用 lane 套件"的要求。影响面
x-bili-plugin === "dsh"之后短路,其他客户端 / lane 行为不变。request/header都是tools=1),isSideRequest同款 no-tools veto 兜住;反例已入真值表。验证
npm run typecheck干净pi-subagent-channel:67 / 67check-unused-exports/check-test-import-graph/config-surface-guard通过Fixes #3149