Skip to content

[PR] fix: compression merge deadlock — auto-consolidate or explicitly notify when turns are split across multiple blocks (fix | fix: 压缩合并死锁——回合被拆散在多个块里时自动收拢或明确告知(修复 #5919) - #5929

Merged
ranxianglei merged 3 commits into
masterfrom
2026-11-08_5898-review-p2-fixes
Nov 8, 2026

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

kernel-change: 修复 v0.1.213 回归 #5919——一个回合的推理/调用/结果被拆在不同压缩块里时,合并压缩永久死锁(报错建议不可执行、或静默空转)。owner 已在 #5919 讨论中确认修复方向(2026-11-08)。

现象

长会话里一个回合被"撕裂"在多个块中(推理被旧的 tier-2 块覆盖、调用被待合并的块覆盖、结果还可见或受保护)时,合并压缩永远失败:

  • 报错版:报 "cannot satisfy turn integrity",并承诺这些散落的伙伴消息"等老化进覆盖就能压"——但被块覆盖的调用,它的结果消息按完整性约束(方向性不变量)永远不能单独压,承诺不会兑现,模型每次重试都同样失败(用户会话 session-ad47cd30 卡死,水位 52% 压不动)。
  • 静默版:排除重试"成功"但一个消息都没折(区间的调用侧边界被自动裁剪到块外),合并永远空转,冲突原样保留。

根因

kernel/src/unit-projection.ts 的 #5789 合并恢复阶梯只有一级:把"切穿回合组"的块排除后重试。重试只有两种结局——真折到内容(成功)或报错。而撕裂形状下:

  1. 报错路径的 actionableSplitError 给出的解法("先普通压缩散落的可见伙伴消息")对被块覆盖的调用来说不可执行——它的结果单独压会被完整性门撤掉;
  2. 重试"成功"的路径可能什么都没折(几何裁剪 + 全部已覆盖),等于假成功,死锁无声延续。

修复(都在合并卡住的 else 分支)

  1. 判死:散落的可见伙伴里有任何一条永远压不动(BLOCKED / 最近保护区 / 受保护工具 / 不可恢复媒体)→ 合并改为幂等空操作(所有块保持 active,不丢任何已有覆盖,[Bug] Merging stale compressed blocks retracts existing coverage, causing repeated coverage-regression rejections | [Bug] 合并旧压缩块时撤回既有覆盖,导致 coverage-regression 反复拒绝 #4484 不变量不破),警告明确说明哪条被保护、"不要重试这个合并"。
  2. 第二级(自动收拢):伙伴全部可压、且第一级没完成合并(重试报错,或"成功"但没折到任何内容)时,把折叠自动扩展到这些散落伙伴(≤16 条;定点重判完整性必须干净才提交)——新块覆盖整个回合,冲突清除,合并继续。这正是旧报错让模型手工做的那一步。
  3. 报错信息:保留 "cannot satisfy turn integrity" 短语(宿主与 [Bug] Merging stale compressed blocks retracts existing coverage, causing repeated coverage-regression rejections | [Bug] 合并旧压缩块时撤回既有覆盖,导致 coverage-regression 反复拒绝 #4484 套件依赖),但改为给出精确解锁区间(普通压缩 mNNNNN..mMMMMM 后重试即可),删掉虚假的"老化进覆盖"承诺。
  4. compress.ts:空操作路径现在透传投影层的跳过警告(指导语能到达模型)。

行为变化(两个既有 pin 被修正)

这两个 pin 锁定的正是 #5919 的死锁行为本身,按 #5919 的修复方向修正。

验证

  • 新增 kernel/tests/issue5919-shredded-merge.test.ts(4 形状:可压伙伴自动收拢 / BLOCKED 空操作 / 受保护工具空操作 / 区间内伙伴不受影响);
  • kernel 全套 1613/1613 通过;root typecheck 干净;
  • kernel 版本 0.0.187 → 0.0.188。

说明

问题1(968 条不可见消息)是独立问题,已在 #5919 向报告者索要诊断数据,另行处理。

…ners or no-op with exact guidance (#5919)

v0.1.213 regression (issue #5919, session-ad47cd30): when a turn group is
shredded across blocks — reasoning covered by a surviving higher-tier block,
call covered by the block being merged, result still visible (or protected /
BLOCKED) — the #5789 exclusion ladder had no rung left:

  * fatal path: the error promised the partners would "age into coverage",
    which never happens for a covered call's result (INV2: a lone result can
    never fold) — every retry of the advertised merge re-failed identically.
  * silent path: the exclusion retry "succeeded" by folding nothing (the
    span's geometry trims the call whose result sits outside), so the merge
    no-oped forever with the conflict still live.

Fix (unit-projection.ts, merge stuck-branch):
  1. Doomed check — if any stranded visible partner can NEVER fold (BLOCKED,
     recent-zone, protected tool, unrecoverable media), the merge is an
     idempotent no-op success (every block stays active — the #4484
     never-drop-coverage invariant holds) with guidance that says exactly
     what is protected and that retrying will not help.
  2. Rung 2 — when rung 1 (the exclusion ladder) cannot complete the merge
     (retry fatal, or retry folded nothing) and every stranded partner is
     foldable, the fold extends itself to those partners (bounded: <=16,
     fixed-point integrity re-judge must come back clean): the new block's
     coverage closes the turn, the conflict clears, and the merge proceeds.
     This is the exact manual unblock the old error text directed, now done
     automatically.
  3. actionableSplitError keeps the "cannot satisfy turn integrity" phrase
     but names the exact unblock range (plain compress over
     mNNNNN..mMMMMM, then retry) and drops the false "age into coverage"
     promise.

compress.ts: the filteredIds=0/consumed=0 no-op now propagates the
projection's warning (the skip guidance reaches the model) instead of
replacing it.

Pinned: kernel/tests/issue5919-shredded-merge.test.ts (4 shapes: extend,
BLOCKED no-op, protected-tool no-op, in-span control). Two #5789/#4484 pins
amended — they pinned the pre-fix dead-end itself (b4..b4 self-range no-op,
b2..b2 "impossible merge" refusal); both now pin the recovery, and the
breaker-safety property (a retry never errors) is asserted explicitly.
Full kernel suite: 1619/1619.
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-08_5898-review-p2-fixes (de1c71c)

Latest build — install this exact version

npm install -g billion-context@0.0.8597-pr.5929.da7df9f

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
de1c71c billion-context@0.0.8597-pr.5929.da7df9f build
ae5c9a5 billion-context@0.0.8595-pr.5929.c26a28f build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: 压缩合并死锁——回合被拆散在多个块里时自动收拢或明确告知(修复 #5919) [PR] fix: compression merge deadlock — auto-consolidate or explicitly notify when turns are split across multiple blocks (fix | fix: 压缩合并死锁——回合被拆散在多个块里时自动收拢或明确告知(修复 #5919) Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI fix run 1/3 — lock-sync repaired. Verified live first: on head ae5c9a5224 the only failing check was lock-sync. Root cause: commit ae5c9a5224 (kernel version bump to 0.0.188) updated kernel/package.json but never regenerated the root package-lock.json, which still recorded the file:./kernel link as acp-kernel 0.0.187 — exactly the #2704 drift class the job guards ("bumping package.json does NOT regenerate the lock"). Fix: ran the job's own two commands (npm install --package-lock-only at root and in kernel/), committed the resulting one-line root-lockfile correction as de1c71ca2f (chore: sync root package-lock.json with kernel 0.0.188 bump (#5919)), and pushed to the PR branch (pre-push fetch confirmed remote head unchanged; no force-push). Re-verified live after push: on new head de1c71ca2f lock-sync = success and all guard jobs green with zero failures (mirror cache was stale mid-wait, so final state confirmed by a single one-shot check-run read, per policy). No design decisions needed; nothing else touched.

结构化八问

  1. 是什么问题:PR 的 lock-sync CI 任务红——根 package-lock.json 与 kernel/package.json 的版本记录不一致(锁文件里 acp-kernel 还是 0.0.187,而 PR 已把内核版本 bump 到 0.0.188)。
  2. 什么原因导致的:bump 版本号本身不会重新生成 lockfile,只有跑 npm install 才会(package-lock.json version metadata lags package.json (bili 0.1.190 vs 0.1.191, kernel 0.0.112 vs 0.0.114) #2704 漂移类);作者在内核版本提交里只改了 kernel/package.json,漏了根锁文件的再生成步骤。
  3. 影响范围与严重程度:仅本 PR 的合并门禁(CI 红挡合并),无任何用户面/运行时影响;属机械性门禁失败。
  4. 怎么修复的:在 PR 分支本地执行与 CI 完全相同的两条再生成命令,提交唯一一行根锁文件修正(de1c71c),按推送纪律(fetch 远端头、无并发改动)推回原分支;kernel/ 自己的锁文件经同样命令验证无漂移,未动。
  5. 是否有回归问题:无——纯生成物单行同步,未触碰任何源码、配置面、wire 形状或默认值;高危模式逐项过无语义漂移。
  6. 是否破坏缓存:不涉及(无运行时行为)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

收工判定:本次唤醒报告的失败项(lock-sync)已修复并实测转绿,无遗留红项,无需决策项。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复(镜像 open [PR] 行中仅本 PR 针对 #5919)
标签: bug + regression + scope/kernel + p1 + review中(已打——v0.1.213 回归修复、内核合并判定层、核心压缩能力死锁按 owner 修订属 p1;不涉及具体客户端车道未打)

独立审核结论(head de1c71c,CI 全绿)

方向核验:#5919 的两种死锁形态都被覆盖——报错版(不可执行的"等老化进覆盖"承诺)现在要么自动收拢、要么转成带精确解锁区间的明确空操作;静默版("成功"但一条没折)被 retriedFoldedNothing 捕获后改道收拢/空操作,不再当假成功返回。与 owner 在 #5919 确认的方向一致。

机制重读(kernel/src/unit-projection.ts):合并卡住 else 分支的三步新增——①判死:任何散落可见伙伴永远折不动(BLOCKED/最近保护区/受保护工具/不可恢复媒体)→ 幂等空操作,所有块保持 active,#4484 零覆盖丢失不变量不破;②二级自动收拢:伙伴全部可折且一级未完成时,把本次折叠扩展到散落伙伴(≤16 条,定点完整性重判干净才提交),新块盖住整个回合、冲突清除;③报错保留 "cannot satisfy turn integrity" 短语(宿主依赖),虚假老化承诺换成精确 mX..mY 解锁区间。收拢路径的模拟宇宙(extended∪survivingCoverage)与提交后状态一致,fall-through 与既有 withdrawal 处理衔接正确。compress.ts 仅加一行 ...warnings 透传,空操作指导语能到达模型。verif 子语言守卫(compress.ts 在守护清单内)随 CI test 分片通过。

既有行为清点:#5789 中性继承保留(警告措辞调整,已披露);#4484 零覆盖丢失 pin 保留;#5789 自区间空操作改为自动收拢(已披露,熔断属性仍显式断言);fresh 压缩/carrier/zone/livelock 守卫路径未动。本地定向:PR 触碰的 3 套件 12/12、相邻 8 套件 52/52;kernel typecheck 干净;CI(head de1c71c)test 全分片 + static-gates 绿。第三个新提交 de1c71c 同步根 package-lock.json 的 kernel 版本 0.0.187→0.0.188——补上前两提交遗留的 lock-sync 缺口(KDD#5 要求),应当带上。

⚠️ 发现一个回归角落(对真 master 354e21e 做了 A/B 探针实测):当 span 同时包含「span 外的永久不可折可见伙伴 + span 内可独立折叠的内容」时(如 BLOCKED/受保护工具的 result 在 span 外,而 span 内有可折的间隙消息或干净块):

  • 旧代码:一级排除 → 中性继承成功,把可折部分折掉(实测新块 eff={r,W,t} 及更大 span 的 {r,W,t,y},拿到部分进展);
  • 新代码:判死先于一级触发 → 整段空操作并提示 "Do not retry",什么都折不掉。

触发条件窄、有绕行(用避开毒块的更窄区间)、无数据丢失、不触发熔断——单独不构成合并阻断,但它在该角落部分回退了 #5789 的继承目标。注意不能简单换序成「总先跑一级」:旗舰恢复场景里一级什么也折不掉(span 全覆盖),只有收拢能救,换序会弄丢主修复。支配性修法:把判死移到一级「是否真折到内容」判定之后——旗舰案例、事故案例、探针案例三者全覆盖。

🔶 需要决策(可随合并一起拍板)

八问

  1. 是什么问题:v0.1.213 回归——一个回合的推理/调用/结果被拆散在多个压缩块时,合并压缩永久死锁:要么报 "cannot satisfy turn integrity" 并承诺"等老化进覆盖"(对受保护伙伴永不兑现,模型每次重试同样失败),要么静默空转("成功"但一条消息都没折)。用户会话 session-ad47cd30 卡在水位 52% 压不动。
  2. 什么原因导致的:Reaching out to the author — a plugin bug is throwing errors and causing the context to balloon rapidly. | 求助作者,插件bug报错导致上下文急速增加 #5789 的合并恢复阶梯只有一级(排除切穿回合组的块后重试);撕裂几何下重试只有两种结局——真报错(附不可执行承诺)或假成功(调用侧边界被裁剪到块外,什么都没折)。散落的可见伙伴本是解锁关键,旧逻辑既不判它们也不折它们。
  3. 影响范围与严重程度:p1。触发条件特定(回合必须被撕裂:推理被旧 tier-2 块覆盖、调用被待合并块覆盖、结果仍可见或受保护),一旦触发该会话的核心能力(上下文压缩)整体停摆,上下文只增不减直至窗口溢出——属 owner 修订类别①(会话不可用/上下文失控增长)。
  4. 怎么修复的:全部在合并卡住的 else 分支:①判死——散落可见伙伴有任一永远折不动则合并转幂等空操作(所有块保持 active、覆盖不变量不破),警告点名受保护成员并明说"不要重试";②二级自动收拢——伙伴全部可折且一级未完成时,把本次折叠自动扩展到散落伙伴(≤16 条、定点重判干净才提交),新块覆盖整个回合、冲突清除;③报错信息保留短语但给出精确 mX..mY 解锁区间、删掉虚假承诺;④compress.ts 空操作路径透传投影层警告,指导语到达模型。
  5. 是否有回归问题:逐项审过——Reaching out to the author — a plugin bug is throwing errors and causing the context to balloon rapidly. | 求助作者,插件bug报错导致上下文急速增加 #5789 中性继承(保留,措辞调整已披露)、[Bug] Merging stale compressed blocks retracts existing coverage, causing repeated coverage-regression rejections | [Bug] 合并旧压缩块时撤回既有覆盖,导致 coverage-regression 反复拒绝 #4484 零覆盖丢失(pin 保留)、Reaching out to the author — a plugin bug is throwing errors and causing the context to balloon rapidly. | 求助作者,插件bug报错导致上下文急速增加 #5789 自区间空操作不触熔断(改自动收拢已披露、属性仍断言)、fresh 压缩/carrier/zone/livelock 守卫(未动)。另发现一个窄回归角落(见上方 ⚠️,A/B 实测):含「span 外永久不可折伙伴 + span 内可折内容」的 span,旧代码可拿部分进展、新代码整段空操作;有绕行、无数据丢失、无熔断。建议按选项 A 顺手修。
  6. 是否破坏缓存:不涉及。只改合并卡住分支的块生命周期决策(消费哪些块、新块覆盖范围),不动 wire 字节、前缀缓存接缝、渲染或增量车道。
  7. 是否改了设计方向:没有。仍在 Reaching out to the author — a plugin bug is throwing errors and causing the context to balloon rapidly. | 求助作者,插件bug报错导致上下文急速增加 #5789 阶梯框架内加二级+判死,不改身份层级(msgid>顺序>hash)、共享投影判定(KDD#12)或快照渲染架构。
  8. 是否引入了新的配置:没有。无新 env/config/默认值。

判定:可合(CI 绿、机制正确、测试有牙、行为变更披露完整);唯一待决项是上述顺序角落——推荐选项 A(合入前换序+回归钉),否则默认 B(现状合入、记为已知边界)。

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1094-master.82e2d53 (rolling master tag).

npm install -g billion-context@0.0.1094-master.82e2d53  # 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.

Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Nov 8, 2026
…ry (kernel 0.0.188)

Upstream delta f1a4af4..82e2d53 (8 files, 4 commits):
- 4cb3e06 kernel: close shredded-merge dead-ends — auto-extend to stranded
  partners or no-op with exact guidance (ranxianglei#5919); src/unit-projection.ts +182
- ae5c9a5 kernel: version 0.0.188
- de1c71c chore: sync root package-lock.json with the kernel bump
- 82e2d53 Merge pull request ranxianglei#5929

No file overlap with the lane (comm -12 on the two file lists is empty), so the
merge is a pure adoption: eight upstream files, staged count 8, no conflict.

kernel moved 0.187 to 0.188 and was rebuilt before measuring. Lane anchors intact:
src/server/relay.ts:2097 still calls `pipePluginJson(toClient, res, undefined,
prepared.protocol, ...)`, src/storage/mysql.ts:77 still exports MYSQL_SCHEMA_VERSION,
symbols unchanged (stripDriftResidue 6, isDraftDump 6, containsRenderTagText 21,
mayStartDegenerateRenderTag 6, DRIFT_BARE_MISMATCH 3, DRAFT_CLOSE_TAG is absent,
DRAFT_CLOSE_TAIL 3).

Gates: tsc 0, unused-exports 0, config-surface 0, lifecycle-ledger 0,
test-import-graph 0, gen-config-docs fixed point.
Tests: issue5175 58/0, tag-echo 79/0, issue2190-degen-close 32/0,
golden-storage-render 5/0, storage-engine-proofs 12/0, native-compact-terminal 1/0,
issue4666 2/0; plus the three kernel suites this delta touches:
issue5919-shredded-merge 4/0, issue4484-merge-coverage 5/0,
issue5789-tier2-merge-ladder 3/0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant