Repository navigation
[PR] fix(responses): share developer segment concatenation between compressed re-request and steady state, fix prefix re-bill | fix(responses): 压缩重请求与稳态共用 developer 段拼接,修复每次折叠后的前缀重计费 (#6922) - #6944
Conversation
…fix fork (#6922) The steady prepare path (prepare-responses.ts) and the proxy-loop round-2 rebuild (relay.ts) each assembled the Responses developer element from the same ordered sections (system parts, compress prompt, generation-boundary note #4305, absorb, block-ops) but with different separators: steady joined with the "---" divider while round-2 glued boundary/absorb/block-ops with plain "\n\n". On every fold of a generation-boundary-affected session the developer element forked at the note position and the upstream prefix cache re-billed everything after it. Introduce joinResponsesSystemSections() (responses-system-sections.ts) as the single source of truth for the separator and call it from both builders plus the round-2 adapter join — the two paths can no longer drift apart. Non-responses round-2 keeps its historical plain-\n\n glue (those steady wires really do join with \n\n, verified by cache-seam probes P1-P3). Steady bytes are unchanged, so live sessions pay no upgrade re-bill. Test: driveWire gains generationBoundary/sections options; two new runs pin that the complete developer item is byte-identical across every ordinary -> compress re-request -> ordinary transition (with and without absorb+block-ops armed). Reverting only the relay change fails both.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1219-master.4a24c26 # this exact build
npm install -g billion-context@master # always the newest merged build
|
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10397-pr.6944.c8974dcThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6944.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 查重:不重复 — 本 PR (#6944) 是 #6922 的修复,supersede #6923(已关闭、未合并)。检索 open+closed PR 无同主题并列 PR,#6944 是 #6922 唯一合入的修复。 状态(已实时核实):#6944 已合并(merge commit 八问
CIPR head 有 3 个 test lane 红( 测试质量新增 2 用例(sections 开/关):developer item 在「普通 → 压缩重请求 → 普通」每次过渡 判定修复正确、完整、无回归、测试有效,已合并。3 个 CI 红疑似预存(待 CI 侧确认,不阻塞)。可收工。 |
…-fixes merge The ci-fixes merge added the canonical module-map line (ref ranxianglei#6922, correct alphabetical position) while the PR branch already carried a botched duplicate (ref ranxianglei#6944, non-alphabetical position). Keep the canonical ci-fixes entry, drop the duplicate.
现象
proxy-loop 模式 + 会话带 generation boundary 时,每次压缩折叠后的重请求(round-2)里,boundary/absorb/block-ops 段是用
\n\n粘上去的,而普通请求里这些段是---分隔(---拼接)。于是每次折叠,developer 段都从 note 位置开始分叉,前缀缓存把 note 之后的全部按新 token 重新计费。#6922。方案
把段拼接提成共享 helper(
src/responses-system-sections.ts→joinResponsesSystemSections),稳态构建路径、round-2 重建路径、round-2 adapter 的 dev join 全部改调它——两边再也不可能各写一套分隔符。非 Responses 的 round-2 保持历史\n\n胶水不动(那些 wire 的稳态本来就是\n\n,cache-seam probe P1-P3 逐字节验证过)。稳态字节完全不变 → 存量 Responses 会话升级零重计费。这是与 #6923 的区别:#6923 改的是稳态字节(
---→\n\n),每个存活会话升级后要付一笔一次性全量重计费。谢谢 @kuviki 的复现和测试思路(本 PR 的测试骨架取自 #6923),修复方向不同,本 PR supersede #6923。验证
relay.ts的改动,两个新用例都失败 → 测试真能抓住 [Bug] Inconsistent system prompt separator in Responses internal re-request breaks cache prefix | [Bug] Responses 内部重请求的系统提示分隔符不一致,破坏缓存前缀 #6922merged 后 fixes #6922。