Repository navigation
[PR] fix: reject signature-only non-local snapshot-render seams that truncate recent history (#5632) - #5639
[PR] fix: reject signature-only non-local snapshot-render seams that truncate recent history (#5632)#5639ranxianglei wants to merge 1 commit into
Conversation
…ry (#5632) MIN_SEAM_RUN (=2) counted consecutive chain matches of EITHER class (byId fast path or identity-signature fallback). Two adjacent uncovered old rows whose byte-identical twins sit at the client tail boundary (host re-minted their ids => byId miss, bySig hit) therefore reached run=2 and pinned the join deep in the transcript -- silently dropping every genuinely-recent row above it from the outbound view. Track whether the run carries an exact-id cell (idAnchor). A seam resting solely on signatures may not drop more transcript rows than it verified (gapAbove > run) unless it is id-anchored or reaches MIN_NONLOCAL_SIG_SEAM_RUN (=3). Local seams (join at/near the transcript end) keep today's behavior. Preserves #3812 (lone-match rejection, checked first) and #4052 (covered-row bind exclusion, untouched). Degrade instead of guess -- the safe direction. Regression tests (both directions, #3617): the constructed shape degrades to legacy; an id-corroborated twin of the same shape renders; a local run=2 pure-sig seam still renders; a run=3 pure-sig non-local seam renders.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8075-pr.5639.4458dd1This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5639.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm/qwen3.8-27b) 查重: 不重复。这是 #5632(分析 #5576 时发现)的修复 PR,给 snapshot-render D 车道补第三道 seam 门。与既有 #3812(单匹配拒绝)、#4052(covered 行绑定排除)同属一个门族但机制互补、不重叠:#3812 只拦 run<2、#4052 只排除 covered 绑定,二者都不覆盖「run≥2 的纯签名深位双重复」——本 PR 正是补这个缺口,不是重做已有工作。 标签: 我拉了分支 八问
测试有效性:4 个新例构成新门的完整真值表(#3617 正反成对)。手工推演确认:例 1 复现原 bug、pre-fix 会红(渲染截断而非降级)有牙;例 2/3/4 分别钉住 id 锚点任意深度可信 / locality carve-out / 阈值提到 3 的边界,防未来过紧或误删条件。 CI 状态(head |
(ai: vllm-qwen/qwen3.8-27b) APPROVE — 修到根因、失败方向安全、测试有牙、行为变更已披露。逐行读完 diff、手推四个新用例的判决表、grep 验证范围声明、本地定向验证(三个 render 测试文件 27/27 通过、typecheck 干净)后,无阻塞项。 结构化八问
行为变更披露(旧→新):run=2 纯签名深接缝这一形状——旧:渲染被截断的视图(即 bug 本身);新:降级为 legacy 客户端全量视图,reason= 范围声明验证:grep 确认 fastpath.ts/fastpath-scan.ts 无任何 run/连续/回溯链/接缝门——#5576 v6 水位车道用的是独立机制(元素计数 + 账本宽度 + 头部校验),缺陷只在快照渲染车道的 buildView,单文件单点修复即全覆盖,声明属实。 非阻塞观察(非本 PR 引入,未动代码):tests/verif-snapshot-render.test.ts 的符号化 SMT 测试在装有求解器的环境会失败——翻译层在 buildView 入口的 判定:可合并(APPROVE)。 【协调】review-worker-r1 完成:PR #5639 审阅完毕,APPROVE,无阻塞项,无需决策路由。 |
(ai: vllm/qwen3.8-27b) CI 终态确认(head 补充澄清:中途一度看到的 2 个 收工判定:代码审核通过(八问见上条)+ 测试有牙(4 例真值表,手工逐格推演一致)+ CI 全绿 → 可合。合并仍按规矩由人操作,我不代合。 |
(ai: vllm/qwen3.8-27b) 收工确认(详细八问见本线程前两条回复):PR #5639 验证完成,可合。
合并仍按规矩由人操作,我不代合。 |
What / Why
buildView的 seam 对齐(snapshot-render D 车道出站前缀渲染的核心)用MIN_SEAM_RUN = 2作门槛,但回溯链的run++对 byId 快路径 和 identity-signature 回退 两类命中都计数。于是两条相邻 uncovered 旧行的字节级孪生体(宿主重铸了 id → byId 必 miss、走 bySig)落在深位时刚好凑满 run=2,join 被钉在深位,join 之上的所有更新行被静默丢弃——出站 wire 上模型看到「远古前缀 + 重复旧消息」,丢失全部真正最近的历史。#3812 只拦 run<2(单匹配)、#4052 只排除 covered 行绑定;两道门都不覆盖 run≥2 的纯签名深位双重复。
来源:分析 #5576(Native-Identity Fastpath)时发现。
Fix
给 run 记录「是否含 byId 锚点」(
idAnchor)。新增一道深度门:当 seam 纯签名(run 内无任何 exact-id 单元格)且非局部(丢弃的行数gapAbove > run)且 run < 3 时,降级到 legacy 直传。等价表述:签名-only seam 必须满足其一才允许丢弃历史——带 ≥1 个 exact-id 佐证 / join 贴近 transcript 尾(局部)/ run≥3。局部 seam 保持现状不变。行为变更(old → new)
run=2 的纯签名 deep seam(丢弃行数 > run、无 id 佐证):
reason="seam-unverified-depth"),下一轮客户端重发即自愈。这是本修复本身,不是副作用。凡 id 佐证 / 局部 / run≥3 的 seam,行为完全不变。
范围澄清(与 issue 原文的一处出入)
issue 原文说该 aligner 同时服务 D 车道与 #5576 的 v6 canonical watermark 车道。当前 master 中 #5576 已合入,
fastpath.ts改用独立机制(元素计数 T + ledger tail-id 宽度 + head 校验,见fastpath-scan.ts),不再走 id/sig 回溯链——因此本缺陷只存在于 D 车道buildView,v6 车道不受此门影响。修复范围就是src/server/snapshot-render.ts一处。(已 grep 确认fastpath.ts/fastpath-scan.ts无 run/consecutive/backward-chain 门。)Tests
tests/snapshot-render-chain.test.ts新增 4 例(#3617 正反成对,构成新门的完整真值表):seam-unverified-depth;既有 #4052/#3812 用例全绿。本地定向跑(
snapshot-render-chain/snapshot-render/snapshot-shadow三文件共 27 pass)+npm run typecheck干净;全量回归以远程 CItest车道为准。Config surface
未新增任何 config / env / CLI 字段。
Closes #5632