Repository navigation
[PR] fix(kernel): post-restart compression no longer silently folds wrong messages — slots freed during ID reconciliation are | fix(kernel): 重启后压缩不再静默折叠错消息——编号对账时腾出的座位保留给原主(#5196) - #5360
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
Install instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 收到。这是 [PR] 镜像单,对应 PR #5360(分支 查重: 不重复。 检索了 open/closed issue 与在途 PR:本 PR 是 #5196(重启冷载编号对账腾座顶号 → 压缩折叠错消息)的唯一在途实现;相关历史条目 #4807/#4797(死锁修复)、#5199(liveness prune 回滚)、#5049(旧 no-code-change 结论)均已被本 PR 正文显式覆盖/取代,无并列重复 PR。 初审状态:CI 上 |
|
kernel-guard 红因:PR body 漏了内核人审门禁要求的 |
(ai: vllm-qwen/qwen3.8-27b) 标签: bug + scope/kernel + p2(缺陷类;压缩引擎编号账本域;触发条件苛刻、命中后静默折错消息但可 decompress 挽回,能用有绕行 → p2)。 门禁状态先说清:你已把 独立审核(不采信 PR 结论,逐项重验)方向关(原 issue):GitHub #5196 的根因分析成立,我对 master 代码独立复核过完整链条:① 回归清单(触碰路径的既有行为,逐项过):
本地定向验证(PR head 实跑,非转述):kernel 五个定向套件 seq-restamp/ccr-restamp/dead-refs/dead-ref-split/issue3939 = 63/63 绿;kernel 测试有效性:真测试。三条新回归钉的是具体终态布局而非计数——issue 形状测试断言「B 不得领 m7」+「m7 永久无活主」+ superseded 映射 + rehomed 数;腾退链测试防过度退役(未被腾出的座位仍可复用,恰好一个停车);持久性测试钉「二次冷载纯 no-op」。S13b 改写后断言新车契约(停车号=游标处、m00002 永久空)。这些回归在 master 上会红(issue 形状那条就是 bug 本身),断言有牙。 顺手小修(独立 commit diff 整洁度:7 个文件每一行都与目的相关(内核机制 + 测试 + 注释刷新 + CHANGELOG 条目 + 版本 bump + lockfile 连带),干净可合。 结构化八问
判定:代码审核通过,可合——等 CI 全绿后由你做人工评审合并(kernel 恒为人审门,我不代合)。PR 链接:#5360 |
…o messages (#5196) Cold-load ref reconciliation (maybeRestampToLedger, #4316 PR3/3) aligns refs to ledger row order seq+1. When mover A stamped its seat in one pass, the slot A vacated became immediately visible as free to a later mover B in the same pass — B took over A's pre-restart number while superseded[thatRef] still named A. The live-first resolver (src/stream.ts supersededRefRejection) then re-targeted every stale citation of that number at B: a compress() citing A's pre-restart ref folded B's contents behind A's summary text, HTTP 200, block created (0.1.209 field fixture). restampRefsToLedger now retires every seat a mover vacates into its own seq+1; any mover whose target is a retired seat parks on a fresh number at/ after the cursor via the existing displaced/rehomed path instead. A retired slot can never be targeted again within the pass (targets are unique per row), and park numbers always start above every used index, so no freshly stamped or parked ref can carry two identities — live-first becomes safe by construction on kernel-produced data, with zero new rejection surface. Pre-#5196 ambiguous data keeps the documented #4807 live-first trade. - kernel 0.0.173 → 0.0.174 - tests: seq-restamp S13b rewritten to parking semantics (a swap's second side parks, superseded carries both old mappings), 3 new regressions: the exact issue fixture shape, a vacate chain proving untouched seats stay reusable, and cold-load persistence of the parked layout - src/stream.ts: refresh the stale 'kernel prune' doc paragraph left over from the rolled-back liveness prune (#5199 / af1f92a) Verified: kernel seq-restamp/ccr-restamp/dead-refs/dead-ref-split/ issue3939 23/23, host seq-ledger×2/issue4316/issue4797 13/13, e2e-trae-model-restamp 1/1, kernel+root tsc clean, unused-exports gate clean.
…5196) Review nit on the slot-retirement diff: the leftovers entries stored the mover's pre-pass ref but settlement always reads byRaw[rawId] (authoritative — it reflects any later displacement), so the field was never read. Zero behavior change; seq-restamp 7/7 + tsc clean.
The fixture runs restampRefsToLedger on the same drifted shape as the kernel collision suite. Under in-pass slot retirement f no longer takes e's vacated m6 — it parks on a fresh number (m8) — so T1's hardcoded m4..m6 span stopped reaching f (fold covered d,e only). Re-cite the advertised live range m4..m8 so the retired slots m6/m7 inside the span translate onto their current owners instead of refusing, pin the parking layout with an explicit precondition, and refresh the layout comments. Behavior under test unchanged: advertised live refs fold, old cites translate.
…refs (#5345 fallout) Master has been red since #5345 (guided pack editor): every PR's test shards fail both #1024 catalog checks. (a) en cfg.q_pack_ai_p1 lost its {need} placeholder vs zh — restored, text aligned. (b) the base-selector option labels are referenced through a pair array (t(pair[1])), which the literal t("key") scanner cannot see, so all four cfg.q_pack_base_* keys report as dead. collectRefs now also accepts dot-qualified identifiers quoted verbatim in page/client/report sources (catalog keys are namespaced; plain quoted words like "billion-context" lack a dot and are unaffected). tests/web-i18n.test.ts 10/10 locally; unblocks #5196's matrix.
8475295 to
9cd0960
Compare
|
本轮红因与处置(与 #5196 本身无关):master 自 #5345(pack 编辑器)起 i18n 目录校验恒红——每个新 PR 的 3 片测试连带挂。本 PR 已 rebase 到最新 master(含 #5356/#5147/#5345)并把最小修复带上:①英文 cfg.q_pack_ai_p1 补回 {need} 占位符;②死 key 扫描器接受「键名数组」间接引用(t(pair[1]) 形式的下拉选项),否则 4 个合法文案被误判死亡。另:本分支上 ci-check 的两笔配套改动(leftovers 死字段清理、#4797 测试套对齐 slot-retirement 布局)随 rebase 一并保留。web-i18n 10/10 + kernel seq-restamp 7/7 + host seq 家族 12/12 本地绿。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.970-master.05624b1 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Cherry-picked from #5233 (qiangu2020) kernel core, rebased onto current master. The deadRefs tombstone infrastructure already landed via #5360; this adds the missing ref floor: - highestIssuedIndex: byRef orphans whose byRaw owner is gone still count - assignRefs: cursor clamped to max(requested, historicalHighWater+1) - ledger stamp accepted only above the floor and outside tombstones - allocateFreeRef skips tombstoned indices - both restamp paths seed nextIndex from the unified floor Prevents lifetime ref reuse after pruning (the #5485 defect). Cherry-picked-from: 3e137c4 (qiangu2020/2026-10-30_ref-safety)
这是啥问题?(#5196)
这是啥问题?(#5196)
重启后第一次压缩可能把别人的消息静默折叠进去:模型拿着重启前看到的编号发
compress,HTTP 200 成功、块建好了,但块盖住的不是摘要里点名的那条消息,而是顶了号的另一条。0.1.209 有完整可复现 fixture(issue 里)。触发条件:会话发生过重启冷载、且冷载触发了「编号对账重排」(#4316 PR3/3 设计:把编号对齐成库行序,防 churn 再漂移)。
根本原因(代码级)
restampRefsToLedger:每个消息的目标位=行序+1。同一趟里 A 先 stamp 落座后,它腾出的旧号对后面的 B「可见」——B 直接把 A 重启前的编号顶过去,而superseded[那个号]还记着 A。supersededRefRejection(live-first):byRef[ref] !== undefined时直接返回该号——编号活着就永远不查 superseded 映射。于是所有指向 A 的旧引用被解析到 B 头上。历史脉络:#4807(修 #4797 死锁)明确接受了这个残余窗口;kernel liveness prune 曾被回滚(#5199 / af1f92a),stream.ts 注释里的「prune 会消掉歧义」是回滚时漏改的陈话。#5049 当时的 no-code-change 结论因此失效。
怎么修的(slot-retirement,#5196 评审方案 D)
对账中,每个挪窝消息腾出的座位当场保留(retired):目标位落在已保留座位上的消息不再顶班,改领游标处的全新号——走既有 displaced/rehomed 机制,零新拒绝面、零新等待、不可能死锁。由此任何新发/新落的编号都不可能同时指向两个身份,live-first 在内核产生的数据上构造性安全。
delete byRef[held]的原语义(master 刻意保留,否则毁掉刚 stamp 进来的主人)。判定依据
kernel-change: #5196 静默错折叠修复必须落在内核重排函数本身(restampRefsToLedger 的座位退役语义),无宿主侧替代实现;顺带刷新 stream.ts 一段被 #5199 回滚后遗留的失真注释。kernel 0.0.173→0.0.174(patch,语义向后兼容:仅新增「腾出座位保留」行为,消除双身份歧义)。