Repository navigation
fix(#1853): fork-adoption 收养管线补齐 responses/google 两线(resume 继承 refs/blocks) - #1855
Conversation
fork-adoption's id pass (incomingCoreMessages) only supported
{openai, anthropic}: responses (codex /v1/responses) and google
(gemini native) returned null, so identified resume-forks on those
wires inherited nothing but lineage — every folded original came
back on the wire and had to re-fold (#1834's residual population).
Extend SUPPORTED to all four wires. The new branches mirror each
wire's prepare* pre-projection mutations IN ORDER before converting
with the same converters prepare uses:
- responses: replaceBiliCompactionItems → normalizeResponsesMessageItems
→ sanitizeResponsesInputIds → dropWhitespaceResponsesMessages →
stripAcpPanelResponsesInput → stripAcpStatusMarkers →
stripEmbeddedChainCarriers → responsesToCoreWithToolImages
- google: stripEmbeddedChainCarriers → googleToCore
Id parity with processTurn's input is the whole point: an id this
pass misses drops a parent ref from the inheritance; an id it
invents matches nothing (harmless superset). The plugin-mode
mid-history sys/developer in-place marking (__bili_inplace_sysdev)
is deliberately not replicated — marked or hoisted, those items
contribute no core message either way.
Chain tracking, findResumeParent and the #1850 default block
adoption were already protocol-agnostic; this was the only gap.
tests/resume-adoption-wires.test.ts: responses resume through the
responses⇄chat bridge and a direct gemini-native scenario, both
asserting the full #1486 contract (refs preserved incl outside the
folded block, blocks adopted, lineage, parent untouched, fresh refs
above the parent's space) + the disabled-gate variant. Both
inheritance tests fail on the old SUPPORTED set (teeth verified).
|
链接到跟踪 issue:#1853(PR 关闭时自动关联 via Fixes)。 |
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1840-pr.1855.eaa3e55This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1855.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成(#1853 残留项,继 #1834/#1850)。结论:可合并。 结构化七问1. 是什么问题: 2. 什么原因导致的:根因在 v1 实现时的协议覆盖缺口—— 3. 怎么修复的:扩
4. 是否有回归问题:无。openai/anthropic 分支逐行未动(diff 核实);新代码只在原本返回 null 的路径上产生值。高危模式逐项过:无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化、无缓存键变化。行为变更仅 PR 披露的两处:①responses/google 换 id resume 从「只记 lineage」→「完整继承 refs/blocks/lineage」(本 PR 目的);②匿名 fork(forkAdoption 门)在四线同样可被测量/收养(仍受既有配置门控,默认不变)。 5. 是否破坏缓存:不涉及。本模块只读会话状态做种子复制,不改任何外发字节、前缀锚点或重试策略;种子发生在 processTurn 分配 ref 之前,符合 #1486 既有契约(ref 编号高于父空间,id 永不复用)。 6. 是否改了设计方向:不涉及。沿用 #629/#1486/#1834 的 copy-on-fork/copy-on-resume 机制,只是把 id pass 的协议覆盖补齐到声明的四线全量。 7. 是否引入了新的配置:不涉及。无新 env/config/flag; 本地定向验证(PR head da36cfb,另在与当前 master bcef839 的本地合并分支上复跑)
一个范围说明(google 线,#866 核查结论)google 线的 判定方向对(根因级修复)、管线一致性逐行核实通过、测试有牙且钉住旧行为、CI 全绿、diff 收敛(2 文件 +504/-10 全部相关)。建议合并。注:此变更扩展了 ref 继承语义到两条新线,按 §7.4 属人工合并范畴,合并操作留给你。 |
[bot] 🏷 收到。已核对:PR 正文首行即 |
Fixes #1853(继 #1834 / PR #1850 之后的残留项)。
问题
src/fork-adoption.ts的 id 解析管线incomingCoreMessages只支持SUPPORTED={openai, anthropic}:responses(codex/v1/responses)和 google(gemini native)直接返回 null → 整条收养/继承管线被跳过(包括 #1850 已默认化的 resume 块收养)。这两类客户端换 id resume 时只记 lineage,refs 和 blocks 都不继承 —— 折叠原文全部回到线上、请求膨胀、重新折叠一遍。链路追踪(findResumeParent)、identified 链记录、#1850 的默认块收养本来就都是协议无关的;这是唯一的缺口。
修复
SUPPORTED扩到四线,新分支 按 prepare 的顺序*镜像各线的投影前变换,再用 prepare 用的同一个转换器收尾:与 processTurn 输入的 id 对齐是全部意义所在:本 pass 漏掉的 id 会让父会话少一个 ref;多算出的 id 匹配不到任何东西(无害超集)。插件模式 mid-history sys/developer 原位标记(
__bili_inplace_sysdev)刻意不复刻 —— 标记与否,这些项都不产生 core 消息,id 集合相同。测试
tests/resume-adoption-wires.test.ts(新):牙型验证:把 SUPPORTED 临时改回 {openai, anthropic},两条继承测试变红、关闭变体保持绿。
验证
npm run typecheck✓影响