Repository navigation
[PR] fix: compressed thinking reclamation (#651) default changed to be uniformly deactivated with collapse, eliminating the once-per-turn cache seam (Refs #3198) | [PR] fix: 压缩思考回收(#651)默认改为随折叠统一下线,消除每轮一次的缓存接缝 (Refs #3198) - #3311
ranxianglei wants to merge 21 commits into
Conversation
每个压缩回合关闭时,reasoning-drop 会把该回合的思考内容从出站 视图移除——这是一次已知的中段历史改写,每次回合恰好重计费一次。 此前账本把这笔 miss 记成「⚠ CACHE SEAM(疑似中段前缀断裂)」, #3198 排查正是被这个无归因桶吓出来的。 现在 prepare-* 在 planReasoningDrop 之后上报计划 (noteReasoningDropPlan):计划增长=有回合新关闭,下一个大残差 miss 归因为 prov="reasoning" 的新桶,并在 /acp-cache 输出 「℞ COMPRESS-REASONING ROUND-CLOSE」一节(含 compress.reasoning. drop=false 的关闭方法),网页轨迹图同步新增该颜色桶。进程内首次 观测只做基线(重启后视图已稳定,不误借归因);打点消费一次即失效, 120 秒窗口兜底。
默认时序从"轮次关闭即剥离"改为 flush:"fold":已关闭轮次的 reasoning 在两次折叠之间保持在线(wire 字节稳定),下一次折叠落地时随折叠自身的 重计费区域一并回收;从不折叠的会话由 64KB 待回收量上限兜底(每次越限 一次、账本归因)。compress.reasoning.flush:"close" 保留旧时序(默认关 闭,开启即接受每轮一次接缝,适合本地端点)。restart 语义:applied 集 仅存内存,重启后 reasoning 回到线上(重启重计费已有归因)。
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3933-pr.3311.dbba0beThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3311.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ng is a live i18n key The #3300 change added CAUSE_COLOR.rd / CAUSE_KEY.rd and the prov==='reasoning' cause mapping but never pushed a legendItem() for the new bucket, so the purple segment rendered unlabeled AND the i18n dead-key guard (#1024) failed because t("det.leg_reasoning") was never referenced. Add the swatch mirroring its siblings (color matches CAUSE_COLOR.rd = #8250df).
#3300 adds reasoningDropMisses/reasoningDropMissed to the cache-ledger agg, which persists inside session.metadata, so the digest-based storage-render snapshots drift (only the metadata section hash changes; state/blockContents/ stats unchanged). Regenerate via scripts/update-storage-render-goldens.ts. Additive, zero-default, backward-compatible fields (backfilled on load); no persistence version bump.
Sync master (incl. #3266 image-precompression removal) into the PR branch. Conflict only in tests/golden/storage-render/*.json (both sides regenerated since base): resolved by taking master's fixtures and re-running scripts/update-storage-render-goldens.ts on the merged tree so the snapshots match post-#3266 code plus #3300's two new persisted ledger counters. Verified on this tree: typecheck clean; golden-storage-render + web-i18n + cache-seam-* + cache-ledger suites 81/81 green.
…generation keeps the rows (#3198)
…det.leg_reasoning was a dead i18n key (#3198) The /acp-cache detail page paints the 'rd' cause (#8250df) on the chart and names it in the tooltip, but the unattributed family's sub-legend never rendered a row for it, so the catalog key #3300 added was referenced by no rendered surface (tests/web-i18n.test.ts dead-key gate). Add the conditional row alongside the other seam sub-causes.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——本 PR 是 #3198 处理流中 owner 已批准的第三个交付物(#3196→#3300→本 PR 的 stack,无并列修复项)。但审核中发现的 CI 测试分片红与已有跟踪项重复,不另立 issue:金标漂移 = #3313/#3314(在途修复)、T5 liveness = #3315 子缺陷 2/#3317(在途修复)、AC12 = #3315 子缺陷 3(我补了证据,见下)。 审核做了什么(独立于前两轮 review)
结构化八问
合并判定:代码本身可合(机制正确、测试有牙、配置面合规)。CI 转绿的前置链:先合 #3314 + #3317(+ #3315 子缺陷 3 的 AC12 修复) → 本 stack rebase → 我在本 PR 补金标重生成 commit(仅覆盖 #3300 两个新字段)→ 全绿。stack 内顺序维持 #3196 → #3300 → 本 PR(或直接先合本 PR,GitHub 自动收敛下层 diff)。 |
…uckets (#3198) detailSeam() tolerates servers predating each attribution bucket by defaulting absent fields to zero — #3300's legend row reads seam.reasoningDrop.count without that tolerance, so any payload whose seam lacks the field (test fixtures, older server builds) throws during loadDetail and the trajectory never binds (#2489 brush tests time out in waitFor). Add the missing normalization line; behavior for current server payloads is unchanged.
…the stack merge dropped them (#3198) The merge of master into this branch silently took master's stale storage-render goldens instead of #3300's regeneration (7e5708e), so the digest-based snapshots failed on all four wires even though this tree's persisted state matches #3300's digests exactly (verified by A/B dumpStateTo against merge-base: only metadata.cacheLedger.agg differs, and those two fields are what 7e5708e pinned). Restore the four files verbatim from 4dee7e9; no re-run of the regen script was needed because the digests already agree with this tree.
…uckets (#3198) detailSeam() tolerates servers predating each attribution bucket by defaulting absent fields to zero — the legend row added in 491d52a reads seam.reasoningDrop.count without that tolerance, so any payload whose seam lacks the field (test fixtures, older server builds) throws during loadDetail and the trajectory never binds (#2489 brush tests time out in waitFor). Add the missing normalization line; behavior for current server payloads is unchanged.
(ai: vllm-qwen/qwen3.8-27b) 更正 + 补完我上一条 review 里的 CI 根因表——继续挖之后发现 web-i18n 与 golden 两行其实是同一事件,且验证时暴露了第三个缺陷。已修并推送 2 个 commit(分支头 b71283e → 3b51931)。 真相:stack merge 误丢 #3300 的两个 commit把三个 head 的金标文件逐字节对比后确认:本分支合并 master 时,静默丢掉了 #3300 分支上的两个修复:
第三个缺陷:legend 行本身会炸旧载荷(两个 PR 都有)本地复现发现:补回 legend 行后,#2489 brush 测试反而确定性超时(master 上 3/3 过、本分支 2/3 挂)。根因: 已推送的修复
reasoning 家族 30/30、typecheck 干净。同样的 normalizer 一行也推到了 #3300 分支(97ce469,已在 #3300 留言)——两处重复修同一行,符合「宁可大家都修得一样」。 更新后的合并判定不变且更稳:代码可合;CI 剩余红全部是 master 存量(T5=#3317 在途、AC12=#3315 子缺陷 3 待 bisect、#3313/#3314 金标基线),与本 stack 无关。等 master 侧修复合入后 rebase 即可全绿。 |
|
冲突了 |
|
冲突 |
…ed by regen on the merged tree (#3198)
# Conflicts: # tests/golden/storage-render/anthropic.json # tests/golden/storage-render/chat.json # tests/golden/storage-render/google.json # tests/golden/storage-render/responses.json
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决,push 完成(merge commit 冲突原因:master 在此期间合入了 pi-inline 功能(#3284)并重新基线了 storage-render 黄金快照(#3314,#3295 删掉死 image-stats 字段后重钉 digest);本分支之前也重新生成过同一批快照(为 #3300 的 reasoning-drop 归因桶)。两边都改了 解法:把 master merge 进分支(分支叠在 #3196/#3300 之上,沿用分支既有的 merge-master 模式,不 rebase);4 个黄金文件用官方脚本 结构化八问:
提醒:本 PR 叠在 #3196 → #3300 之上,两者仍 open——建议先合那两个,再合本 PR,顺序上最干净。等 CI 全绿后即可合并(合并动作留给你)。 |
(ai: vllm-qwen/qwen3.8-27b) 这条「冲突了」是上一轮冲突事件的重复转发——原冲突(4 个 storage-render 黄金文件)已在
分支现在与 master 尖端完全同步,等 CI 全绿即可合并(合并留给你;叠在下面的 #3196/#3300 仍建议先合)。 |
…ution' into 2026-10-16_reasoning-flush-fold
… into 2026-10-16_reasoning-flush-fold
…; flush docs kept; goldens regen)
(ai: vllm-qwen/qwen3.8-27b) 冲突已再次解决,push 完成( 这一轮的情况和上两轮不同:master 在前次解决后前进了约 30 个提交——#3196(栈底)已合入,另有 #3298/#3305(CI 三层流水线)/#3308/#3309(remove-absorb)/#3318 等。同时另一位 worker 已在本分支上做了大部分工作:把 #3300 的内容直接并进本分支(commit 结构化八问:
栈状态更新:#3196 ✅ 已合入 master;#3300 的内容已被本分支完整吸收(其头部新提交只是「merge master + 重生成黄金」,无独有内容)——#3311 合入后 #3300 可直接关闭为已吸收(关闭动作留给你);本 PR 现在与 master 尖端完全同步,等 CI 绿即可合并。 |
(ai: zhipuai-lb/glm-5.3)
坏了什么
长会话里每完成一轮压缩工具调用,下一轮请求就会少一段思考内容(#651 机制)。这是对历史消息字节的修改:上游前缀缓存从修改点开始全部失效——每轮关闭一次、每次几千到上万 token 重新计费(实测样本:99%→91%,3.3K 重付;#3198 报告里 13–17K 的样本同源)。账本之前把它记成"未知缓存接缝",正是 #3198 的恐慌来源。
根因
drop 的时机:轮次一关闭就立刻把该轮 reasoning 从请求里删掉。几十上百轮的会话,每轮一次 mid-history 重写 = 每轮一次缓存 miss。
修法(flush:"fold" 默认)
compress.reasoning.flush:"close"保留旧时序(默认关闭;开启即接受每轮一次接缝,适合本地无所谓 miss 的端点);依赖(stack,合并顺序)
#3196(签名 thinking 闸门修复,作者 @sorinirimies 的 3 个 commit 原样保留)→ #3300(账本归因)→ 本 PR。下层合并后 GitHub 会自动收敛本 PR 的 diff。
config surface
新增
compress.reasoning.flush:"fold" | "close",默认"fold";CONFIGURATION.md / CONFIGURATION.zh-CN.md 已同步(en+zh)。既有配置无需迁移(缺省即新默认)。方案在 #3198 处理过程中由 owner 批准(2026-10-16)。kernel-change
无(全部在 src/ 与文档;不触 kernel/)。
证据