Skip to content

[PR] fix(fold-reconcile): a surviving direct-ID majority is partial loss, not total drift (#5715) - #5737

Merged
ranxianglei merged 5 commits into
masterfrom
2026-11-05_fold-interior-loss-direct-majority
Nov 9, 2026
Merged

ranxianglei merged 5 commits into
masterfrom
2026-11-05_fold-interior-loss-direct-majority

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Problem (#5715)

A DSH session where a strict majority of hard-covered ids still ride verbatim on the wire (field case: 1162/1171 direct-present with ten interior turns missing) was misclassified as totalDrift. The verdict in src/fold-reconcile.ts only saw claims==0 && unmatched>0 and never counted the surviving direct matches. After FOLD_DRIFT_ESCALATE_PASSES (3) that falsely latched foldEpochConfirmPending, and preflight then paused compression on a healthy session — preflight fail-fast 502 … 0 compressible range(s) — permanently until a manual reset.

Interior loss (neither a head cut nor a tail rewind) defeats every existing explainer (truncationExplained, tailTruncationExplained, shapeExplained, …), so none of them suppressed the verdict.

Fix (lane-agnostic)

In reconcileFoldCoverage compute a strict direct-ID majority over the covered set (separators / expected rebases / reasoning cores excluded — same denominators as the per-block coverage):

const hardDirectMajority = presentHard >= MIN_RESYNC_RUN && 2 * presentHard > coveredHard;

and use it in three places:

  1. Void the terminal verdict — the epoch-confirm escalation block now requires !hardDirectMajority. The latch and its compression pause no longer fire on a healthy-majority session.
  2. Auto-clear a stale pending latch — if the histories have realigned (majority present) but a persisted foldEpochConfirmPending remains with a zero drift streak (the reporter's second site), clear it immediately. This fires even when this pass still carries residual loss (a partial restore keeps totalDrift true, so the normal !totalDrift reset would never reach it).
  3. Reframe the log — at the mass bar such a session logs one info note ("partial interior loss, fold substrate healthy") instead of a repeated drifted/mutation/deletion warn. Sub-mass-bar single edits keep their exact original per-pass warn.

Why not relax totalDrift itself?

Deliberately left untouched. The #3641 drift streak + frozen witness are what keep a genuine mid-history edit reading as honest loss (zombie accrual) rather than sanctioned truncation (#4050/#2695). Relaxing the classification breaks that coupling; only the terminal verdict needs gating.

Why this can't mask a real collapse

Genuine wholesale replacement / host-native compaction has ~0 directly-present covered ids, so hardDirectMajority is false and detection proceeds unchanged. A negative-control test pins that.

Behavior change (flagged per §4 deliverable 4)

  • (a) Healthy-majority partial interior loss no longer latches epoch-confirm / pauses compression. Old: any claims==0 + ≥10 unmatched interior loss could latch after 3 passes and pause forever. New: suppressed while a strict direct-ID majority survives.
  • (b) Log wording: the mass-regime healthy-majority case emits ONE info note instead of a repeated warn. Sub-mass-bar single edits are byte-for-byte unchanged.
  • Scope is lane-agnostic (not DSH-only as in the reporter's bounded workaround) — the invariant holds on every plugin lane.

Tests

New block in tests/fold-anchor-doctrine.test.ts:

  • ten interior turns dropped, twenty verbatim → no escalation, no epoch latch, snapshot retained (the repro);
  • same shape in proxy mode (lane-agnostic);
  • stale pending latch clears once the healthy majority returns (pins site 2);
  • genuine wholesale replacement still escalates (teeth).

Verified locally (targeted): typecheck clean; fold-reconcile + doctrine + positional trio 108/108; 15-file drift/epoch surface set 129/129. Full-suite verdict from CI.

Closes #5715

…not total drift (#5715)

A session where a strict majority of hard-covered ids still ride verbatim on the wire (field case: 1162/1171 direct-present with ten interior turns missing) was classified totalDrift because the verdict only saw claims==0 + unmatched>0 and never counted the surviving direct matches. After FOLD_DRIFT_ESCALATE_PASSES that falsely latched foldEpochConfirmPending and paused compression on a healthy DSH session (preflight 502, zero compressible ranges).

Fix (lane-agnostic): compute a strict direct-ID majority over the covered set (separators / expected rebases / reasoning cores excluded); void the terminal epoch-confirm verdict on it and auto-clear any stale pending latch. totalDrift itself is untouched - the #3641 drift streak + frozen witness keep a genuine mid-history edit reading as honest loss (#4050/#2695), so only the terminal verdict is gated, never the classification. Genuine wholesale replacement has ~0 directly-present covered ids, so the gate cannot mask a real collapse; a negative control pins that detection stays intact.

Behavior change: (a) healthy-majority partial interior loss no longer latches epoch-confirm / pauses compression; (b) at the mass bar such a session now logs one info note instead of a repeated drifted warn (sub-mass-bar single edits unchanged).
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-05_fold-interior-loss-direct-majority (3298cd8)

Latest build — install this exact version

npm install -g billion-context@0.0.8782-pr.5737.b639881

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
3298cd8 billion-context@0.0.8782-pr.5737.b639881 build
c39dffb billion-context@0.0.8265-pr.5737.ffc0888 build
02987a9 billion-context@0.0.8249-pr.5737.f27ede0 build
2a05a4d billion-context@0.0.8237-pr.5737.1c6b640 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(fold-reconcile): a surviving direct-ID majority is partial loss, not total drift (#5715) [PR] fix(fold-reconcile): a surviving direct-ID majority is partial loss, not total drift (#5715) Nov 5, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复 —— 本线程(修复 #5715)仅此一个在途修复 PR(#5737),无并列第二 PR。

这是我自己已完成的 PR(正文带 ework-agent-pr 标记),按规范不重做:拉分支独立重读 diff、本地定向验证测试、查 CI,给出结论。

代码审核(独立重读,非照抄 issue 结论)

测试有效性(本地定向实测)

  • HEAD 上 tests/fold-anchor-doctrine.test.ts 12/12 全绿(含 4 条新用例)。
  • teeth 验证:仅把 src/fold-reconcile.ts 回退到 base、保留新测试 → 恰好 3 条依赖本修复的用例失败(no-escalation / lane-agnostic / stale-latch-clear),负控制那条仍过。证明测试真钉住了这个 bug,不是恒真断言。
  • 负控制有牙:「真·整体替换仍 escalate」在 base 上也通过 —— 检测未被削弱。

CI 状态 —— 红,但与本 PR 无关(继承性 master 红)

结构化八问

  1. 是什么问题:健康会话里多数硬覆盖 id 仍逐字在线上,却因少数中段回合缺失被误判为 totalDrift,3 轮后误置 epoch-confirm latch、永久暂停压缩直到手动重置。
  2. 什么原因导致:判决分类器只看 claims==0 && unmatched>0,从不统计存活的直接匹配;中段丢失既非头部截断也非尾部回退,现有 explainer 谓词全都盖不住。
  3. 影响范围与严重程度:任一插件车道会话 —— 只要 >半数硬覆盖 id 仍逐字在场且 ≥10 个中段 id 缺失,3 轮后即 latch 并停压缩。p1(可用性):该会话压缩停摆,需手动 reset;车道无关(不止 dsh)。
  4. 怎么修:对覆盖集算严格直接-id 多数,用它①否决终局判决②自动清陈旧 latch③重排日志;刻意不动 totalDrift,保住 Snapshot as session reconstruction: identity claim order takes priority, message hash demoted to reference signal (root- | 快照即会话重构:身份认领顺序优先,消息哈希降级为参考信号(根治 #3588/#3640 一类误判) #3641 诚实丢失语义。
  5. 是否有回归:审过既有行为 —— totalDrift 分类未动,Snapshot as session reconstruction: identity claim order takes priority, message hash demoted to reference signal (root- | 快照即会话重构:身份认领顺序优先,消息哈希降级为参考信号(根治 #3588/#3640 一类误判) #3641/[Bug][proxy] unframed host-side history deletion leaves zombie fold blocks rendering carriers forever — one carrier flaps in/out every turn (persistent prefix-cache churn) #2695/[Bug][Responses] After a short request makes fold inactive, resending canonically equivalent history fails to restore co | [Bug][Responses] 短请求使 fold inactive 后,规范化等价的历史重发无法恢复压缩覆盖 #4050 的「中段编辑=诚实丢失」路径不变;负控制钉住整体替换仍 escalate;快照保留不 reap。本修复自身无回归。
  6. 是否破坏缓存:否 —— 唯一效果是移除一次错误的压缩暂停;快照保留。
  7. 是否改设计方向:否 —— reconcileFoldCoverage 内的加法门控,无架构转向。
  8. 是否引入新配置:无新 env/config/默认值。

收工判定:代码审核通过、测试有牙、CI 红系继承性(已 merge ci-fixes 收敛)。等新头 02987a973 的 CI 转绿即可合入。按纪律我不代合,请你自行合并:#5737

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

收尾状态确认(接上一条详细审核):

等新头 02987a973 的 CI 转绿即可合入 —— 按纪律我不代合,请你合并:#5737

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复(同症状家族,但与既有票的车道/机制不同):

标签:bug / zcode / scope/wiring / p1(缺陷类;ZCode 纯代理车道;请求管道会话绑定门;fork 子会话 413 不可用+缓存命中归零,按 p1 口径①「会话恢复失败类」定级)。

审核结论(已对 master 源码逐项核验):

  1. 方向性缺陷成立。src/prefix-affinity.ts:1018(findResumeParent)len <= entry.depth 直接跳过;:1047(findResumeParentWithin)同样;lineageOf()(:827)只在匿名车道的 resolve() 内被调用(:787/:789),identified 客户端的请求既不计算也不持久化该结果——所以 derivedFromSessionId 永不落盘,reconcileDerivedLineage(fix(sessions): wire-neutral affinity hashing for cross-protocol continuity (#2791) #2807)永远等不到它。fork 是父链的前缀副本(等深或更短),在「严格更长」的门下结构性必 miss。A/B 两场景的日志形状与代码路径逐条对上。
  2. 层次判断:根因是收养路径的方向性假设(「resume 必须变长」),不是阈值问题。F2 论证成立:收养是 COPY 语义(planForkAdoption 逐块 raw-id 集合判定、seedAllRefs 只种 incoming 实际存在的 id、父会话深克隆不受影响),「content cannot distinguish duplicate from branch」只在搬移(MOVE)语义下成立;COPY 语义下误判的最坏后果是把源字节字面存在于子 incoming 的块复制过去(内容上正确)+只读 search/decompress 回退——与匿名车道 [bug] Fork ("new session from here") replays the parent's compress events but loses bili's block state — context re-inflates and search_context goes blind #3925 已确立的风险画像一致(mis-guessed parent 最多只读、永不误采)。
  3. 场景 B(prefix break)与 A 不同形:其 incoming 比父链长但内容在某处断掉,定位分叉 cell 需要升级到 0.1.212 后由 describeResumeMiss 提供 cell 号(感谢 OP 主动提出补数据)——列为本票独立清单项,不混进本次修复。
  4. **F4(preflight fail-fast 止血)/ F5(summarizer 降级折叠)**属另一失败域(preflight 预算 / 摘要器降级),不进本 PR,列本票清单跟踪。

修复方案(F1+F3):

接下来推分支开 PR,链接回帖。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

**PR 已开:https://github.com/ranxianglei/billion-context/pull/5748**(分支 2026-11-05_fork-prefix-adoption,master head 0aace2f20 之上单 commit)。CI 跑完我再回帖结果。

按八问:

  1. 是什么问题:宿主 fork 会话时子会话拿到新 id、内容是父链的前缀副本(等深或更短),而三条收养路径都只接受「严格更长」——identified 客户端的 fork 子会话因此零压缩状态继承,整份父历史原样重放;多模态父会话进一步烧完 preflight 后 413。
  2. 什么原因导致的:Claude 上 resume 导致消息错乱 #1486 resume-inheritance 门建模的是「resume = 续写」(incoming 必须比父链长),fork 是前缀副本,结构性必 miss;且 lineageOf() 的结果只在匿名车道计算,identified 请求从不持久化 → derivedFromSessionId 永不落盘 → fix(sessions): wire-neutral affinity hashing for cross-protocol continuity (#2791) #2807 boot reconcile 永远等不到它。是方向性缺陷,不是阈值问题。
  3. 影响范围与严重程度:所有「带客户端 id 的纯代理车道 fork」(ZCode GUI fork 等);p1——子会话零继承、缓存命中归零、被迫 degenerate fold;多模态父直接 413 不可用。
  4. 怎么修复的:新增 findForkParent() 检测两种 fork 形状——equal-depth(渐进哈希全量验证,任意深度密码学确定)与 prefix-of-chain(可见窗口逐字节一致;零重叠=诚实未知不猜);在 strict miss 之后、无声明父时尝试,命中即复用既有 maybeAdoptResume COPY 语义收养(逐块 raw-id 判定,误判最多复制源字节就在子 incoming 里的块,不能错绑);diagnoseResumeMiss 新增 kind prefix-of-chain,miss 日志可归因。
  5. 是否有回归问题:strict resume 路径先跑、逐字节不变;fork 路径只在 strict miss 且无声明父时触发(声明父由 [pi plugin] Prime RLM inline 派生子会话在代理模式下零继承:搜不到也解压不了父会话压缩块(billion-context-pi#531 同场景) #1333 弱路径无条件覆盖,未动)。正反双向测试钉住(Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617):7 个新 findForkParent 用例(两形状、超 cap 边界、零重叠诚实拒绝、窗口内断点拒绝、deeper/self/sub-floor 负例、deepest-wins、hv1 域)+诊断套件按新 kind 更新。本地定向套件绿、typecheck/build 干净;claude-fork-lineage/derived-fork-block-inheritance hermetic 套件在本环境 clean master 上同样失败(预存环境问题,与本 diff 无关),以 CI 为准。
  6. 是否破坏缓存:不涉及——只改子会话首请求的存储层 refs/blocks 继承,wire 字节、重试、增量游标、去重键均未触碰。
  7. 是否改了设计方向:无转向——补上 identified 车道与匿名车道 Design: tree-shaped prefix affinity — forked branches inherit the shared prefix's compression state #629 lineage 收养对应的缺口;kernel、配置面、wire 协议零改动。
  8. 是否引入新配置:无。复用既有 resumeInheritance 开关(关掉则 fork 检测同样关闭)。

行为变更披露(有意):① identified 客户端 fork 会话的首请求从「fresh start(零 refs/blocks/lineage)」变为「继承父 refs+fully-present blocks+lineage」(与 resume 同待遇);② [resume-inheritance] miss: 日志措辞调整——equal-depth/prefix-of-chain 从「rejected by design」改为「fork 形状、可被 fork 继承」,truncated 拆分为 verified-prefix / 断点 / 零重叠三种表述;③ via 标签新增 fork equal-depth (…) / fork prefix-of-chain (…)。

残留(本票清单跟踪,不在本 PR):场景 B(incoming 比父链长但内容断掉)需要升级到 0.1.212 后由 describeResumeMiss 给出分叉 cell 号才能定位——OP 升级后重做 B 场景贴一下即可;F4(preflight fail-fast 止血)与 F5(摘要器降级折叠)属另一失败域,待本 PR 落地后单独处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本轮红 CI 处理结论:无需改代码,rerun 后全绿

本轮唯一红项 = test (ubuntu-latest, 24, 2)(run 42018590864,head 02987a9)。诊断与处置:

七问:

  1. 是什么问题:不是代码缺陷——msgid-lane-flow 套件的间歇竞态(settle 时序)让一个 shard 误红。
  2. 什么原因导致的:CI 负载下该行写入的异步 flush 时序竞态,属已知 flake(今日两条其他 PR 同签名,均重跑转绿)。
  3. 影响范围与严重程度:仅影响本 PR 的 CI 信号一次,产品行为零影响。
  4. 怎么修复的:无需代码修复;rerun 失败 job,attempt 2 全矩阵绿。
  5. 是否有回归问题:无。本轮零代码改动;分支实质内容(fold-reconcile 修复)在上一 head 已由全矩阵验证过(merge ci-fixes 后除本 flake 外全绿)。
  6. 是否破坏缓存:不涉及。
  7. 是否引入新配置:不涉及。

判定:PR #5737 在 head 02987a9 CI 全绿,可进入 owner 审阅/合并流程,无待决策项。

…plained episodes

Review finding on the #5715 PR: the new one-per-episode info note fired in
ADDITION to the existing benign notes whenever an explained mass episode
(shape churn / head truncation / tail rewind) also happened to keep a strict
direct-ID majority of covered ids — e.g. a host dropping the oldest ten turns
of a thirty-turn covered span logs BOTH the #2695 truncation note and the
#5715 'partial interior loss' note, the latter mislabeling a head cut as
interior loss (verified by fixture replay: two info lines per episode where
master logs its original surface). Gate the note on !shapeExplained &&
!truncationExplained && !tailTruncationExplained so explained episodes fall
through to their pre-existing log behavior byte-for-byte; the unexplained
majority-partial-loss case (the actual bug) is untouched. Regression test
pins the no-double-report shape.

@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)

Verdict: APPROVE / 可合(GitHub 禁止作者自批,按舰队惯例以 COMMENT 态评审提交;合并由 owner 人工执行)— the fix names the producer and fixes it at the decision point: the classifier's totalDrift verdict itself is deliberately left untouched (preserving #3641's drift-streak / frozen-witness coupling), but the escalation path now consults the one dimension the old code ignored — how many covered ids still ride verbatim on the wire — and a latched epoch-confirm gets an auto-clear condition. Independent verification performed:

  1. Direction (①): the root cause was that escalation keyed only on plan.claims.size===0 && realUnmatched.length>0 and never counted surviving direct matches, so a 1162/1171 survivorship read as total drift. The new hardDirectMajority predicate (presentHard >= MIN_RESYNC_RUN && 2*presentHard > coveredHard, denominator = covered ids minus separators / expected rebases / reasoning) encodes exactly the issue's thesis. Replay of the #5715 shape (30-turn covered span, ten interior turns gone, claims/sim both empty): master escalates after 3 passes and latches foldEpochConfirmPending=true; this head stays clean and logs one info note per episode.
  2. Regression pass (②) over the touched path's pre-existing behaviors: the three explainer families (#2695 head truncation / #3724 tail rewind / shape churn) each keep their own one-per-episode note and their original log surface — byte-for-byte parity with master verified by replay (see the spot fix below); wholesale replacement (presentHard≈0) still escalates — pinned by the negative-control test, so genuine epoch drift is not masked; the drift-streak accumulation, frozen-witness logic, and preflight read site are untouched; no wire bytes, stamps, or storage formats change.
  3. Tests (④): the new doctrine cases have teeth — the escalation case fails if the gate is inverted (proven by replaying the same fixture against master's src/fold-reconcile.ts: it escalates and latches), and the regression test I added pins the no-double-report log shape. Full-suite verdict = CI lanes on this head: green (17 success / 13 platform-skipped / 0 failed at c39dffb6d).
  4. Diff cleanliness (⑤/⑤b): fix commit is 2 files (+48/-1 src, +66 test); the ci-fixes merge carries the sanctioned dsh-pin realignment (#4599 convergence work, labeled as such in its commit). Naming, comments, and style match the surrounding module.

Behavior-change disclosure (old → new):

  • Partial interior loss where a strict majority of covered ids still rides verbatim: before — after 3 passes the session latched epoch-confirm and preflight paused compression permanently (the #5715 bug); after — classified as healthy substrate, no latch, no pause. This is the intended fix.
  • Unexplained mass-regime majority (≥10 non-reasoning unmatched, majority surviving, no explainer): before — repeated per-pass warn lines; after — one info note per episode. Log-surface only, no decision change beyond the first bullet.
  • Explained episodes (truncation / tail rewind / shape churn): unchanged — identical log surface to master.

已顺手修:#5715 的 info note 原本也会在「已有解释」的回合上叠加输出(宿主裁掉覆盖段最老的十轮时,同轮既打 #2695 截断 note 又打一条把头部裁剪误标为 "partial interior loss" 的新 note——用 fixture 回放对照 master 原日志面证实了双行);给新分支加上三个解释器谓词门控,已解释回合落回原有日志行为,并补了一条钉住「不双报」形状的回归测试。+ commit c39dffb


结构化八问

  1. 是什么问题:折叠覆盖段里绝大多数消息仍逐字在网线上、只有少量中间回合缺失时,reconcile 层把它误判成「整体漂移」,连续 3 轮后锁死 epoch-confirm,该会话的压缩从此被 preflight 永久暂停(fail-fast 502、0 compressible ranges)。
  2. 什么原因导致的:升级判据只看 claims==0 && unmatched>0,从不数仍在网线上逐字存活的 id——99% 存活被读成 100% 漂移;且锁死后的持久化 pending 状态没有清除条件(旧 reset 只在 prevStreak≠0 时触发)。
  3. 影响范围与严重程度:任何插件车道会话,只要宿主丢掉少数中间回合而保留压倒性多数(DSH 报告,Windows,bili 0.1.212)即触发 → 该会话压缩能力永久不可用、需人工介入 = p1 可用性缺陷。
  4. 怎么修复的:新增单一 hardDirectMajority 谓词(逐字存活的 covered id ≥3 且严格过半),用在三处:为真时不升级、为真时自动清除已锁死的 epoch-confirm、为真时每回合一条 info note 代替升级。totalDrift 本身有意不动,保住 #3641 的诚实丢失语义。
  5. 是否有回归问题:审过触碰路径的既有行为——三个解释器家族(#2695/#3724/形状抖动)的 note 与日志面与 master 逐字节一致(回放验证);全量替换仍会升级(负控制测试钉住);漂移计数/冻结见证/preflight 读取点未动;无 wire/时序/阈值漂移。
  6. 是否破坏缓存:不涉及——不改 wire 字节、戳、存储格式,仅分类决策与日志行。
  7. 是否改了设计方向:不涉及——同一分类器架构,升级前多查一个证据维度;kernel/ 未触碰。
  8. 是否引入新配置:不涉及。

判定:可合。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #5737 审核完成:APPROVE / 可合。

ci-check added 2 commits November 9, 2026 17:22
…ge only (#5715)

A field report on an independent 0.1.213/Linux-DSH session confirmed the same
mechanism and surfaced a residual class the first cut missed: ids from a
successfully REWOUND inactive compression block (#4050 view-deactivated
lineage, re-fed into `covered` via recoveryCandidateIds) legitimately leave the
wire after a rewind. Counting those absent inactive recovery candidates in the
denominator dilutes a healthy active direct-ID majority below the bar and
re-latches epoch-confirm on a live session.

Compute hardDirectMajority over ACTIVE coverage only (the coveredIdsOf
caliber), not the full `covered` set. totalDrift is still left untouched — the
#3641 drift streak + frozen witness keep a genuine mid-history edit reading as
honest loss (zombie accrual); only the terminal verdict is gated. The strict
> half tie-breaker is kept: a repeated exactly-half loss still escalates, which
is safer than inferring health from "not obviously lost".

Adds three doctrine tests: absent inactive recovery candidates cannot dilute a
healthy active majority; reasoning-only survivors do not mask a hard text loss;
exactly-half present is not a clear majority (strict boundary).

@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)

Verdict: APPROVE / 可合(GitHub 禁止作者自批,按舰队惯例以 COMMENT 态评审提交;合并由 owner 人工执行)

Round-2 review at head 3298cd8ff7, re-done end-to-end after the master sync and the new commit 3298cd8ff7 ("run the surviving-majority test on active coverage only").

What changed since round 1 (c39dffb6d3)

  • 5a91fd9b89 — merged current master into the branch. Its contribution to this PR's own files is exactly ONE line: a doc-path comment fixup in src/fold-reconcile.ts:35 (MESSAGE-IDENTITY.md → docs/message-identity.md, from the docs centralization). No conflict-resolution surface in src/fold-reconcile.ts or its tests; my round-1 log-surface gate survived intact (src/fold-reconcile.ts:2465-2467).
  • 3298cd8ff7 — narrows the hardDirectMajority base from the full covered set (active ∪ #4050 recovery lineage) to ACTIVE coverage only (coveredIdsOf caliber, frozen into a separate never-mutated activeCovered; covered keeps its mutable role for the claim ladder and the early-return reset). Triggered by the independent field report on #5715 (0.1.213/Linux-DSH): ids from successfully rewound inactive blocks legitimately leave the wire, and counting their absence in the denominator dilutes a healthy active majority below the bar and re-latches epoch-confirm on a live session.

Direction check: the commit names the producer. Recovery candidates are "recoverable-but-gone" (#4050 view-deactivated lineage re-fed via recoveryCandidateIds) — their post-rewind absence is legitimate history, not substrate destruction, so they were a category error in the majority denominator. Narrowing the base only moves the ratio toward health when the live substrate is healthy; it cannot mask a real collapse because wholesale replacement has ~0 directly-present ACTIVE ids (negative-control test pins escalation). totalDrift stays untouched (#3641 drift-streak/frozen-witness zombie accrual preserved); the strict >half tie-breaker is kept with an explicit boundary test.

Regression audit (pre-existing behaviors on touched paths)

  • Escalation gate (src/fold-reconcile.ts:2410), stale-latch auto-clear (:2209), and the mass-bar log branch (:2465) all consume the narrower base — intended, disclosed below.
  • Early-return reset (covered.size === 0) still uses the FULL set ✓ unchanged; claim ladder, per-block coverage, anchor bookkeeping untouched.
  • A session whose substrate is entirely inactive lineage can never benefit from the gate (empty active base ⇒ no majority) — conservative direction, consistent with the doctrine "under-detecting a real collapse is worse than one confirmable prompt".
  • Behavior change old→new (disclosed per §4 deliverable 4): the majority base changes from active∪inactive-recovery to active-only; consequently sessions with a healthy active direct-ID majority plus large absent rewind residuals no longer latch/pause (they could before), and the info note's ${presentHard}/${coveredHard} now reports the active-caliber ratio. No config surface, wire shape, persistence format, or kernel change.

Tests: three new doctrine tests. Teeth verified empirically: replaying the new test file against the PREVIOUS head's source fails exactly one test ("absent inactive recovery candidates cannot dilute a healthy active majority", 15/16), passes at this head (16/16) — the narrowing is pinned. The other two pin pre-existing rules (reasoning excluded from both numerator and denominator; strict >half boundary) and pass on both heads. Local at this head: doctrine 16/16, all 26 fold-reconcile-surface test files 314/314, npm run typecheck clean. CI at 3298cd8ff7: at posting: 6 success / 11 skipped / 0 failed / 13 still in flight (test shards + static-gates) after ~20 min of monitoring — no failure observed in any completed lane.

One record-only observation (no action owed): the PR body predates 3298cd8ff7 and still describes the majority as computed "over the covered set"; the authoritative up-to-date description is in the commit message and the author's follow-up comment on #5715. Noted for the merge record only.

结构化八问:

  1. 是什么问题:长 DSH 会话的活跃直接 id 多数健康,但成功 rewind 后失活的压缩块(#4050 谱系)其 id 合法离开 wire;首版把这些「可恢复但已离场」的残差算进多数分母,把健康的活跃多数稀释到阈值以下 → 误判 total drift → epoch-confirm latch → preflight 永久暂停压缩(现场:0.1.213/Linux,foldDriftStreak=70、0 compressible ranges)。
  2. 什么原因导致的:多数基数取错口径——本应只用 active 口径(coveredIdsOf),却用了 active∪inactive-recovery 全量;inactive recovery 候选只增分母不增分子。
  3. 影响范围与严重程度:仅「活跃直接 ID 多数健康、且失活残差多到足以翻转多数判定」的长会话;此前会被误 latch 而暂停压缩(可用性缺陷类),触发条件比首版 bug 窄得多。
  4. 怎么修复的:基数收窄为 active-only(冻结成独立对象,不动原 covered 的可变用途);仍只在终局判决处 gate(!hardDirectMajority)+ 残留 latch 自动清除 + mass-bar info note;totalDrift/streak/frozen witness/zombie 机制一律不动;严格 >half 平局裁决保留并有边界测试钉住。
  5. 是否有回归问题:审过既有行为——early-return reset 仍用全量 covered;claim ladder / per-block coverage / anchor 记账未动;真·整体替换负控仍会 escalate;首版日志面门控在 master sync 后原样存活(src/fold-reconcile.ts:2465-2467)。行为变更(已披露):基数口径 active∪inactive → active-only,「活跃健康 + 大量失活残差」类会话不再被 latch。
  6. 是否破坏缓存:不涉及——无缓存、重试、增量游标、去重键改动。
  7. 是否改了设计方向:没有——与首版同一机制(只 gate 终局判决、不放宽 totalDrift),仅修正基数口径;架构/边界/数据流未转向。
  8. 是否引入了新的配置:没有。

判定:可合(合并由 owner 人工执行)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Round-2 review of PR #5737 at new head 3298cd8ff7 complete: APPROVE / 可合(COMMENT 态正式评审,id 5825088984;合并由 owner 人工执行)。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][DSH] Partial interior loss is classified as total drift despite surviving direct-ID majority, latching compression off

1 participant