Repository navigation
[PR] fix(#2778): derive compress-failure recovery hints from live eligibility - #2794
ranxianglei wants to merge 1 commit into
Conversation
Failure receipts advertised an arithmetic span (highest-ref minus block boundary) that ignored protection, coverage and min size, so 'Retry NOW' pointed at a range the apply-side gate deterministically refuses, turning one refused call into a self-amplifying retry loop. Share the live eligibility source with acp_status: liveNudgeDecision runs processTurn read-only with the same args acp_status uses; submitGatedRanges factors out the viability+minCompressRange submit gate both surfaces apply. liveSpanHint offers only ranges that clear those gates, else falls through to block distillation (>=2 active blocks) or an honest stop; unavailable status degrades to 'run acp_status'. Receipts stay single-line; repeat guards, cause breakers and success-tail offers are untouched. No kernel/config/wire changes.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3068-pr.2794.881db15This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2794.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR #2794 review — 可合(待 owner 合并) 审前状态核对:head ① 是什么问题:压缩失败回执里的恢复提示是纯算术值(最高 ref − 最高活跃块边界 − dead refs),对保护区/已覆盖前缀/minCompressRange 完全无感知,于是 "Retry NOW" 指向一个 apply-side gate 必然拒绝的范围——模型照做再被拒,单次失败放大成自我强化的重试环(#2778,0.1.192 实测复现)。 ② 什么原因导致的:失败路径自己算了一个与 ③ 影响范围与严重程度:所有走 proxy/plugin 压缩路径、且触发过 compress 失败的会话;触发条件=保护尾/已折叠前缀/低于最小范围时失败(即最常见的三类拒绝)。严重度:不丢数据、不坏协议,但把一次本可终止的失败变成多轮空转重试,浪费 token 并可能顶到 circuit breaker——特定条件下有实质问题的体验+成本缺陷。 ④ 怎么修复的:消灭第二源,不做文案补丁。 ⑤ 是否有回归问题(逐项清点 diff 触碰路径的既有行为):
⑥ 是否破坏缓存:不涉及。无缓存/重试策略/增量游标/去重键改动;回执文本变化不影响 prefix-cache 语义(工具结果文本本就不参与上游前缀缓存键的既有约定)。 ⑦ 是否改了设计方向:不涉及架构转向;方向收敛——"可压范围"从双源变单源(两表面共享同一 live eligibility),这是向既有设计意图(acp_status 是唯一权威表面,#2451)的回摆,不是新方向。 ⑧ 是否引入了新的配置:不涉及。无新 env/config/默认值;config-surface-guard CI 绿佐证。 测试有效性(质量关):重写后的 9 个用例断言有牙——核心回归用例精确编码 #2778 复现(defaultConfig 保护尾 → 断言不含 "Retry NOW"/"Live compressible refs right now"、含诚实停止句),负向断言钉死旧 bug 措辞不再出现,单行约束逐例检查;全部走真实 kernel core( diff 整洁度:3 文件全部与本 PR 目的直接相关,无跑题文件、无锁文件连带、无空白重排;测试文件整体重写属范围内(钉住新契约)。干净。 结论:可合。方向正确(修根因不堵症状)、回归清单逐项过完无意破坏、测试有牙且本地+CI 双层绿。唯一留给人工的一点:模型可见失败回执文本变更属 flagged behavior change,按仓库纪律该由 owner 拍板合并——请自行合并:#2794 |
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):目标 issue #2778 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
[bot] 🏷 核对完毕:关闭判断成立,不予 reopen。 查证过程与证据:
因此本 PR 在关闭时已是"修复已上线后的冗余并行实现",reopen 只会制造重复劳动——与清理意图一致。两套实现机制收敛一致(共享 live 资格、不削弱保护窗、保留单行回执与守卫),本 PR 此前的代码审核结论对 diff 本身仍然有效,可视为对已合入方向的独立佐证。 更正一条:我今日早些时候的 review 回复中"head 恰为当前 master 之上 1 个提交、无需 rebase"一句基于一个陈旧本地引用( |
Problem
Compression-failure receipts advertised an arithmetic span — highest message ref minus the highest active-block boundary, minus dead refs — as "Live compressible refs … Retry NOW". That arithmetic had no view of protection, coverage or size, so it could name a range the apply-side gate deterministically refuses: a fully-protected tail, an already-covered prefix, or a sub-
minCompressRangerange. A model following the hint hit another refusal and repeated the work — a self-amplifying retry loop.Repro on 0.1.192: with the newest refs protected and earlier refs already folded, the receipt said
Live compressible refs: m00021–m00080 … Retry NOW, while liveacp_statusreported no eligible range and attemptingm00021–m00080through the real gate returnedrefused: Range is entirely within the protected zone.Fix
Share the live eligibility calculation with
acp_statusinstead of computing a second, divergent number in the failure path:liveNudgeDecision(src)(src/stream.ts) runsprocessTurnread-only with the exact argsacp_statususes; the result is never adopted (the receipt must not mutate session state as a side effect of reporting failure).submitGatedRanges(config, nudge)factors out the submit gate both surfaces apply — the viability floor (≥200 tokens) and the apply-sideminCompressRangechar count.liveSpanHint(ctx)offers only ranges that clear those gates; when nothing raw is eligible it falls through to block distillation (≥2 active blocks, by real id) or an honest stop ("continue the task"), and degrades to "run acp_status" when status is unavailable. Never a fabricated span.src/acp-status.tsnow calls the same two helpers, so the two surfaces can no longer disagree. Its output stays byte-identical (existing acp_status suite green).Preserved untouched: single-line receipt visibility (#1029), the repeat guards, the cause-aware circuit breakers, and the success-tail offers. No kernel, config, persistence, or wire-shape changes.
Behavior change (flagged)
Model-visible failure-receipt text changes. Where the old code could say "Live compressible refs: m00021–m00080 … Retry NOW" for a range the gate would refuse, the new code either names genuinely-eligible ranges (matching
acp_status) or tells the model to continue / inspect blocks / runacp_status. This is the intended fix — the old wording was the bug.acp_statusoutput itself is unchanged.Tests
tests/compress-span-hint.test.tsrewritten to pin the new contract: protected tail (core regression), eligible-range offer, ≥2-block distillation by real id, dead/absent refs never named as targets, sub-minimum conversation, unavailable status, decompressed-block release, and both failure receipts carrying the live hint single-line. Targeted suites green (span-hint 9/9, acp_status 8/8); typecheck + build clean on rebased master (v0.1.192). Full regression left to CI.Closes #2778