Skip to content

[PR] feat(fastpath): v6 render-snapshot plane — steady turns skip the full-view scan (#5664) - #5689

Merged
ranxianglei merged 11 commits into
2026-11-04_fastpath-v6-msgidfrom
2026-11-04_render-snapshot
Nov 5, 2026
Merged

ranxianglei merged 11 commits into
2026-11-04_fastpath-v6-msgidfrom
2026-11-04_render-snapshot

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

#5664 — fastpath v6 render snapshot:出站渲染平面(按 #5643 §5 规范流转顺序重建)

设计基准:#5643 补充裁定(owner,2026-11-05)§「规范流转顺序」——所有平面每轮走固定链:

原始字节 → to core 通用协议 → 内核改写 → apply 到快照 → to 目标协议 → 出站

本平面(station 2/3)是这条链上第一个允许驻留的缓存点。本分支已按该裁定重写:行内只驻留「内核改写后的通用核形态」(CoreMessage),映射层之后一个字节都不缓存。

这个平面缓存什么、不缓存什么

缓存(pf_render 表,每 sid 一张,append-only):每个存活元素一行的改写后通用核形态 JSON + 累计账本(est/text/img)。这是链上唯一能经受住模型/maxDim/toolArmed/voice/harden/序列化全部变化的边界——它们统统发生在行右侧的映射层里,逐轮用当轮输入重跑。

不缓存:映射后 wire 字节、序列化结果、任何目标协议形态。推论:族内切模型下一轮天然过一遍映射层,身份平面不需要为它设任何事件;RenderCaps 因此收缩为 {v, strategy, droppable, multimodal}(strategy/droppable/multimodal 改变的是改写输出本身)。

防错机制(全部 fail-soft,宁可整轮回退不猜)

  • tripwire 落在核心形态边界:绿轮把本轮窗口重写的 F 个核与存储后缀在核心形态上比对——不符 → 本轮 legacy 全量路径(无修复写)。
  • no-recast 制度(2026-11-05 封版):存储严格 append-only + 一次性 arm cast(仅空表);结构分歧/校验和损坏/既有快照不可验证 → 该 sid 永久关死(kind='dead' 落盘,跨进程存活),此后恒走 legacy 全量路径。没有任何重建/重写通道。
  • S4 逐行校验和链 + ckpt/日志折叠水合(镜像全丢也能从盘重建);audit 节拍(默认每 8 个绿轮一次强制全量审计);90% 窗压即让路;NUL 拒绝守卫(node:sqlite 绑定截断陷阱)。
  • O(新) 体量纪律:steady 轮只提交本轮新增元素,重复追加会被黄金等式与行数不变量当场抓住。

合同与证据

出站字节 ≡ legacy 全量管线出站字节,逐字节(tests/issue5664-render-snapshot.test.ts 三阶段黄金 A/B:17 回合语料、arm→fast wave→audit 翻转→caps 分歧死锁→重启水合,外加稳态行数/校验和/账本代数钉)。新增形状钉:每一行的存储体必须携带核心身份字段(id/contentType)——wire 字节进不了表。

升级边界(诚实声明)

v12 三表未合入 master,按裁定零迁移成本:若未来存在存过旧语义(wire 行)数据的实例,其首次 legacy 捕获会因分歧判死——fail-soft 方向正确(宁死不错),且 rollout 默认关闭、未合入前不存在该存量。

灰度与开关

BILI_ROLLOUT_WATERMARK_V6_RENDER(rollout 百分比,默认 0)叠在 v6 msgid 车道之上;两车道互不干扰(身份平面先行,渲染平面消费其 pf_rows.core_json 窗口水合)。

Closes #5664


Round 4 — witnessed rebase: the snapshot evolves with compression (#5643 补充裁定, commit 4ecde0a95)

The no-recast regime sealed in round 2 made the plane unable to survive its first compress — the exact failure mode owner ruled out on #5643 ("快照必须随压缩演进"). Round 4 replaces fold-dead with a structural-witness rebase:

pf_render / pf_render_log / pf_render_ckpt sidecar tables for the
#5664 outbound-row snapshot plane. Rows are the per-rendered-ordinal
OUTBOUND bytes previously emitted (prefix-reuse source of truth); the
log journals append/cast/recast deltas; every checkpoint carries an
S4 sha256 checksum and physically absorbs the log (fold rule: ckpt
absolute values then post-ckpt appends). Log continuation starts from
max(MAX(ls_seq), ckpt_ls_seq) so entries never fall behind their own
checkpoint watermark. Cascade delete rides deleteSession like pf_*.
MySQL/network backends degrade soft (null/empty) exactly like the pf_*
identity plane.
…5664)

Steady-state engaged v6 turns used to re-run the full n-core pipeline
(reconcile/fold/detect over stored rows, processTurn over the whole
frozen view, estimate/probe over all n rows) even though only the new
tail changed. This lane caches what egress already emitted (station 2,
committed at finalize on every engaged turn) and, when a conservative
gate is fully green, replays ONLY the last W cores plus the new window
cores through the kernel (probe-verified byte-identical tail output),
splices the cached prefix rows back in without re-serialization, and
feeds incremental estimate bases (budget.inputEstBaseTokens) instead of
re-scanning n rows. Any red gate condition, failed window verify, or
commit failure falls back to the untouched legacy full path for that
turn; client-side compaction shrinks the captured row list and forces
a recast+checkpoint at finalize (owner-decided compaction semantics).
Caps mismatch (model/strategy/maxDim/toolArmed/multimodal) or S4
checksum failure kills the mirror loud and falls back. New rollout
cohort watermarkV6Render nested inside watermarkV6MsgId, default 0%.
@ranxianglei ranxianglei changed the title feat(fastpath): v6 render-snapshot plane — steady turns skip the full-view scan (#5664) [PR] feat(fastpath): v6 render-snapshot plane — steady turns skip the full-view scan (#5664) Nov 4, 2026
…dy tail-only rows (#5664)

Review pass on the self-authored lane surfaced four state-maintenance bugs
on the green path plus a class of test-blind spots; all fixed here with
regression pins:

1. steady capture appended the FULL row list (production shape), not just
   this turn's new rows: the pos column shifted forward every green round,
   doubling the table on disk and in the mirror; only the per-round recast
   churn (masking an audit stall) kept the byte equation green. Capture now
   sends committedTail.slice(F) — exactly the appended suffix.
2. Cumulative estCum/textCum/imgCum re-counted the F frozen window rows
   every green round (linear ledger drift ⇒ shrinking max_tokens clamp and
   polluted k calibration over long sessions). Sums and the image-reserve
   delta now cover only this turn's new elements; legacy rounds still carry
   absolute totals.
3. The audit obligation was consumed only by cast/recast: after N green
   rounds tick%N===0 stayed true forever and the lane dead-locked back to
   full legacy until an unrelated caps flip. Any legacy full-capture round
   now zeroes the tick (it IS the audit).
4. Hygiene from the same pass: identity faults rethrow through the window-
   pass catch instead of retry-passing; CCR content-store adoption no
   longer defers past fast rounds (dangling refs); splice shallow-clones
   mirror rows so downstream cannot alias-mutate next round's verify
   baseline; NUL-bearing rows refuse persistence loudly-once (node:sqlite
   truncates bound strings at \0 silently) and hydrate parse failures log
   error instead of failing soft-silent.

Test tier extended: per-round render-table↔identity-ledger alignment pin,
two-audit-wave fast-round threshold (catches the stall), submitted-volume
and cumulative-sum algebra pins, session-cascade wipe of the three render
tables, and a second-sidecar-open 12→12 migration idempotency no-op.
@ranxianglei

Copy link
Copy Markdown
Owner Author

Review round 1(已完成并修复,fix commit 16d5944b)

对本 PR 的完整代码审查(切缝等价性 / 折叠代数 / 事务 / budget 参数 / 测试盲区逐项过)。结论:无 P0 级破坏(gate 红路径逐语句与改动前等价,字节序、fail-fast 上抛、清扫块交互全部核对过),但 green 路径上有 4 个状态维护 bug,已全部在本分支修掉:

发现并已修复(16d5944b)

  1. steady 轮把整份行列表当增量追加(比评审清单里两条 P1 都大的一条,自查发现):产线侧 capture 给 commitRenderCapture(mode:"steady") 传的是全量列表而非本轮新增行,导致每次绿轮 pos 整体前移、磁盘表翻倍增长;此前单测恰好因每两轮一次 recast 自愈而被掩盖。现在 capture 只传 committedTail.slice(F)(真正的新增后缀)。
  2. 累计 token 账本每轮重复计窗内旧行(评审 P1-2):estCum/textCum/imgCum 每个绿轮都把最后 F+新核 整段重新加进累计值 ⇒ 长会话线性漂移 ⇒ max_tokens 越夹越小、k̂ 校准被污染。现在 sums 与 image-reserve delta 只覆盖本轮新增元素,legacy 轮保持绝对值语义。
  3. 审计义务无人消费 ⇒ 第 N+1 个绿轮后永久自锁回全量 legacy(评审 P1-1):audit tick 只在 cast/recast 归零,连续 8 个绿轮后 tick%8===0 恒真,整个特性在长会话里 8 轮后就死了。现在任何一輪 legacy 全量捕获都清零 tick(它本身就是一次审计)。
  4. 卫生项(评审 P2 组):窗口 pass catch 对身份类 fault 显式 rethrow(不 retry-pass);CCR content-store adopt 不再推迟到下一红轮(快轮存的 ref 悬空问题);splice 对镜像行做浅克隆(防下游别名改写下一轮的校验基准);含 NUL 的行拒绝持久化且只响一次 error(node:sqlite 对绑定串遇 \0 静默截断,实测确认,S4 checksum 管不到行表);hydrate parse 失败改为 error 日志(原先软失败无声)。

测试盲区补齐(同 commit)

  • 逐轮断言「render 表行数 ≡ identity ledger maxPos+1」——重复追加类损坏当场显形(此前被字节方程掩盖)
  • fast 轮阈值 6→12(两个完整审计波段),钉住修复 3
  • 提交量纲 + 累计和代数 pin,钉住修复 1/2
  • 会话级联删除覆盖三张 render 表的断言;第二次打开 sidecar 验证 12→12 迁移幂等 no-op

不在本 commit(记录在案)

  • P3 组小项(teardown 挂 clearWatermarkV6Render、LRU 驱逐时 sessionSids 残留、RenderCaps 缺 build/kernel 版本维度、pfRenderRows facade 无本地 try/catch)——均为卫生项且内存有界,留给后续
  • 已知残留轻扫(PR 正文已列):reserveBody 图片计数走查、knownRefsBefore、normalizeStrictEchoReasoning 全数组、终 JSON.stringify

本地证据

tsc --noEmit = 0;render-snapshot 套件 6/6(含新增用例);fastpath 家族+rollout 等 229/229;storage 迁移六文件批 53 pass / 0 fail(4 skip = mysql DSN 门控)。CI 判定以远端为准。

ci-check added 2 commits November 5, 2026 01:43
…nables (#5664)

Review hygiene: the new rollout cohort and the two env-only tunables were
missing from the config reference (document-or-don't-ship, #2030). Seeds in
website/config-reference/*, docs regenerated via tools/gen-config-docs.mjs
(coverage ok: 199 env names + 61 top-level keys).
…review hygiene)

rows-misaligned pins rows.length === maxPos+1 before F is computed, so
F <= maxPos+1 and 'maxPos < F-1' can never hold. Behaviorally inert; no
test referenced the reason string.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复——本线程即上游 PR #5689 的评审线程;检索 open/closed issue/PR,无针对同一机制(#5664 render-snapshot plane)的并行评审或修复条目;堆叠链 #5643→#5652→#5664 各层机制不同、无重叠。

标签:pr dsh scope/wiring p3 —— 功能 PR 非缺陷不打 bug;dsh threads 模型是全量重发水位的主驱动人群(pi/opencode/omp 原则上也可命中此车道,放量有证据后再补标);领域为插件车道请求管道;默认关、放量前无外部影响,p3。

评审结论:独立通读全量 diff(切缝 / gate / budget / 存储 / 测试),对第 1 轮修复清单逐条复核——16d5944b 的 4 项修复实现正确且都有回归钉(steady 只传新增后缀、累计和只覆盖新增元素、legacy 轮清零 audit tick、身份 fault rethrow/NUL 拒存/hydrate 响亮化)。无 P0/P1 残留;本轮另发现 2 个小卫生项,已当场修掉并推上 PR 分支(见下)。

八问:

  1. 是什么问题:性能优化——v6 复合身份快路径的稳态轮每轮只有尾巴变化,出站管线却仍对全部 n 行跑全量视图扫描(reconcile/fold/detect/processTurn/estimate/probe)。本 PR 加「出站行快照平面」:稳态轮只把最近 W 个冻结核 + 新增尾窗送入内核,此前出站的字节逐字拼回。
  2. 什么原因导致的:v6 身份平面消灭了全量解析(前缀核冻结),但出站渲染管线没有对应的增量形态——整份出站视图每轮从全量历史重新推导,O(n)/轮。
  3. 影响范围与严重程度:受新 cohort watermarkV6Render 控制(默认 0%,嵌套于 watermarkV6MsgId);未放量安装零行为变化(红门控路径与改动前语句等价,A/B 字节黄金 17 轮回放本地复跑通过)。纯内部性能优化,关闭时无外部影响。
  4. 怎么修复的:三站——capture(steady 追加行+增量和;arm/审计/策略翻转/客户端压缩走 diff,非后缀延长一律 recast + 强制 checkpoint)、emit(有界 W 窗口内核 pass + verifyRenderWindow 每轮字节校验,失配整轮回退 legacy)、存储(统一存储三张 sidecar 表 pf_render/pf_render_log/pf_render_ckpt,schema v12,ckpt 吸收自身日志、hydrate 校验和不符响亮杀镜像)。任一红色条件 ⇒ 当轮走未动过的 legacy 全路径。
  5. 是否有回归问题:未发现。逐项过过的既有行为:红门控路径字节等价(lane matrix 99/99)、身份硬门语义不变([PR] feat(fastpath): v6 composite-identity incremental fastpath lane (full rework, #5576 line voided) #5652 决策逻辑未触碰、kernel 零改动)、fail-fast 保留(身份 fault 显式 rethrow)、输出格式=出站字节逐字一致、缓存/重试策略未动、会话级联删除覆盖三张新表(测试钉)、v12 迁移幂等 no-op(测试钉)。一处残留记录在案:快轮估算基数相对绝对值语义存在约 W 个元素的有界偏差(不增长,≈ 估算器噪声级),不影响判定。
  6. 是否破坏缓存:否——不动前缀缓存键/重试/增量游标/去重键;平面本身是服务端渲染缓存,镜像丢失 = 纯缓存损失(磁盘为真源),模型侧前缀缓存稳定性不受影响(出站字节逐字一致)。
  7. 是否改了设计方向:否——0% cohort 后的附加平面,降级语义(任何疑点 → legacy)与既有 fastpath 家族一致。
  8. 是否引入新配置:是——rollout.features.watermarkV6Render(默认 0/off,env BILI_ROLLOUT_WATERMARK_V6_RENDER)+ 两个 env-only 调参 BILI_PF_RENDER_WINDOW(默认 8,上限 64)/ BILI_PF_RENDER_AUDIT_EVERY(默认 8,上限 1024)。这三项此前缺失于 CONFIGURATION.md en/zh(document-or-don't-ship,彻底整治环境变了滥用,除非必要都走配置文件 #2030),本轮已补齐(yaml seed + gen-config-docs generate,coverage ok)。

本轮补交 commit(独立标注,已推 PR 分支,head 1237316c9):

  • b443c3a5 docs(config):补齐上述配置面三项(seed + 生成文档);
  • 1237316c refactor(fastpath):移除不可达的 window-short gate 分支(rows-misaligned 已保证 rows.length===maxPos+1 ⇒ F−1≤maxPos 恒真;无测试引用该 reason,行为等价)。

CI 状态说明:本 PR base 是堆叠分支 2026-11-04_fastpath-v6-msgid,不在 ci.yml 的 pull_request.branches 白名单(master/agent-relay/bugfix-v*/bugfix-release/**/bugfix)内 → 全量 test 矩阵要等下层 PR 合入、base 移到 master 后才会触发,属堆叠车道预期行为。当前 head 上的 17 个 check run = 8 gates 绿 + 9 e2e skip(分支无关车道),0 红。本地定向套件在此 head 复跑:tsc=0,render-snapshot 6/6,fastpath 家族+lane matrix 119/119,storage 迁移批+pf-channel/rollout/intercept 195/195(4 个 mysql DSN 门控 skip)。全量判定由远端 CI 在 base 移动后接管。

P3 留尾清单:接受(teardown 挂 clearWatermarkV6Render、LRU 驱逐 sessionSids 残留、RenderCaps 缺版本维度、facade try/catch——均内存有界卫生项;RenderCaps 缺版本维度的最坏代价 = 升级后一次浪费的快轮,verify 自愈)。

判定:代码质量达标,红路径等价性有证据,绿路径状态 bug 已修并钉住,配置面已补齐。建议待 #5652 合入、全量 CI 转绿后按堆叠流程合并。

ci-check and others added 2 commits November 5, 2026 01:51
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: sglang-gpu0/qwen3.8-27b)

Review 结论:ready-to-merge(按 §7.4 需人类合并——含持久化 schema v12、新 rollout 键,且为 feat 类)

对照 #5664 子项规格逐条核对:

本地验证(tsx 套件,串行跑):typecheck clean;tests/issue5664-render-snapshot.test.ts 6/6;tests/fastpath-v6-msgid.test.ts 14/14;tests/fastpath-v6-tail-window.test.ts 3/3;tests/lane-decisions-matrix.test.ts 99/99;tests/storage-unified.test.ts 17/17。

CI 说明:本 head 上跑的是 CORE matrix(#3295 三层 CI 对非 master 目标 PR 的正常形状:8 gate 绿 + 9 个 env-gated e2e skipped),与 base 分支形状一致;FULL matrix 要等 rebase 到 master 后才跑(前置 #5652 先合并——stacking 依赖已正确:本 PR base = #5652 head a3d7bab)。

两点备注:

  1. PR 正文缺 mandatory 的 config surface 一节。新增面两处:rollout.features.watermarkV6Render(嵌套 cohort,0% 默认)与 env-only BILI_PF_RENDER_WINDOW / BILI_PF_RENDER_AUDIT_EVERY(en/zh + env-only.yaml 文档已做,但 PR 未按 Configuration Surface Discipline 汇报:为何现有面表达不了、考虑过哪些机制)。建议合并前补一节。草稿供作者参考:「Config surface:① rollout.features.watermarkV6Render {percent:0, base:"watermarkV6MsgId"} —— fastpath 家族第三层嵌套灰度(v5→v6 msgid→render),沿用 watermarkCanonicalV6 先例,providers/compress 现有表表达不了嵌套灰度层级;② 两个 env-only 调参(窗口 8/cap 64,审计周期 8/cap 1024),实验性 0% 车道不开 config-file 字段,双语文档齐。」——措辞 owner 按意图裁定。
  2. 审计周期边界:hydrate 出的世界 auditTick=0,即重启后最长 N 轮无端到端全量复验(每轮 W 窗口字节验证仍护住近期行)——可接受的设计取舍,记录在案。

小问题已直接在分支修掉:src/persist.ts 注释声称 pfRenderCommit 「does NOT swallow silently」,实现实际 try/catch 返回 null(fail-soft 行为与 pfCommitTurn 一致,只有措辞失实)——commit 3f07c86 把注释对齐实际行为。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

第二轮两条备注都处理完了,另外的两个新 commit 已本地核实:

新 commit 核实(head 现为 3f07c8601):

  • aeec940c2(审计周期真验证):好补强——策略翻转推迟到 turn 14,golden 测试逐轮记录 gate 决策,断言恰好一个 audit-due 落在 turn 10、下一轮立即恢复 fast。这钉死了修复 3 此前被双轮 recast 掩盖的盲区。本地在 3f07c8601 复跑 render-snapshot 套件 6/6 通过。
  • 3f07c8601(persist.ts 注释对齐):处理正确——fail-soft(记一次日志 → null → 仅当轮回 legacy)与 pfCommitTurn 兄弟模式一致,失实的是注释不是行为,对齐注释是正确方向(改成 fail-fast 反而是行为变更)。

备注 2(hydrate 后审计边界):同意并记录在案——重启后 auditTick=0 ⇒ 最长 N 个绿轮无计划性端到端复验;但每轮 verifyRenderWindow 仍把出站尾窗与存储行逐字节比对,任何出站可见的分歧一轮内即被抓住,计划审计是其上的第二道防线。有界、可接受。

备注 1(config surface 一节):已补齐——PR 正文追加了「## Config surface」节(措辞按第二评审草稿,带「review round 2 添加、owner 可裁定措辞」标注,原文逐字保留):① watermarkV6Render 嵌套 cohort——providers/compress 表表达不了灰度层级嵌套,沿用 watermarkV6MsgId⊂pluginFullResendWatermark 先例,纯增量键默认关、无迁移;② 两个 env-only 调参——实验性 0% 车道刻意不开 config-file 字段,放量时再提升为文件键。

八问(本轮增量):

  1. 是什么问题:评审收敛而非缺陷——PR 缺 Configuration Surface Discipline 强制要求的汇报节(文档缺口,非行为)。
  2. 什么原因导致的:开 PR 时配置面新增项只在代码/文档落地,未在 PR 正文按纪律汇报。
  3. 影响范围与严重程度:零行为影响(纯文本);属合并前完整性要求,严重度低。
  4. 怎么修复的:PR 正文追加该节,内容覆盖纪律四问(新增什么/为何现有面表达不了/考虑过哪些机制/兼容迁移)。
  5. 是否有回归问题:无——本轮零代码改动;对方两 commit 为 test-only + 注释-only,已在 3f07c8601 本地复跑定向套件通过。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入新配置:本轮无新增(三项上轮已记录并落文档于 b443c3a5,现同步进 PR 正文)。

CI:head 移至 3f07c8601,CORE matrix 重跑中(形状不变:8 gates + env-gated e2e skip);FULL matrix 仍等 #5652 合入、base 移到 master 后触发。

判定:合并前最后一处缺口(config surface 节)已补齐,ready-to-merge 评估维持不变——§7.4 需人类合并(schema v12 持久化变更 + 新 rollout 键 + feat 类),PR 链接:#5689

…; structural divergence kills the lane permanently (owner ruling 2026-11-05, #5664)

Recast (rewriting covered ordinals / deleting excess rows) existed as the
plane's only self-heal path. The owner ruled it must not happen in ANY
scenario (fold, caps flip, audit-caught drift, corruption death). This
commit removes it from every layer instead of patching its call sites:

- diffRowLists verdict 'recast' -> 'diverged'; the diverged branch now
  calls killRenderPlane(): the sid joins a permanent deadSids set, a
  kind='dead' entry is persisted into pf_render_log WITHOUT a checkpoint
  (nothing absorbs it), and the session rides the legacy full path from
  here on — bytes stay correct, the cache simply never serves again.
- killRenderPlane is the ONLY mutation besides append/cast-once: S4
  checksum mismatch, row gaps, log-fold disagreement, caps-unresolvable
  hydration states all KILL durably instead of returning null-and-retry;
  the arm cast refuses over any pre-existing non-empty table.
- pfRenderCommit drops its deletes parameter end-to-end
  (store/shadow/persist) — covered ordinals can never be rewritten.
- gate grows the durable reason 'lane-dead'; prepare-openai skips the
  capture build+commit entirely once the reason is lane-dead so dead
  sessions stop paying an O(full history) stringify per turn.
- tests: golden A/B re-pinned (death lands at turn 14 caps flip, table
  freezes at 13 rows, restart hydrates straight to lane-dead — no
  re-arm); new pins: structural-divergence kill (immutable rows, loud
  log, persisted dead verdict, gate positive + re-capture refused
  negative per #3617) and death-persists-across-restart.

Consequence (accepted by the ruling): once a session's outbound bytes
ever diverge from its cached rows — most concretely after ANY compression
fold re-shapes them — that session loses the render fastpath permanently.
Fastpath lifetime = up to first divergence, never after.
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: sglang-gpu0/qwen3.8-27b)

已按裁定关死重铸 — commit 49ba14d(owner 裁定 2026-11-05:所有会触发重铸的场景都不允许重铸,需要关死)

改动把"重铸"从每一层整个移除,而不是在调用点打补丁:

  1. diffRowLists 的 recast 判决改名为 diverged;diverged 分支改为调用新增的 killRenderPlane()——该 sid 进入进程内永久死亡集合,并向 pf_render_log 写入一条 kind='dead' 记录(不写 checkpoint,任何操作都不会吸收它),此后该会话永久走 legacy 全量路径:字节仍然正确,只是缓存再也不会为它服务。
  2. S4 校验和损坏、行号断档、日志对不上账、caps 无法解析等原本"返回 null 下轮重试"的状态,现在全部持久判死;首次铸造也拒绝在任何非空表上进行(无法验证即判死,绝不覆盖)。
  3. pfRenderCommit 的 deletes 参数从 store/shadow/persist 三层彻底移除——存储变为严格只追加。
  4. gate 新增持久原因 lane-dead;prepare-openai 在判定 lane-dead 后跳过 capture 构建与提交,避免死后会话每轮白付一次 O(全历史) 序列化。
  5. 测试:黄金 A/B 重新钉住(第 14 轮策略翻转触发判死,行表冻结在 13 行;重启后 hydration 直达 lane-dead,永不复铸);新增两个用例:结构分叉判死(行不可变 + 大声告警 + 持久 dead 记录 + gate 正例/复铸拒绝反例,Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617 双向)和判死跨重启存活。

本地证据:typecheck 干净;issue5664-render-snapshot 8/8、fastpath-v6-msgid 14/14、fastpath-v6-tail-window 3/3、lane-decisions-matrix 99/99、storage-unified 17/17(另 1 个环境门跳过)。

代价(裁定接受的后果,写明供合并前确认):会话一旦出站字节与其缓存行发生任何偏差——最典型的是第一次压缩折叠后(折叠块以 mid-stream user 消息重渲染,出站必然变字节),或其宿主改写/截断历史、切换模型导致 caps 翻转——该会话的渲染快路径永久失效。快路径寿命 = 首次结构事件之前。新会话/新 sid 不受影响,照常享受铸造→稳态增益。合并前提不变:需先合 #5652(本 PR 叠在其上);§7.4 要求人类合并(schema v12 持久化变更 + 新 rollout 键)。

…d of failing the request (#5664, review round 3)

The no-recast sealing (49ba14d) added a store.pfRenderRows pre-existing check to the arm branch, but SessionStore.pfRenderRows has no local try/catch and station 2 runs OUTSIDE prepare-openai's try block — a transient SELECT failure would have propagated out of prepareOpenai and failed the whole model request, an availability regression vs the old fail-soft arm path. A thrown read carries no divergence evidence, so it defers the arm to the next round (warn + op none) instead of killing the plane or crashing the caller. Test pins both directions: flaky-read round fails soft AND the next healthy round arms normally (transient != death).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

关死重铸的改动(49ba14dae)独立复核通过 —— 但它在同一处引入一个可用性缺陷,已直接在分支修掉(7577b31f2)。

对 49ba14dae 的逐项核实(全部成立):

  • 重铸从每一层移除彻底:diffRowLists 判决 recast→diverged;commitRenderCapture 返回类型里已无 recast op;deletes 参数从 store/shadow/persist 三层删净(存储严格只追加);全仓 grep 残留的 recast 字样全部是注释。
  • killRenderPlane:进程内 deadSids + 持久 kind='dead' 日志记录(不写 checkpoint ⇒ 永不被吸收);持久化失败走软路径是安全的——字节安全由每轮 verifyRenderWindow 兜底,下一进程经自身完整性检查或「非空表拒铸」重新判死,最坏一轮 wasted attempt 后收敛。
  • hydrate 的判死/重试分界正确:S4 不符、行断档、parse 失败、log-fold 对不上账、caps 不可解析 = 可验证不一致 → 持久判死;瞬时 IO 异常仍走外层 catch → hydrate-failed 下轮重试,不判死。
  • 非空表拒铸堵住了一个旧设计的暗门:我追了一遍——日志 payload 持久损坏的场景下,hydrate 失败后旧代码会在下一轮 legacy capture 里静默整表重铸(事实上的 recast);现在第一次铸造即判死。
  • gate 新增 lane-dead 且 hydrate 失败后报告持久原因而非瞬时的;Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617 双向断言齐(正例 lane-dead + 反例复捕获拒绝);pfRenderCkptIntact 对无 ckpt 行返回 true ⇒ 新会话不会被出生即判死。
  • prepare-openai 时序正确:flip 轮的死亡发生在该轮 station 2(本轮仍需 legacy capture 来触发判死),次轮起 renderLaneDead 跳过 O(全历史) 序列化。
  • 测试钉住到位:golden 重钉(turn 14 caps-mismatch → 判死 → turn 15 起 lane-dead,行表冻结 13)、steadySubmittedRows ≤ finalRowCount 比旧体积钉更强(每行至多入表一次)、重启后 gate 必须恰好 lane-dead(不再是 ok-or-audit-due)、两个新单元用例(结构分叉判死双向、判死跨重启存活)。

本评审发现并已修复的缺陷(7577b31f2):关死改动在 arm 分支新加的 store.pfRenderRows(sid) 预检读走的是无本地 try/catch 的 facade,而 station 2 位于 prepare-openai 主 try 块之外——一次瞬时 SELECT 异常会直接穿透到请求层,把整个模型请求打挂(改动前该路径是 fail-soft)。修法:读异常 = 存储 hiccup 而非分歧证据 ⇒ warn + 本轮推迟铸造(op none,不判死),下轮重试;测试双向钉住(flaky 轮软失败 + 下一健康轮正常铸成)。本地证据:tsc 干净;issue5664-render-snapshot 9/9;fastpath-v6-msgid + storage-unified 31 pass / 0 fail / 1 env-skip。

两条记录在案的非阻塞观察(P3,不动):① 每个重新 hydrate 已死 sid 的进程会再补写一条重复 dead 记录(幂等再确认,界于重启次数内,会话级联删除时清掉);② pfRenderCommit 的 SQL 仍保留 ON CONFLICT DO UPDATE——只追加纪律在车道层执行并有测试钉住,是否收紧为 DO NOTHING 留作后续判断,不在本 PR 扩大语义面。

代价条款确认(裁定接受的后果,按你的要求写明):快路径寿命 = 首次结构事件之前(典型为第一次压缩折叠——折叠块以 mid-stream user 消息重渲染,出站必然变字节;以及宿主改写/截断历史、caps 翻转改变字节)。死后会话字节恒正确(纯 legacy),新会话/新 sid 不受影响。与「字节安全来自停止而非修复」的不变量一致,确认接受。

八问:

  1. 是什么问题:复核 owner 裁定的「全场景禁重铸」关死改动,并修其引入的一个请求级可用性缺陷。
  2. 什么原因导致的:关死改动本身方向与实现均正确;缺陷根因 = 新增预检读用了无 catch 的 facade × station 2 在主 try 块外,异常无拦截直达请求层。
  3. 影响范围与严重程度:缺陷仅触达「首轮铸造恰逢存储读异常」这一低频场景——修复前当轮模型请求 outright 失败(可用性),修复后降级为该轮 legacy;关死改动本体对既有行为零漂移(红路径逐语句等价基线)。
  4. 怎么修复的:读异常处 catch → warn + 本轮推迟铸造,不判死(无分歧证据),下轮重试;双向测试钉住。
  5. 是否有回归问题:审过——红门词汇表(lane-dead 入、window-short 早退)、审计消费语义、累计和代数、级联删除三表、v12 迁移幂等、identity 车道独立性,全部保持;fail-fast 上抛语义未变(判死仍大声 error 日志)。
  6. 是否破坏缓存:不涉及——render 表是本特性自有缓存,死亡冻结即裁定意图。
  7. 是否改了设计方向:是,owner 已拍板的方向变更:recast 自愈 → 结构分歧永久判死 + 严格只追加存储;理由(行表即诚实历史,不可改写)已写入代码头注释与 PR。
  8. 是否引入新配置:不涉及(三项配置面上轮已记录并落文档)。

CI:head 现为 7577b31f2,CORE matrix 重跑中(形状同前:gates + env-gated e2e skip);FULL matrix 仍待 #5652 合入后 base 移 master 触发。判定:ready-to-merge 维持——§7.4 需人类合并(schema v12 持久化变更 + 新 rollout 键 + feat 类),#5689

…nothing mapped is ever cached (#5643 §5 ruling, #5664)

Owner ruling on #5643 (2026-11-05, canonical flow): the only plane boundary
that can never be altered by model/maxDim/toolArmed/voice/harden/serialize is
the post-kernel-rewrite generic core form. Rebuild the plane around it:

- RenderCaps drops model/maxDim/toolArmed — they are per-turn mapping inputs,
  not snapshot validity (caps now: v, strategy, droppable, multimodal).
- Station 3 green round: verify this round's rewritten window cores against
  the stored suffix at the core-form boundary; the full core sequence
  (cached prefix ++ window output) then passes through the FULL mapping chain
  fresh this turn (rescale/harden/coreToOpenai/voice/serialize all run with
  this turn's inputs). Within-family model switches ride through with zero
  events — they re-map next turn by construction.
- Captures (steady tail, legacy full, fallback) store core strings, never
  mapped wire bytes. Tripwire semantics unchanged (one-turn legacy fallback,
  no recast, durable kill on divergence); sums/audit/death machinery untouched.
- Tests: golden A/B rewritten to the core regime with a shape pin asserting
  every stored row carries core identity fields (id/contentType) and no wire
  bytes are persisted.
@ranxianglei
ranxianglei merged commit 2cb22e3 into 2026-11-04_fastpath-v6-msgid Nov 5, 2026
17 checks passed
ranxianglei added a commit that referenced this pull request Nov 5, 2026
…-supplement

[PR] fix(fastpath): witnessed rebase — the v6 render snapshot evolves with compression (#5689 post-merge supplement, #5664)
Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Nov 7, 2026
Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Nov 7, 2026
…ed cap, render-snapshot plane

Upstream 2919794..ce8f92e (57 commits) lands three large planes:

- ranxianglei#5652 fastpath-v6 identity lane (c295f90 storage layer, d55a50c
  composite identity, 9c1fb86 full-list wire, da6885d fixed tail window,
  plus the review follow-ups)
- ranxianglei#5754 image-shed 64-item cap (6aed3b8)
- ranxianglei#5689 render-snapshot plane (acca4db schema v12, 6d3ca30 O(1) steady
  turns, 49ba14d seal-shut probe)
- ranxianglei#5721 witnessed rebase supplement

Overlap with this lane was four files. src/plugin.ts auto-merged (upstream
touches the handoff-reply import at :31 and handlePluginTool at :2337; this
lane owns the strip entry points at :22 / :61 / :2640..:4554). The two
CONFIGURATION files are generated and were regenerated from the seed.

One real conflict, in tests/issue4666-migration-dedup.test.ts line 158:
upstream re-swept the sqlite user_version pin to the literal 13, this lane had
already derived it. Kept the derived form -- that is the whole point of the
earlier sweep, and the literal is what goes stale on the next bump.

That conflict resolution exposed a latent bug of mine. 3eb22b1 ("pin the
mysql lock lane to the CURRENT schema version") derived the mysql stamp
assertions from STORAGE_SCHEMA_VERSION as well. When it was written both
numbers were 9; ranxianglei#5652/ranxianglei#5689 have since pushed the sqlite unified store to 13
while the MySQL backend stayed at 11, because the v12 identity plane and the
v13 render-snapshot plane are sqlite-only. The mysql-contract lane therefore
asserted "13" against a migrator that correctly stamps "11".

Fixed by exporting MYSQL_SCHEMA_VERSION from src/storage/mysql.ts and pointing
the four mysql-side assertions at it; the sqlite assertions keep deriving from
STORAGE_SCHEMA_VERSION. Verified String(MYSQL_SCHEMA_VERSION) is "11", i.e.
byte-identical to the literal upstream asserts.

Verification on the merge tree: 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, plugin-passthrough-tag-strip-chat 20/0,
issue4666-migration-dedup 2/0 (the three mysql cases skip without
BILI_MYSQL_TEST_DSN; no local MySQL or docker socket in this sandbox).
tsc --noEmit clean, all four gates exit 0, generated docs byte-identical.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants