Skip to content

[PR] fix(kernel): recover tier-distillation merges around historical mid-turn blocks (#5789) - #5791

Merged
ranxianglei merged 5 commits into
masterfrom
2026-11-06_tier2-merge-ladder
Nov 7, 2026
Merged

ranxianglei merged 5 commits into
masterfrom
2026-11-06_tier2-merge-ladder

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Fixes #5789

kernel-change: the permanent T2-distillation death (#5789) is decided entirely inside the kernel's shared projection judgment (projectUnit's merge branch): when a historical block's coverage cuts through a turn group whose partner is still visible outside the span, every merge spanning that block hard-fails the turn-integrity gate forever ("align to whole turns" / "merge fewer blocks" are both unactionable for historical block boundaries). No host-side fix can exist — the refusal happens before any host code runs, and the host's own coverage-regression guard (#3322/#4484) forbids the naive alternative (unfolding already-covered ids). The recovery ladder therefore has to live where the judgment lives.

Complementary to PR #5777 (advertise-side screening of tier-distill runs, which owns compress.ts): this PR touches only kernel/src/unit-projection.ts (+ tests) — zero file overlap, either may merge first. Together they close #5789 from both sides: #5777 stops advertising doomed ranges; this PR makes even a doomed range complete around its offenders. (If #5777 merges first, this branch needs the mechanical rebump 0.0.183→0.0.184 + lockfile regen before merge — same class as #5777's own lock-sync follow-up.)

Third confirmed report of this mechanism family: #5283 (pi lane) and #5746 (dsh lane) are open siblings with the identical turn-integrity merge death; the recovery ladder fixes the mechanism for all instances.

What changes (apply-side only, kernel/src/unit-projection.ts)

When the merge's integrity gate gets stuck (a withdrawn id owned by a consumed block), instead of hard-failing:

  1. Tolerate merge-neutral conflicts. If none of the unresolved ids are content this merge newly folds or re-owns, the conflict pre-dates the merge (every id it touches stays covered regardless) — inherit it with an honest warning and let the merge proceed. This is the class that killed EVERY merge in long sessions: survivingCoverage is global, so one historical poison block doomed all merges, even of two adjacent clean blocks.
  2. Exclude offenders, retry. Otherwise retry the projection with the offending consumed blocks excluded: they stay ACTIVE (coverage intact → the host [bug] Collapsing the "block range" compress actually doubled the live view size (253→519 msgs) → local estimate blew past the window → preflight permanently fail-fast (while the same payload would have passed upstream at 566K/750K) | [bug] 折叠「块范围」的 compr… #3322 guard passes), the merge completes around them, and a warning names them.
  3. Actionable refusal as last resort. Only unfixable spans refuse, now naming the exact conflicted refs, their covering blocks, and the concrete next move (fold the stranded partner first). Keeps the "cannot satisfy turn integrity" phrase the host and the [Bug] Merging stale compressed blocks retracts existing coverage, causing repeated coverage-regression rejections | [Bug] 合并旧压缩块时撤回既有覆盖,导致 coverage-regression 反复拒绝 #4484 suite key on.

Behavior changes (old → new)

Validation

  • New regression suite kernel/tests/issue5789-tier2-merge-ladder.test.ts: user-shape fixture (tail-cut poison block) — merge completes around it, poison stays active, no coverage lost, no NEW integrity violations; self-range idempotent no-op pinned; surviving-owned conflict inherited with actionable naming. RED before the fix (reproduces the issue's verbatim error signature), GREEN after.
  • kernel/tests/issue4484-merge-coverage.test.ts evolved to pin the semantic evolution above; the refusal case is retained.
  • Targeted kernel battery on the rebased head (issue5789 / issue4484 / nudge×3 / recommend×2 / issue3236 / tool-pair×2 / issue684 / issue5531 / issue2886 / verif-subset-guard): 150/150 pass; typecheck clean; build clean. Full suite = CI.

Human review required (kernel boundary).

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-06_tier2-merge-ladder (43f1dab)

Latest build — install this exact version

npm install -g billion-context@0.0.8392-pr.5791.4d97a01

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
43f1dab billion-context@0.0.8392-pr.5791.4d97a01 build
de99667 billion-context@0.0.8384-pr.5791.6928635 build
e278f03 billion-context@0.0.8347-pr.5791.85731e9 build
0633706 billion-context@0.0.8336-pr.5791.7508546 build
c0fa4b2 billion-context@0.0.8334-pr.5791.af2decd build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(kernel): recover tier-distillation merges around historical mid-turn blocks (#5789) [PR] fix(kernel): recover tier-distillation merges around historical mid-turn blocks (#5789) Nov 6, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

收到,开始核验这个 PR(GitHub #5791,分支 2026-11-06_tier2-merge-ladder)。这是带 ework-agent-pr 标记的 agent 已完成工作,按流程不重做——拉分支核对代码、跑定向测试、查 CI 状态后给结论。初步核对:分支与 master 同步(merge-base = master head),diff 范围与描述一致(仅 kernel/src/unit-projection.ts + 两个测试文件 + kernel 版本 0.0.182→0.0.183 + lockfile)。稍后给完整结论。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

核验完成(GitHub PR #5791,分支 2026-11-06_tier2-merge-ladder,head 063370639)。按八问给结论:

1. 是什么问题:历史块「毒块」永久杀死 T2 蒸馏合并——一个覆盖切穿回合组(伙伴仍在 span 外可见)的历史块,会让所有跨越它的合并永远硬失败,且两条建议出路(对齐整回合 / 少合几个)对历史块边界都不可执行。

2. 什么原因导致的:根因在 kernel 共享投影判定(projectUnit 合并分支):survivingCoverage 是全局的,一个毒块毒死全部合并;门把「被消费块拥有的 withdrawn id」判为致命、无恢复路径;而宿主侧覆盖回归守卫(#3322/#4484)又禁止朴素替代(展开已覆盖 id)。所以修复必须落在判定所在层(kernel)——PR 已按 Kernel Boundary 声明 kernel-change。

3. 影响范围与严重程度:长会话中存在历史 mid-turn 块的插件车道(dsh threads 模型等宿主)——受影响会话的蒸馏合并整体停摆,上下文只增不缩,核心压缩能力对该类会话不可用。触发条件明确(历史块覆盖切穿回合 + 伙伴在 span 外),非全量用户面。

4. 怎么修复的:三级阶梯,全在 projectUnit 合并分支内——①容忍合并中性冲突(unresolved id 与本次新折内容无交集 → 带警告继承,让干净块正常蒸馏);②把肇事的被消费块从消费中排除(保持 ACTIVE、覆盖不动)重放投影,递归有界(<64);③仅不可修复 span 才拒,拒绝文案点名冲突 ref、覆盖块和具体下一步,保留宿主/#4484 依赖的关键短语。

5. 是否有回归问题:审过 diff 触碰的既有行为——turn-integrity 门禁语义(对中性冲突变软,有意变更已披露)、空 span fatal 由 zone 改 split(zone fatal 在 #4521 下本就是 no-op 成功,现改为可行动 split,已披露)、拒绝文案措辞(关键短语保留,#4484 套件通过验证)、覆盖不变量「合并永不丢既有覆盖」(演进版 #4484 套件 + 新套件 post⊆pre 断言双重钉住)。无 fail-fast 变吞错:真冲突照旧拒绝。核验中发现一处未披露的行为变更并已补进 PR 正文:毒块自引用区间(b4..b4)master 上硬失败 → 本 PR 变为幂等 no-op(「folded nothing」警告、状态不动)——同属 refuse→recover 家族,已在 Behavior changes 节补一行。另修了一处测试注释与事实不符(称自引用是「master 既有 no-op 行为、零宽 span」,实测 master 硬失败且 span 嵌套自身)——独立 commit 063370639 推入 PR 分支,纯注释修正,套件复跑 3/3 绿。

6. 是否破坏缓存:不涉及——无 wire/cache/persistence 变更;被排除块保持 active、覆盖集不变;消息 ref/id 空间未触碰。

7. 是否改了设计方向:无转向——扩展既有共享单元投影设计(#3236),新增字段 excludeNestedBlockIds 为纯内部重试通道(projectUnit 自己设置,外部不可达);与 PR #5777(advertise 侧)零文件重叠、可先后可前(若 #5777 先合,本分支需机械性 rebump 0.0.183→0.0.184 + lockfile regen,PR 正文已注明)。

8. 是否引入新配置:无——无 config/env/CLI 新增(diff 核实)。

证据:

判定:代码正确、测试有牙、披露完整,未发现拦下项。Kernel 变更按边界规则需人工评审——等 owner 评审后自行合并(我不合并)。CI 全分片转绿即无任何遗留。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Findings-only review — kernel PR, not approved per Kernel Boundary §1 (owner pre-authorization + human-only review; see the separate 🔶 需要决策 comment below). Reviewed independently at head 0633706, which adds one parallel comment-fix commit on top of c0fa4b295 (delta = one test-comment block, zero code change, verified by diff).

① 是什么问题 / 方向关: 长会话(>2000 turns)中任何块合并(含 T2 蒸馏)被 turn-integrity 错误永久卡死。根因(独立验证,不依赖 issue 描述):projectUnit 合并分支对全数组判 turn integrity(computeIntegrityWithdrawals 扫全部 messages);只要有一个历史块只盖了某个工具对的一半(call 已盖、result 仍可见),该会话此后每一次合并投影都会把这对的两半都撤下;unfold 循环无解——已盖半属于 consumed 块(unfold 会丢其覆盖,#4484 不变量),可见半不在 fold 集里 → 全会话所有合并永久死锁。修法在唯一共享投影判定内(KDD#12 单一定义处)加三段恢复梯:中性容忍(继承+诚实警告)→ 排除 offending 块重试(块保持 ACTIVE、覆盖原样)→ 可执行拒绝(保留关键短语)。层次判断正确:打在判定点本身、非下游过滤/改写;host 侧 #3322 覆盖单调性 backstop(src/stream.ts:1192)排除了「unfold 已盖半」的朴素替代,kernel 侧梯子是唯一可行路径。方向成立。

② 回归审查(逐项点名的既有行为):

  • fresh-fold 路径(非 merge):未动(ladder 整体位于 if (isMerge) 分支内)。
  • #4484 覆盖不变量:构造上保持——被排除块保持 ACTIVE;unfold 限于 effectiveMessageIds \ consumedCoverage;中性分支不改变 mergeOwned 之外任何 id 的覆盖状态(健全性论证:涉及新折叠内容的 split 必有成员落入 mergeOwned,否则不可能假中性)。三种 fixture 形状手推验证 + evolved suite 的 lostCoverage / post⊆pre 断言钉住。
  • 关键短语契约 cannot satisfy turn integrity:actionableSplitError 逐字保留(grep 全仓仅两个消费者:unit-projection.ts:923 + 4484 测试 regex)。
  • zone fatal = NO-OP SUCCESS(#4521):主路径未动;新增一个有意例外——all-excluded span 恰好命中 protected-zone 时返回 kind:split 显式错误而非 zone 静默 noop(静默 noop 是更差 UX;错误文本可执行)。PR 正文已披露。
  • 空-after-carve noop success(compress.ts:1801):未动;无 zone 命中的 all-excluded span 流入它 → 「folded nothing」警告、不建空块、不毒化 batch。
  • recommend/screening 一致性(KDD#12):recommend 节点经同一 projectUnit 复筛 → advertise/execute 天然一致;净效果 = 原先 fatal 的 unit 降级为 gap(严格更少保守)。
  • acp_status uncompressed view:逐行 projectUnit → ⚠ flag 相应减少(additive 诊断面,行永不丢)。
  • 警告发射顺序契约:新警告追加于既有之后(shared array、保序);fatal outcome 时 apply 丢弃部分警告(仅成功 outcome 浮现 warnings)— 无泄漏。
  • batch wrapper(整批拒绝 + preLoopState 还原):未动。
  • golden pins(tests/golden/wire-contract/kernel.json):diff 未触任何 pinned 常量。
  • host #3322 backstop:ladder 输出保持覆盖单调(手推)→ backstop 通过,继续作 defense-in-depth。
  • 披露清单外发现一处 micro-delta:poison 块的自范围(b4..b4)— master 硬失败(本地 RED 实测:"Merging b4 cannot satisfy turn integrity…"),新代码为幂等 no-op(「folded nothing」+ 排除警告)。error→no-op、两侧 state 均不动,benign;并行提交 0633706 已修正对应失实测试注释,与我的独立 RED 检查结论一致。
    结论:无意回归未发现;全部 delta 为有意且披露(除上述 micro-delta,已由并行提交修正表述)。

③ 代码审查:三种 fixture 形状全部手推验证(user-shape tail-cut / self-range / surviving-tier-poison),含 INV2→INV1 级联交互(INV2 移除 call 后,reasoning group 触发 kept-call 分支)与重试轮的关键机制(r2 因 span geometry 重新进入 effective、b4 被排除 ⇒ r2∉consumedCoverage ⇒ 可从新块剥出——这正是 merged 块 effective 恰好等于测试断言集合的原因)。中性容忍健全性、递归预算(size<64)、确定性(纯函数、shared context 复用)、exclude 集 internal-only 文档、actionableSplitError 点名 refs+owners+具体下一步(slice(0,6) 限长)——均成立。复杂度:每 poison span 最坏 64×O(n) 附加,干净会话零开销(首轮 conflict 为空则 ladder 不触发)——可接受。错误处理:无吞错,所有路径返回结构化 fatal/success。风格与文件一致。

④ 测试有效性:有牙。新套件断言精确 merged-block 形状(tier/directBlockIds/effectiveMessageIds)、零覆盖丢失、poison 块 active 态、警告命名、post⊆pre withdrawal 不变量(直接调 computeIntegrityWithdrawals 计算,非 mock)。本地 RED 验证:换入 master 的 unit-projection.ts 后 3 个测试全败、错误与 issue 引用逐字一致;换回后 git status clean。evolved 4484 套件把旧「impossible merge」拆成 AROUND-success + actionable-refusal 双向断言(#3617 gate 纪律满足),control 保留。本地执行:targeted battery 142/142 + 追加 recommend/prune/nudge lanes 42/42 绿;kernel typecheck clean。全量 = CI(0633706 当前 11 shards 运行中、0 failure;代码等价的 c0fa4b295 已全绿)。

⑤ diff 整洁度:6 文件全部与本目的相关;lockfile 为 kernel bump 伴生的 3 行版本同步(非 churn);无空白噪音。干净。

Findings(非阻塞;按 kernel/ 边界一律未动手):

  1. ✅ 已解决:b4..b4 pin 注释失实 — 并行提交 0633706 修正(与我独立 RED 检查结论一致)。
  2. minor:kernel/tests/issue5789-tier2-merge-ladder.test.ts T3 标题 conflict owned by a SURVIVING higher-tier block: refuses naming owner and partner 与其实际断言相反(断言的是 success + 继承警告)——误导后续读者;actionable-refusal 路径实际由 evolved 4484 套件钉住。建议标题改为反映继承成功。
  3. observation(无需动作):double-cover corner — relevantUnresolved id 同时被 consumed 与 surviving 块拥有时被 !survivingCoverage.has(id) 滤出 offending;若它是唯一 offender,合并会被拒,而排除 consumed co-owner 本可成功(retry 走中性)。保守 miss = 旧行为,安全。
  4. nit:排除预算 64 内联于 unit-projection.ts:543,可提具名常量。纯 cosmetic。

第 2–4 项均为机械小修,可在 owner 批准后随一个标注 commit 带过;此处因 kernel/ 边界不代改。

⑥ 缓存:不涉及 — 仅投影判定;成功合并产生的块形状与既有相同(summary carrier 不变);失败合并零状态变更(state-untouched 断言 + preLoopState 契约)。

⑦ 设计方向:无转向 — 在 KDD#12 共享投影设计内、于判定点加恢复梯,与 #3236 确立的单一定义原则一致;与 #5777(advertise-side screening,owns compress.ts)互补、零文件重叠,合入顺序依赖已披露。

⑧ 新配置:无。

判定:机制打中根因、测试有牙、回归审计通过、代码质量高。按 Kernel Boundary 硬规则本 lane 不批准 —— 等待 owner kernel-change 授权(见 🔶 需要决策 评论)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

PR #5791 触碰 kernel/** 且正文带 kernel-change 声明 —— 按 Kernel Boundary §1(声明 + owner 事前批准 + 人工评审),本 review lane 不批准,请 owner 裁决。

被门禁的 diff:

  • kernel/src/unit-projection.ts(+170/-28):合并分支恢复梯(中性容忍 / 排除重试 / actionableSplitError)+ all-excluded-zone-hit 覆盖
  • kernel/package.json 0.0.182→0.0.183(+ 两处 lockfile 版本同步)
  • kernel/tests/:新增 issue5789-tier2-merge-ladder.test.ts + 演化 issue4484-merge-coverage.test.ts

审核结论(详见上方 findings-only review):无阻塞项——根因验证成立、回归审计通过(逐项点名)、本地 RED/GREEN 实测复核、targeted battery 142/142 绿、CI 无失败。非阻塞 findings ×3(T3 测试标题与断言相反 / double-cover 保守 corner / 魔法数 64),均为机械小修,可在批准后随一个标注 commit 带过。另注:并行提交 0633706 已修正 b4..b4 pin 注释失实问题。

选项:A) 批准此 kernel-change → PR 进入人工合并流程(issue #5789 标了「马上合并」);B) 打回重做(请给方向)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 本 lane(PR review)工作总结 —— 上游 PR #5791(镜像 #5793):

做了什么:端到端独立审核该 kernel PR(读正文/原 issue #5789/全量 diff,逐路径手推验证机制)。审核期间 head 从 c0fa4b2 移至 0633706(并行提交仅修一处测试注释),已按新 head 复核。

结果:无阻塞项——根因验证成立、回归审计逐项通过、本地 RED/GREEN 实测(targeted battery 142/142 + 追加 lanes 42/42 绿、kernel typecheck clean)、CI 无失败。非阻塞 findings ×3(T3 测试标题与断言相反 / double-cover 保守 corner / 魔法数 64),均为机械小修,按 kernel/ 边界未代改,可在批准后随一个标注 commit 带过。

已执行:findings-only review 已发(不批准——Kernel Boundary 硬规则);🔶 需要决策 评论已发(见上条,即本线程同步回来的那条);needs-decision 标签已打;#4599 已报一行。

当前状态:等待 owner 裁决 A(批准 kernel-change → 人工合并)/ B(打回重做)。上面那条 🔶 是我自己发的决策请求的镜像同步,不是新的用户输入——决策仍在等 @ranxianglei。

ranxianglei pushed a commit that referenced this pull request Nov 6, 2026
msgid-lane-flow's settle() awaited a single afterNextFlush verdict, which
resolves on the FIRST drain event. Under load a stale mid-turn write can
still be in flight when the fresher wrap-up write gets armed (persist.ts
debounce overlap: with a write in flight there is no pending timer, so the
next scheduleSave starts a fresh timer whose write queues behind the stale
one). The verdict then lands on the pre-turn snapshot while the full save
sits queued behind it, and rows() reads 3 instead of 4 (PR #5791
ubuntu-22 shard red at tests/msgid-lane-flow.test.ts:139).

Every save for a turn is armed before the ack leaves and nothing re-arms
afterwards, so a second drain settles the remainder; it is an immediate
no-op in the common single-write case. Inherited master-level flake — this
file is untouched by the PR's kernel change.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI 自动修复完成(attempt 1/3):红条已修,新 head e278f0336 全 12 个 workflow 绿。

本次运行做了什么:定位失败 check(test ubuntu-latest/22/shard 1,唯一失败用例 msgid lane flow 子测试 1,tests/msgid-lane-flow.test.ts:139 断言 4 行实得 3)→ 排除本 PR kernel 改动嫌疑(PR 只动 kernel/unit-projection.ts + kernel 测试 + 版本号,不碰该测试与存储层)→ 本地实验钉死根因(时间戳插桩 5 轮含 2 轮 7 核 CPU 饱和)→ 在 PR 分支推一个独立测试修复 commit e278f0336 → 远程 CI 确认转绿。已在 #4599(CI 总控)留一行结论供其他车道参考。

八问

  1. 是什么问题:CI 测试分片假红——turn ack 之后读持久化行,读到的是 turn 前的旧快照(3 行而非 4 行)。master 级继承性 flake,与本 PR 的 kernel 改动无关。
  2. 什么原因导致的:两层。表层:测试的 settle() 只等一次 SessionStore.afterNextFlush 的「写已落盘」判决就读行。根因:该判决在第一个 drain 事件就兑现,而负载下两次 debounced 写会重叠——mid-turn 写 W1(由部分状态构建,只有 3 行)还在写盘时没有挂起的 debounce timer,wrap-up 的 scheduleSave 于是起了新 timer,其整状态写 W2 按 per-id FIFO 排在 W1 后面提交;settle 挂到 W1 上 → 判决 true → 行读拿到 pre-turn 快照。证据链:时间戳插桩证明 save 的 arm 恒早于 ack 到达客户端(排除「arm 滞后」说),peekSession 零 miss、scheduleSave 零 throw(排除「wrap-up 静默跳过」说)。
  3. 影响范围与严重程度:仅该测试文件、仅加载的 CI runner 上窄时序窗口对齐时触发;生产行为零变化(纯测试改动)。严重度:CI 假红,阻塞 PR 合并信号,无用户侧影响。
  4. 怎么修复的:settle() 连续等两个 afterNextFlush 判决再放行。充分性论证:每个 turn 的所有 save 都在 ack 离开前 armed(实测),ack 后无任何重新 arm,故第二次 drain 必然把剩余写落定;常见单写情形下第二次调用是即时 no-op,零额外成本。不动生产代码:afterNextFlush 对齐其 docstring(「等全部 queued/in-flight 落定」)属 load-bearing 原语语义变更(消费方含 [Performance] v0.1.208 long sessions exceed 2 GiB memory and spend 14–22 seconds in local processing #4788 spill gate 与 lane pointer 链),归 owner 决策,未擅自改。
  5. 是否有回归问题:无。纯测试单文件改动(+10/-1);断言牙齿完整保留(count=4/fresh-row/new-seq/旧代保留等下游断言一字未动);本地 7/7 绿(含 2 轮 7 核饱和压测);远程 CI 新 head 全绿(含原红的 ubuntu-22 shard 1)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有。
  8. 是否引入了新的配置:没有。

观察记录(未修,按车道规则不开新 issue,在此留痕)

结论:修复完成,CI 全绿,ready-to-merge(合并为人工动作)。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

增量审核(head 0633706 → e278f0336,findings-only;kernel 部分上一轮已在 0633706 全量审过,本轮只审新增 commit)。

新增内容:单个 commit e278f0336 test: drain the debounced row save twice after each turn ack (#5789) —— 仅动 tests/msgid-lane-flow.test.ts(+10/-1,settle() 里 afterNextFlush 从一次改两次 + 注释),不触碰 kernel/ 与 src/,被门禁的 kernel diff 与上轮完全一致。

机制核验(对照 persist.ts 实码,非凭 commit message):

  • scheduleSave(persist.ts:2938):timer 触发时先 saveTimers.delete(id) 再异步 writeNow;写 in-flight 期间无 armed timer → 下一次 scheduleSave 会 arm 新 timer,其写入经 per-id 串行排在在飞写之后 —— 与 commit 描述的 debounce overlap 一致。
  • afterNextFlush(persist.ts:3064):「nothing armed & nothing mid-write → 立即 true;否则等下一个 drain 事件」——单次 await 确实可能落在陈旧的中途写快照上,而携带第 4 行的完整写还排在队后 → rows() 读到 3,正是本 PR ubuntu-22 shard 在 tests/msgid-lane-flow.test.ts:139(rows.length==4)的红点。
  • 两次 drain 的充分性:该 turn 的所有保存在 ack 离开前已 arm、之后无新 arm;携带第 4 行的写必是 ack 后队列里前两个写之一(builder 在 write time 读最新状态,后续 housekeeping 写只会更新鲜)。常见单写情形第二次调用走 fast path 立即返回,零成本。不是掩盖:持久化本身按设计收敛(per-id 串行 + latest-builder coalesce),错的是测试的观察点而非存储层。

验证:本地连跑 3 次 6/6 绿(需先 npm --prefix kernel run build 出 dist,纯环境前置);CI 按 lane 派发声明为 head e278f03 全绿(本轮镜像缓存暂空,未轮询 gh)。属 owner policy 2026-10-13 ① 的「CI 失败类小修在当前 PR 独立标注 commit」合规形态,且注明了 master 级继承性 flake。

结论:新增 commit 无阻塞项;上轮非阻塞 findings ×3(T3 测试标题 / double-cover corner / 魔法数 64)状态不变。kernel 授权仍待 owner(见下方 🔶 更新)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

head 更新至 e278f0336:被门禁的 kernel diff 与此前完全一致(kernel/src/unit-projection.ts +170/-28、kernel 0.0.182→0.0.183 + lockfile、kernel/tests 两个文件),新增的单个 commit 仅是 bili 侧测试 flake 修复(tests/msgid-lane-flow.test.ts,机制已对照 persist.ts 实码核验,见上方增量 review)。授权请求不变:A) 批准此 kernel-change → 进入人工合并流程(issue #5789 标了「马上合并」);B) 打回重做(请给方向)。等待 @ranxianglei 裁决。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 第二轮 review(head e278f03)总结:

变化:自上次审核(0633706)新增单个 commit e278f0336 —— msgid-lane-flow 测试 flake 修复(settle() 里 afterNextFlush 从一次改两次),仅动 tests/msgid-lane-flow.test.ts(+10/-1),kernel 门禁 diff 与上轮完全一致。

核验:flake 机制已对照 persist.ts 实码验证(scheduleSave 触发时删 timer → 写 in-flight 期间重新 arm 的写入经 per-id 串行排在队后;afterNextFlush 只等下一个 drain 事件,单次 await 会落在陈旧中途快照上,携带第 4 行的完整写还在队后 → rows() 读到 3,正是 ubuntu-22 shard 在 test:139 的红点)。两次 drain 充分且非掩盖:携带第 4 行的写必是 ack 后前两个排队写之一,常见单写情形第二次调用走 fast path 零成本;持久化本身按设计收敛。本地连跑 3 次 6/6 绿;CI 按派发声明全绿。

结果:无新阻塞项;incremental findings-only review + 🔶 需要决策 更新已发上游 PR #5791(仍不批准——Kernel Boundary 硬规则)。非阻塞 findings ×3 状态不变。当前仍在等 @ranxianglei 裁决 A(批准 kernel-change)/ B(打回)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 说明:上面这条 🔶 是我自己第二轮决策请求的镜像同步(带 upstream-sync 标记),不是新的用户输入——未收到新裁决,状态不变:等待 @ranxianglei 对 PR #5791 kernel-change 的 A(批准)/ B(打回)裁决。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 当前状态(两轮 review 均已交付):PR #5791 在 0633706 全量审 + e278f03 增量审均无阻塞项(根因验证、回归审计、本地 RED/GREEN 与 targeted battery 复核、flake 修复机制对照 persist.ts 实码核验)。kernel/ 边界硬规则 → 不批准;findings-only review ×2 + 🔶 需要决策 ×2 已在上游 PR,#4599 与本帖均已报。唯一待办:等 @ranxianglei 对 kernel-change 的 A(批准)/ B(打回)裁决,收到后本 lane 即收工。

ci-check added 5 commits November 6, 2026 23:32
…locks (#5789)

Long sessions accumulate T1 blocks whose coverage cuts through a turn
group (reasoning/tool-call/result) with the partner still visible outside
the span. Any block merge consuming such a block failed the turn-integrity
gate permanently: survivingCoverage is global, so ONE historical poison
block doomed every merge in the session (even two adjacent clean blocks),
and the nudge kept advertising the same doomed first..last run.

Apply-side fix (unit-projection only — the advertise-side screening of
tier-distill runs is PR #5777, which owns compress.ts; zero file overlap,
either may merge first):

- conflicts touching nothing the merge newly folds or re-owns are
  inherited with an honest warning (pre-existing, merge-neutral) instead
  of refusing every merge in the session;
- conflicts owned by consumed blocks retry the projection with those
  blocks excluded: they stay ACTIVE (coverage intact, host #3322 gate
  passes) and the merge completes around them, warning by name;
- only unfixable spans refuse, now with actionable text naming the exact
  conflicted refs, their covering blocks, and the concrete next move
  (fold the stranded partner first). Keeps the 'cannot satisfy turn
  integrity' phrase the host and the #4484 suite key on.

Behavior change (old -> new): merges touching historical mid-turn blocks
hard-failed forever -> partial success excluding offenders by name;
pre-existing merge-neutral conflicts no longer block clean merges;
(single-defective-block ranges still refuse); refusal texts replaced with
actionable versions. No coverage ever dropped; no config surface added.
msgid-lane-flow's settle() awaited a single afterNextFlush verdict, which
resolves on the FIRST drain event. Under load a stale mid-turn write can
still be in flight when the fresher wrap-up write gets armed (persist.ts
debounce overlap: with a write in flight there is no pending timer, so the
next scheduleSave starts a fresh timer whose write queues behind the stale
one). The verdict then lands on the pre-turn snapshot while the full save
sits queued behind it, and rows() reads 3 instead of 4 (PR #5791
ubuntu-22 shard red at tests/msgid-lane-flow.test.ts:139).

Every save for a turn is armed before the ack leaves and nothing re-arms
afterwards, so a second drain settles the remainder; it is an immediate
no-op in the common single-write case. Inherited master-level flake — this
file is untouched by the PR's kernel change.
@ranxianglei
ranxianglei force-pushed the 2026-11-06_tier2-merge-ladder branch from de99667 to 43f1dab Compare November 6, 2026 15:47

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

第三轮增量审核(head e278f0336 → 43f1dabb5,findings-only)。

Delta:分支已 rebase 到当前 master tip c3dfbe6b2(无冲突、无内容漂移);新增单个 commit 43f1dabb5 —— 仅一行:kernel/tests/issue5789-tier2-merge-ladder.test.ts:186 T3 用例标题由 "conflict owned by a SURVIVING higher-tier block: refuses naming owner and partner" 改为 "…inherited with warning, clean blocks still distill"。这正是我第一轮 findings-only review 里的非阻塞 finding ②(T3 标题与断言相反),作者已先行修掉——新标题与断言一致(该用例子测的是继承容忍:errors 0 / blocksCreated 1 / Inherited a pre-existing turn-integrity conflict 警告 / b2 保持 active / merged effective={u0,a0,u1,a1});refusal 路径仍由演化后的 issue4484 套件钉住。

逐文件 blob 比对(e278f03 vs 43f1dab):7 个 PR 文件中 6 个字节级相同,唯一差异即上述标题行 → 被门禁的 kernel diff(kernel/src/unit-projection.ts +170/-28、kernel 0.0.182→0.0.183 + lockfile、issue4484 套件)与前两轮已全量审过的内容完全一致,本轮无需重审机制。

剩余非阻塞观察(均不属 2026-11-06 豁免的「kernel/ 内机械 bug」,保持不动、仅记录):

  • double-cover corner:同时被 consumed+surviving 块覆盖的 unresolved id 被滤出 offending(保守漏判=旧行为,安全);
  • unit-projection.ts:543 排除预算魔法数 64 未具名(风格 nit)。

验证与状态:kernel 侧文件字节级未变,前两轮本地证据继续有效(REED/GREEN 实测、targeted battery 142/142 + 追加 42/42、kernel typecheck clean);CI 按 lane 派发声明在 head 43f1dab 全绿(镜像缓存本轮暂空,未轮询 gh)。PR body 的 kernel-change: 声明在位。

结论:无阻塞项。kernel 授权仍待 owner A/B 裁决(见下方 🔶 更新)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

head 更新至 43f1dabb5(分支已 rebase 到 master tip c3dfbe6b2):被门禁的 kernel diff 与此前逐字节一致,新增 commit 仅是我第一轮点名的 T3 测试标题修正(机械小修,作者已先行处理)。授权请求不变:A) 批准此 kernel-change → 进入人工合并流程(issue #5789 标了「马上合并」);B) 打回重做(请给方向)。等待 @ranxianglei 裁决。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 第三轮 review(head 43f1dab)总结:

变化:分支已 rebase 到当前 master tip c3dfbe6b2(无冲突、无内容漂移);新增单个 commit 43f1dabb5 —— 仅一行 T3 测试标题修正,正是我第一轮点名的 finding(T3 标题与断言相反),作者已先行修掉,新标题与断言一致。

核验:逐文件 blob 比对(前 head e278f03 vs 43f1dab):7 个 PR 文件 6 个字节级相同,唯一差异即该标题行 → 被门禁的 kernel diff 与前两轮全量审过的完全一致,机制无需重审;前两轮本地证据继续有效(REED/GREEN、targeted battery 142/142+42/42、kernel typecheck clean)。CI 按派发声明全绿。剩余 2 条非阻塞观察(double-cover corner / 魔法数 64)不属机械 bug,保持仅记录。

结果:无阻塞项;incremental findings-only review + 🔶 需要决策 更新已发上游 PR #5791,needs-decision 标签在位。仍在等 @ranxianglei 的 A(批准)/ B(打回)裁决。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 该条是我自己第三轮 🔶 决策请求的镜像同步(upstream-sync 标记),非新输入;无新裁决,状态不变——等 @ranxianglei 对 PR #5791 kernel-change 的 A/B 裁决。

@ranxianglei
ranxianglei merged commit c2797c3 into master Nov 7, 2026
51 checks passed
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1053-master.c2797c3 (rolling master tag).

npm install -g billion-context@0.0.1053-master.c2797c3  # 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

Projects

None yet

1 participant