Skip to content

[PR] fix: snapshot-render — covered rows no longer accept signature binds (#4052) - #4057

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-21_snapshot-sig-covered-bind
Oct 21, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-21_snapshot-sig-covered-bind

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4052

问题

快照渲染 D 车道的反向链路里,bySig 签名兜底(role|contentType|text,不含 id)会把一条全新的消息(新 id,byId 查不到)绑定到一条已被摘要覆盖的旧行上。covered 行本来就被 anchor 替换、不渲染,而 clientJoin 又指到了这条新消息之后——于是这条新消息的内容从出站视图里整体消失,模型看不见用户最新说的话,没有任何报错。verif 符号执行(judge C1「tail 内容不得丢失」)给出 SAT 反例,真代码回放确认(issue 内含最小复现)。

与 #3812(identitySig 太弱,#3817 已修)同族不同果:#3812 是中间历史被截断,这个是最新消息内容直接丢失。#3817 的 MIN_SEAM_RUN/单隙容忍没有拦住它,因为 sig 命中计入了 run、容忍隙桥接了矛盾。

修法

src/server/snapshot-render.ts buildView:

  • covered 行不再进入 bySig 候选(一行过滤);byId 保留 covered 行——精确 id 无歧义(kernel 契约:id 永不复用),稳态接缝依赖它。
  • covered 区计算(blockSeeds/coveredSeqUnion)从 anchor 合成处前移到反向链路之前(数据依赖),anchor 合成改为消费预计算的 seeds,逻辑等价。

为什么选「排除 covered」而不是 issue 选项 3(sig 加 id):升级轮(#3752 id re-mint)里,被覆盖行的 twin 本来就该失去 sig 绑定——链在覆盖区上缘断开、join 停在边界、覆盖区仍随前缀渲染在 anchor 之后(有界降级,永不丢失);而 sig 加 id 会连未覆盖行的 twin 路径一起杀掉。

行为变更披露

  1. covered 行不再接受签名绑定:此前「接缝完全依赖 covered 行 sig 命中」的会话(典型:可命中的行恰好全被折叠)从渲染变为降级到 legacy(chain-not-started/seam-too-short,客户端视图原样出站,无损)。稳态(id 稳定)路径与未覆盖 twin 路径字节级不变。方向是保守的:宁可降级也不猜。
  2. block-unanchored 检查从链后提前到链前:同时命中两种情况的会话,degrade reason 标签可能变化(结果同为 legacy,纯观测面)。
  3. Snapshot rendering identity signature does not include message ID: duplicate short messages silently truncate history (m | 快照渲染身份签名不含消息 id:重复短消息会静默截断历史(开灰度前必须修) #3812 测试里「重复短文本 + 稳定 id」的形状:此前 seam-too-short 降级 → 现在验证通过直接渲染(id 链承载全史,碰撞的新消息走 tail)——该形状正是 Snapshot rendering: When the text of a new message is identical to that of an already-compressed message, the entire mes | 快照渲染:新消息与已压缩消息文本相同时被整条丢弃(模型看不见这条最新消息) #4052 复现形状,修复后引擎比降级更优。相应更新了 tests/snapshot-render.test.ts 断言(无损断言保留并加强:tail 的新消息必须可见)。
  4. shadow 车道 stake-4 测试改为 epoch-rewrite 形状(chain-not-started):原 Snapshot rendering identity signature does not include message ID: duplicate short messages silently truncate history (m | 快照渲染身份签名不含消息 id:重复短消息会静默截断历史(开灰度前必须修) #3812 形状不再触发降级;中段部分重写在本 harness 下 store tail view 不收敛(settleRows 超时),无法驱动。seam-too-short 的钉由新增单元测试覆盖。

测试

A genuinely new client message whose role|contentType|text matches an already-summarized row was signature-bound onto that covered row; the anchor then replaced the row while clientJoin sat past the new message, so its content vanished from the outbound view (model never saw the latest user message). verif judge C1 counterexample, confirmed on real code.

Covered rows are now excluded from bySig candidates only (byId keeps them — exact ids are unambiguous and steady-state seams rely on them). Covered-region computation moves before the backward chain so the filter can see it; anchor synthesis consumes the precomputed seeds. Seams that rested solely on covered-row sig hits now degrade to legacy instead of guessing.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-21_snapshot-sig-covered-bind (184e548)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4839-pr.4057.ff68259

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: snapshot-render — covered rows no longer accept signature binds (#4052) [PR] fix: snapshot-render — covered rows no longer accept signature binds (#4052) Oct 20, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。 扫了全部 100 个 open PR + open/closed issue:本 PR 是唯一触碰快照渲染 covered 行 bySig 绑定的条目(相近标题的在途 PR——#4056/#4053/#4005 是 cache-seam 计量、#3742 是折叠延迟物化、#3311 是 thinking 回收——机制均不同);对应缺陷 #4052 是本 PR 的修复对象(Closes #4052),同族 #3812/#3817 已关闭。

标签: bug / scope/kernel / p1(出站内容丢失类,按 owner 规则 2026-10-19 定 p1;D 车道跨全部代理车道,不打客户端标签)。

本 PR 由本 daemon 前一会话实现(#4052 讨论 3-5 楼有过程记录)。现按 PR 审核规范独立复审——逐段读 diff、人工重放反向链逻辑、核对测试牙齿,不复用 issue 侧结论。本地定向验证与 CI 状态核查进行中,随后给结构化八问结论。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR 复审结论(独立重审,非复用 issue 侧分析)

总判定:代码过审,可合(人工合)。 修法打在根因上、最小且保守;测试有牙且双向;逐项回归清点无意外破坏。CI 当前红与本 diff 无关——是 #4049 跟踪的既有 #3769 存储回归套件 flake 家族(证据链见下),rerun 或等自然绿即可拿到干净信号,本 PR 侧无需改码。

结构化八问

  1. 是什么问题:快照渲染 D 车道下,客户端最新消息若与某条已被摘要覆盖的旧行 (角色+类型+文本) 完全相同,这条最新消息会从出站视图整体消失——模型看不见用户刚说的话,无任何报错。
  2. 什么原因导致的:反向链路 bySig 兜底的签名键 role|contentType|text 不含 id,且候选行没有排除 covered 行。真正的新消息(byId 查不到)经 sig 命中一条 covered 行;covered 行本就被 anchor 替换不渲染,而 clientJoin 指到新消息之后 → 内容被吞。[PR] snapshot render: seam hardening — no silent truncation on repeated short texts (#3812) #3817 的 MIN_SEAM_RUN=2 没拦住:sig 命中计入 run、一次容差隙桥接了矛盾。verif C1 符号执行给出 SAT 反例钉住这个残留洞。
  3. 影响范围与严重程度:仅 D 车道(snapshotRender rollout)+ 会话有 active 摘要块 + 客户端最新一条与某条 covered 行 role/类型/文本全同——典型如用户重发同一句短话(「继续」「好的」)。p1 类(出站内容静默丢失);窗口限当轮(下一轮新消息落库后 byId 可定位、自愈),但当轮模型是在缺失最新指令的状态下行动的。
  4. 怎么修复的:covered 行从 bySig 候选中排除(一行过滤);byId 保留 covered 行(精确 id 无歧义——kernel 契约 id 永不复用——稳态接缝依赖它)。covered 区计算因数据依赖前移到反向链路之前,anchor 合成改为消费预计算 seeds,逻辑等价。为何不选「sig 加 id」(issue 选项 3):升级轮里被覆盖行的 twin 本来就该失去 sig 绑定——链在覆盖区上缘断开、join 停在边界、覆盖区仍随前缀渲染在 anchor 之后(有界降级,永不丢失);sig 加 id 会连未覆盖行的 twin 路径一起杀掉。
  5. 是否有回归问题:审过的既有行为及结论——① 稳态接缝(id 稳定):字节级不变(T4 钉;我人工重放确认 byId 路径逐格不变);② 升级轮未覆盖行 twin 的 sig 恢复:完好(T2 钉);③ covered 行 twin:失去 sig 绑定 → 降级 legacy(有意变更,已披露,方向保守:宁可降级也不猜);④ block-unanchored 检查从链后提前到链前:仅当两种情况同时命中时 degrade reason 标签变化,结果同为 legacy(纯观测面,无 success→failure 翻转可能);⑤ Snapshot rendering identity signature does not include message ID: duplicate short messages silently truncate history (m | 快照渲染身份签名不含消息 id:重复短消息会静默截断历史(开灰度前必须修) #3812「重复短文本+稳定 id」形状:原 seam-too-short 降级 → 现在直接渲染(该形状正是 Snapshot rendering: When the text of a new message is identical to that of an already-compressed message, the entire mes | 快照渲染:新消息与已压缩消息文本相同时被整条丢弃(模型看不见这条最新消息) #4052 复现形状,引擎优于降级;无损断言保留并加强);⑥ shadow 车道:纯观测、从不改出站字节(stake-4 换 epoch-rewrite 形状已披露);⑦ 高危模式逐项过:无 fail-fast→吞错、无阈值/时序/输出格式漂移(除上述披露项);plugin 车道结构性不受影响(pluginMode 早退,两种压缩模式都已考虑)。结论:无意外回归。
  6. 是否破坏缓存:不涉及——只动 D 车道渲染决策面,不碰前缀缓存键/重试/增量游标/去重键;稳态路径输出与修复前字节一致。
  7. 是否改了设计方向:没有。仍是「顺序为中心、hash 为辅助」+「失步降级不猜」;本次只是关掉签名兜底里唯一能造成丢失的绑定通道(covered 行候选)。
  8. 是否引入新的配置:无。无新 env/config/默认值。(新测试用的 _setStoreForTest 是既有测试缝,src/persist.ts:3033,非本 PR 引入的生产面。)

测试有效性

新增 6 例直跑 maybeSnapshotView:T1 复现形状(pre-fix 实测失败,我按修复前代码逐步重放确认视图确实丢 "D")+ 5 个双向 gate 钉(未覆盖 sig 路径完好 / 中段覆盖区不断前缀 / 稳态 byId 不变 / 仅 covered 命中时保守降级 / MIN_SEAM_RUN 存活)——六例我全部手工推演过,逻辑均成立,断言有牙、bug 复发能抓住。集成层无损钉加强(新「继续」必须可见,且 covered 副本被抑制后它只能来自 tail)。shadow stake-4 换 epoch-rewrite 形状并诚实注明中段重写在该 harness 下不可驱动的原因。

CI 状态(关键核查项)

Head 184e5489b 的 CI 红 = 4 个 node-22 test 分片,每片恰好一条失败,全部落在 #3769 存储回归套件(issue3769-upgrade-compat.test.ts:179 'record hydrates before the upgrade turn' 与 issue3769-pooled-bare-load.test.ts "(#3769 flake)")。判定与本 diff 无关的证据链:① 本 diff 只触碰 snapshot-render 及其三个测试文件,与 loadSync/hydration 零共享代码路径;② 本 head 上这两个文件本地定向跑 2/2 通过;③ master 自身在同一 base 提交(bc4a3f87e)的 run 39483978971(19:30Z)就有 9 个分片红,含同样两个测试的同签名断言——该家族已由 #4049 跟踪(#4037/#4044/#4045/#4053 等多个零存储域重叠的 PR 均被拖红的证据链在案),我已把 PR #4057 这条证据链补进 #4049。→ 红不是本 PR 的回归,不应阻塞合并判定;rerun-failed-jobs 或等自然绿即可。

本地验证(实测)

typecheck 干净(exit 0);三个 snapshot 套件定向跑 23/23 绿。全量回归以 CI 为准。

收工判定:可合并(人工合并,本 PR 触及出站消息形态与身份绑定面,不走自动合并)。

@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.696-master.7b8e6ed (rolling master tag).

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

ranxianglei added a commit that referenced this pull request Oct 21, 2026
[PR] verif: flip #4052 pin to fixed expectation after #4057 + object-destructuring for-of | verif: #4057 落地后翻转 #4052 回归钉 + for-of 对象解构支持
yanhuojiyusheng pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Oct 21, 2026
…nding for-of support

ranxianglei#4057 (merged) excludes covered rows from bySig candidates. The judge now
proves the tail survives even when its (role|ct|text) collides with a
covered row — C1b flips sat→unsat and becomes a regression pin for the
fix itself (sat again = covered-row exclusion regressed).

The ranxianglei#4057 refactor also introduced `for (const { blockId, seqs:
blockSeqs } of blockSeeds)` in buildView's anchor synthesis — the
translator's for-of binder only understood identifiers and array
patterns. Added ObjectBindingPattern support (property read via the
member fan, rename via propertyName) mirroring the VariableStatement
arm, so snapshot-render stays in the guarded set with zero degradations.

Suite: 29/29 with solver (guard 2 / smoke 3 / directed 8 / generic 1 /
induction 2 / view-latch 2 / conflict-watch 4 / anthropic 3 / google 3 /
snapshot-render 2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p1 scope/kernel

Projects

None yet

1 participant