Skip to content

[PR] fix: armed compress circuit breaker now enforces itself on parse-failure receipts (#4812) - #4815

Merged
ranxianglei merged 7 commits into
masterfrom
2026-10-26_compress-breaker-enforcement
Oct 26, 2026
Merged

ranxianglei merged 7 commits into
masterfrom
2026-10-26_compress-breaker-enforcement

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Closes #4812

是什么问题

#4812 现场:模型连续 6 次发出同一个格式错误的 compress 调用,每次都被完整复读一遍 ~2K token 的格式教学(加 repeat-failure guard、第 3 次起再加熔断段落),共烧掉 ~12K 上下文且全部被忽略——刷屏。

根因:熔断器(#2146)只有建议权、没有执行权。src/stream.ts applyRanges 的零解析范围分支里,每次失败都会重跑完整解析并重新发出全部三段教学;熔断只把措辞从「第 N 次」升级,从不拦截。断路器升档了语气,却从未强制过任何东西。

怎么修的

在 applyRanges 的 ranges.length === 0 分支(仅模型可见车道,trackLoop=true)加一个短路:熔断计数自增后若 n > 阈值(3),三个教学变体(isEmptyCall / argCorruption / 主教学)统一折叠成一条 ~60 token 的拒收回执(armedRefusalReceipt,自包含:拒收原因 + 一行格式提醒 + 解除条件),不再复读全文。服务端日志保留一行折叠记录,运维可见性不变。

不变量(逐条守):

行为变更披露(旧→新)

场景 旧 新
第 1–3 次解析失败 全文教学(+guard,+段落) 不变
第 4+ 次解析失败(熔断已武装) 再发一遍 ~2K 全文教学 + guard + 段落 ~60 token [Compression refused: … still armed (N consecutive failures) …]
熔断武装期间的合法调用 正常执行 不变(永不拦截)
preflight 内部调用 全文教学 不变

理由:全文教学是「初见教学」,前 3 次已经给足;第 4 次起复读只是烧上下文(现场证据:6 次全被忽略)。短回执保留最小可行动信息(格式提醒 + 解除条件),让循环模型有事可做而不是收到一堵重复的墙。

验证

  • 本地:typecheck clean;定向套件 35/35 绿(新增 tests/issue4812-armed-breaker-short-receipt.test.ts 6 例:风暴折叠、武装期合法调用成功、preflight 车道不受影响、decay 重启、substrate cause 种子、空/损坏参数变体;外加 issue2146/847/2360/2432/3126 五个既有熔断守卫全套回归);
  • 全量判定以推送 head 上的 CI lane 为准(本地不跑全量)。

其他

kernel-change 声明

kernel-change: 仅 lockfile 元数据同步——本 diff 里 kernel/package-lock.json 的行来自 origin/ci-fixes merge(#4599 哨兵收敛, commit dfadc21, 记录 acp-kernel 版本 0.0.164→0.0.165);kernel/src/** 零改动、未动 kernel/tsup.config.ts 与 tsconfig.json、无版本 bump。

ci-check added 3 commits October 26, 2026 15:22
master window commits 293ae65/de5e03659 bumped kernel/package.json to
0.0.165 without regenerating the lockfiles; lock-sync re-resolution then
rewrites the stale recorded versions (root 0.0.163, kernel 0.0.164) and
fails. Pure recorded-version sync via npm install --package-lock-only;
no dependency or semantic change.
@ranxianglei ranxianglei changed the title fix: armed compress circuit breaker now enforces itself on parse-failure receipts (#4812) [PR] fix: armed compress circuit breaker now enforces itself on parse-failure receipts (#4812) Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-26_compress-breaker-enforcement (a90c5be)

Latest build — install this exact version

npm install -g billion-context@0.0.6262-pr.4815.a1b7d90

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
a90c5be billion-context@0.0.6262-pr.4815.a1b7d90 build
369e147 billion-context@0.0.6219-pr.4815.d0e1ff9 build
5ee64ad billion-context@0.0.6181-pr.4815.89bd8f2 build
ef3376f billion-context@0.0.6133-pr.4815.d0900c5 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4815.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重: 不重复。 按失败签名(熔断武装 + 解析失败回执复读)检索 open+closed:#847(同规格重复守卫)、#2146(连败熔断器)、#2360(回执矛盾指令清理)、#2432(substrate 恢复段落)、#3126(forcedCause)均为已合入的相邻防线,无一覆盖「熔断只有建议权没有执行权」这个缺口;#4812 是该缺口的唯一在案条目,本 PR 正确收口它。

标签: bug, scope/wiring, p2(缺陷;修复点在代理请求管道的失败回执路径 src/stream.ts;能用但明显伤体验——上下文持续燃烧+刷屏,有绕行不丢数据)。

独立代码审核结论(我重新读了 PR head 的 diff 与周边代码,未照抄 issue 侧分析):

结构化八问:

  1. 是什么问题:模型陷入「同一个格式错误的 compress 调用」循环时,bili 每次失败都把 ~2K token 的完整格式教学 + 重复守卫 + 熔断段落整段重播(Error: [Compression FAILED: no valid ranges parsed (kind=content-not-array, dropped=1).刷屏 #4812 现场 6 次 ≈ 12K 全被忽略)——刷屏+烧上下文。
  2. 什么原因导致的:熔断器(dsh内部问题 出现这个错误后,重启dsh可以发消息 但陷入无限压缩失败 #2146)在设计上只有建议权:noteCompressLoopFailure 只返回要嵌入回执的段落文本,三个解析失败分支(isEmptyCall / argCorruption / 主教学)无条件重建全文,没有任何执行点做拦截或折叠。断路器升了语气,从未强制过任何东西。
  3. 影响范围与严重程度:所有模型可见车道(proxy + plugin host)。触发条件 = 模型对坏调用连败且计数越过武装阈值。严重度 = 上下文/成本持续燃烧 + 刷屏体验;会话仍可用、无数据丢失 → p2。
  4. 怎么修复的:在 applyRanges 零解析范围分支里、三个变体 return 之前加短路(src/stream.ts:915-919):计数照旧自增后,若 n > 阈值(3),统一返回一条 ~60 token 自包含短拒收(拒收原因 + 一行格式提醒 + 解除条件);服务端日志保留一行折叠记录。
  5. 是否有回归问题(逐项核实,均对照改动前代码):
    • 武装当刻(n==3)回执字节级不变 ✓ —— 短路条件是 n > COMPRESS_LOOP_THRESHOLD,n==3 走原路径,verbatim 段落原样嵌入;
    • 三个教学变体统一折叠 ✓ —— 短路点位于三个 return 之上,isEmptyCall/argCorruption/主教学全部覆盖;
    • preflight 内部车道不动 ✓ —— src/preflight.ts:1992/:2369 传 loopTracking:false → trackLoop=false → 短路永不触发,且不武装熔断;模型侧各调用点不传 opts、默认 true,不受影响;
    • 能解析成功的调用永远不拦 ✓ —— 短路只在 ranges.length===0 分支内,[bug] DSH 桌面端 0.1.188:宿主原生压缩落地摧毁折叠基底 → 同一区间永久不可锚定、compress 连片失败并熔断(compaction-basic auto:false 仍无效) #2432 substrate 恢复路径(acp_status 一次 → 压一个活范围)参数合法、直接绕开该分支,成功即清熔断;
    • 计数/衰减语义不变 ✓ —— recordCompressFailure/noteCompressLoopFailure 在检查前照跑,连击期间 lastAt 持续刷新(测试钉了「锤击不能熬过 decay」);
    • 一处需披露的细微语义:streak 带 substrate-destruction cause 时,第 4+ 次解析失败回执会失去「run acp_status once」恢复句(折叠成通用拒收)。可接受:恢复步骤本来就要求一次合法调用,模型一旦发出合法调用,cause 专属指导会在 kernel 失败路径(不被本 PR 折叠)重新出现;且短回执刻意不提 acp_status 是 bili 插件模式下 allowDshCompaction 在 responses 线路上完全失效 —— DSH 原生压缩落地、折叠基底被摧毁、compress 连片失败 #2360 实测过的决定(一条回执两条矛盾指令 = 零遵守)。
    • 本地:typecheck clean;新增套件 6/6 绿;五个既有熔断守卫套件 41/42——唯一失败是 master 既有的断言漂移(见下「CI 状态」),非本 PR 引入。
  6. 是否破坏缓存:不涉及——不改缓存键、重试、游标、去重,只改失败回执文本长度。
  7. 是否改了设计方向:没有。仍是 dsh内部问题 出现这个错误后,重启dsh可以发消息 但陷入无限压缩失败 #2146「连续失败熔断」同一机制,本 PR 把建议补成执行。
  8. 是否引入新配置:没有。无新 env/config/默认值。

行为变更披露(旧→新):第 4+ 次解析失败回执,旧 = 再发一遍 ~2K 全文教学 + guard + 熔断段落;新 = ~60 token [Compression refused: … still armed (N consecutive failures) …]。前 3 次、武装期间合法调用、preflight 车道均不变。理由:全文教学是初见教学,现场证据显示第 4 次起复读零收益(#4812:6 次全被忽略)。

CI 状态与我做的动作:

判定: 代码层面 ready-to-merge——等 5ee64ad 的 CI 矩阵转绿(若某个 test 分片红,预期签名就是上面那条继承性 issue847 断言漂移,其余需另查)。合并由 owner 操作。

@ranxianglei ranxianglei added bug Something isn't working p2 scope/wiring labels Oct 26, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

CI 更新(head 5ee64ad):补声明 + 重触发后 kernel-guard 已转绿 ✓,static-gates、fast guards 全绿。3 个红的 test 分片(windows-22 shards 1/4/5)已逐条核对失败日志:共 5 个失败测试(#847 sub-gate、#1492 B、#4125 send-failed、storage-engine-proofs ×2 wire、storage-render golden ×2 wire),全部在干净 master cdac1c0 本地逐字复现——均为既有 born-red,零 PR 引入的失败;签名清单已汇总报 #4599 集群 triage(其中两个 storage golden 疑似同一机制家族)。

判定维持:代码层面 ready-to-merge;矩阵全绿要等这批继承红在 ci-fixes 收敛。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 红了(10 个 test 分片),判定为继承性失败——master 自身既有的 born-red 测试集群,非本 PR 代码问题。已按 CI 协调政策(owner policy 2026-10-24)merge ci-fixes 并推送,不在自己分支重复修 master 级失败。

八问

  1. 是什么问题:本 PR([PR] fix: armed compress circuit breaker now enforces itself on parse-failure receipts (#4812) #4815,熔断武装后对 parse-failure receipt 自我强制)的 CI 有 10 个 test 分片全红。逐条核对失败签名后确认:全部是 master 自身既有的 born-red 用例,与本 PR 改动无关。

  2. 什么原因导致的:master tip cdac1c099 上有一批长期潜伏、此前被 LIVE_FILES tripwire 掩盖的 born-red 用例,现在真正跑起来显形。本 PR 的 diff 只动了 src/stream.ts(熔断武装后把重复 parse-failure 讲义折叠成一行短拒收)+ 新增一个回归测试文件,与下列任何失败文件零交集。这些红在不含本 PR 改动的干净 master 上逐字复现(前一轮审核已在本地复核,零 PR 引入)。

  3. 影响范围与严重程度:仅 CI 信号面(所有 rebase 过 master 的 PR 都继承同一批红),无用户侧功能影响。本 PR 自身车道(kernel-guard 补声明后、static-gates、fast guards、新增回归套件)全绿,唯一阻塞是继承红。失败签名清单(5 个唯一用例,跨 ubuntu/windows × node22/24):

    • tests/issue847-compress-failure-guards.test.ts「preflight reports honest exhaustion when every listed range is sub-gate」— 断言漂移(preflight 措辞变更、期望落后);
    • tests/issue1492-stale-estimate-view.test.ts:218「usage-sourced high baseline must STILL fire preflight」— expected true / actual false;
    • tests/issue4125-giveup-reason.test.ts:213「send failure fires give-up with 'send-failed'」— give-up reason 字符串 diff;
    • tests/storage-engine-proofs.test.ts:152「full-mode restart invisible on {chat,google} wire」;
    • tests/golden-storage-render.test.ts:41「storage-render golden {chat,google}」(后两条疑似同一 storage 渲染 golden 漂移家族)。
  4. 怎么修复的:继承红的处置 = git merge origin/ci-fixes 进本分支并推送。本次 merge 只带入 ci-fixes 顶部的空 re-trigger commit(1eb592a1e),代码 diff 为空(lockfile 同步 dfadc21b3 本分支早已包含)。新 head 369e1475c,CI 重跑中。

  5. 是否有回归问题:无。本 PR 自身改动审过——arm-moment receipt(n==threshold)保持逐字不变;parsing-valid 调用永不被拦;preflight 车道经 trackLoop 门未触及;[bug] DSH 桌面端 0.1.188:宿主原生压缩落地摧毁折叠基底 → 同一区间永久不可锚定、compress 连片失败并熔断(compaction-basic auto:false 仍无效) #2432 的 acp_status 恢复步仍可通过。merge 进来的只有空 commit,零行为变化。重要披露:ci-fixes 目前尚未包含上面那批 born-red 的修复(哨兵仍在收敛,convergence PR [PR] ci: converge master-CI fixes (persist restamp guard + lockfile version sync) (#4599) #4814 待 owner 合并),所以新 head 重跑仍会红在这些同一批用例上——这不是本 PR 的缺陷,是 master 侧待收敛项。

  6. 是否破坏缓存:不涉及。

  7. 是否改了设计方向:不涉及(CI 协调动作,无架构/数据流转向)。

  8. 是否引入新配置:不涉及。

结论:本 PR 代码干净、自身车道全绿,CI 红 = 纯继承。已按协议 merge ci-fixes 推送(head 369e1475c)。转绿的唯一闸门是 master 侧 born-red 集群收敛(哨兵 → ci-fixes)+ owner 合并 convergence PR #4814;落地后本分支一次 rebase/merge 即全绿,无需本 PR 再夹带任何修复。已在 #4599 留状态行。

…-breaker-enforcement

# Conflicts:
#	kernel/package-lock.json
#	package-lock.json
@ranxianglei
ranxianglei merged commit 05c379e into master Oct 26, 2026
49 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.855-master.05c379e (rolling master tag).

npm install -g billion-context@0.0.855-master.05c379e  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: [Compression FAILED: no valid ranges parsed (kind=content-not-array, dropped=1).刷屏

1 participant