Skip to content

[Root Cause] compress-gate (2 items) #7315

Open

Description

@ranxianglei

同一根本原因(compress-gate)的 open issue 汇聚,由根因归类板自动维护(10min 刷新,勿手编)。

Members (2)

Task

对本批 issue 做一个根本性修复 PR:

  • PR 描述里用 Fixes #... 逐个列出上面每一个 GitHub issue 号(没有 GitHub 号的写镜像号)
  • 若某个 issue 已有自己的 PR 且方向一致,cherry-pick 其 commit 并保留原作者署名(-x);由你判断是否值得
  • PR 必须打标签:root-cause(固定,来自根因汇聚单)+ 按本 PR 的 diff 独立判断的类别和优先级标签(最高优先用 p1),不要抄任何来源 issue
  • PR 描述末尾必须加标记行 <!-- rcagg:compress-gate -->(汇聚板靠它自动识别根因 PR 补标签/插队;即使修复拆成多个子单各自提 PR,每个 PR 都要带这行)
  • 回帖本线程必须是最终裁决,结尾固定用中文 8问 清单逐行回答:1 这是啥问题(大白话+触发条件)2 根本原因是啥(组件+机制)3 如何修复(已做的修复或建议修法)4 能否合并/关闭(结论+依据:测试/CI/回归分析)5 URL(相关线程/PR 链接)6 影响面(哪些代码路径/用户)7 测试(什么钉住它)8 风险(还可能坏在哪)。答不实的行写「待验证:原因」,不许漏行

Activity

  1. ranxianglei commented on Nov 19, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷

    根因修复 PR 已开:#7326(root-cause: compress-gate,覆盖 #7197 + #7300,已打标签 root-cause/bug/p2/scope/kernel)。

    做了什么

    测试:新增 tests/issue7300-compress-loop-trivial.test.ts(双向钉死:琐碎成功不清零 / 实质成功清零 / 单独琐碎成功是 no-op);更新 3 处引用旧文案的既有断言(issue2432、issue4812)。breaker/gate 套件 37 测全绿,typecheck 干净。

    待 owner 拍板(不阻塞本 PR):更深的止血是「硬调用预算」(如 120s 内最多 2 次 compress 调用),无论熔断器是否触发都封顶 token 消耗。这是产品/设计取舍(多激进),本 PR 未实现,留待你决定要不要单开。


    8问

    1. 这是啥问题:压缩熔断器该触发时不触发——模型在「失败×N → 一次几乎不省 token 的琐碎成功 → 失败×N」循环里无限试探、烧 token(事故:bili 0.1.216 一次会话 398 次 compress 调用,289 次 too-small 失败,92 次琐碎成功净省仅 86–290 token)。触发条件:会话里既有太多小消息(too-small 失败)又有刚过最小线的 range(琐碎成功)。
    2. 根本原因是啥:src/stream.ts:354 的 clearCompressLoopStreak 对任何成功都清零连击,且判据用 r.tokensCompressed(折叠总质量,kernel/src/compress.ts:863 从不减新 summary)而非净省——琐碎折叠读成 ~1250 被误判为「压缩在工作」,连击永远到不了 3。[Bug][dsh] Circuit breaker armed by compress.requireRecommendation range misses: receipt forbids the only recovery the code still allows | 范围猜错三次即武装熔断,而熔断文案禁止了代码仍允许的自救动作 #7197 侧:scope gate 把范围正确性拒单错记到会话级熔断器,且熔断器文案禁止了代码唯一允许的恢复路径(acp_status + 范围内重试)。
    3. 如何修复:① scope gate 只记 spec 重复账本、不记会话熔断器(cherry-pick [PR] fix: scope-gate (requireRecommendation) refusals no longer arm the compress breaker (#7197) #7209);② 熔断器清零改判净省 ≥ 500 token,琐碎折叠不清零。
    4. 能否合并/关闭:可合并。依据:breaker/gate 套件 37 测全绿、typecheck 干净、CI 待跑(PR 刚开,镜像缓存暂无);回归分析——熔断器原有行为(3 连击触发、10 分钟衰减、substrate-destruction 分支、preflight lane 不记账)全部保留,仅把「清零条件」从「任意成功」收紧为「净省≥500 的成功」,属有意变更且已披露。[Bug][dsh] Circuit breaker armed by compress.requireRecommendation range misses: receipt forbids the only recovery the code still allows | 范围猜错三次即武装熔断,而熔断文案禁止了代码仍允许的自救动作 #7197/billion-context 0.1.216 — compress no-op: symptoms, root cause, and proposed patch | billion-context 0.1.216 — compress 空转:现象、根因、可提的补丁 #7300 待本 PR 合并后由 owner 关闭。
    5. URL:PR [PR] fix: only a substantial fold disarms the compress-loop breaker (root-cause: compress-gate — #7197 + #7300) #7326;成员 issue [Bug][dsh] Circuit breaker armed by compress.requireRecommendation range misses: receipt forbids the only recovery the code still allows | 范围猜错三次即武装熔断,而熔断文案禁止了代码仍允许的自救动作 #7197、billion-context 0.1.216 — compress no-op: symptoms, root cause, and proposed patch | billion-context 0.1.216 — compress 空转:现象、根因、可提的补丁 #7300;被收编的单 issue PR [PR] fix: scope-gate (requireRecommendation) refusals no longer arm the compress breaker (#7197) #7209(本 PR 合并后可关)。
    6. 影响面:src/stream.ts(熔断器清零逻辑 + 3 处模型可见文案)、src/acp-status.ts(armed 提示文案)。影响所有走 compress 熔断器的会话(plugin + proxy 两模式);模型在 armed 状态下读到的解除条件文案变了。
    7. 测试:tests/issue7300-compress-loop-trivial.test.ts(双向)+ 既有 issue2146/issue6728/issue4812/issue2432/compress-refused-ledger-align 套件钉住熔断器行为与文案。
    8. 风险:① 500 token 是拍的值(高于事故最大琐碎省 290、低于真实折叠),若某模型/场景的真实小折叠净省 < 500 会被误判为琐碎——后果只是熔断器多转几圈,10 分钟静默仍会衰减,不会死锁;② 文案变更是 prompt surface,模型对「实质性成功」新措辞的响应需观察(已按消费链推理:「≥500 token」是解除条件不是调用参数,模型不会把它当锚点带进下次调用,风险低);③ [PR] fix: scope-gate (requireRecommendation) refusals no longer arm the compress breaker (#7197) #7209 与本 PR 重叠,若 [PR] fix: scope-gate (requireRecommendation) refusals no longer arm the compress breaker (#7197) #7209 先合并本 PR 需 rebase。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions