Repository navigation
[PR] fix: ingestSession fetches only block-covered rows for seq bounds (#4512) - #4522
ranxianglei wants to merge 3 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9702-pr.4522.50cf67dThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4522.tgz
npm install -g packageInstall instructions are refreshed on each push. |
ab5b0cb to
b5c60b1
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重结论:不重复。按失败签名(ingestSession / seqSpanById / blocks.start_seq·end_seq 全表扫描)检索 open+closed 的 issue 与 PR,本 PR 是 #4512 的唯一修复,无其它在途条目触碰该路径。 标签:bug、scope/storage、p2 —— 统一存储 sidecar 的性能缺陷,服务所有客户端车道(不打客户端标);非可用性阻断、非缓存泄露类,定 p2。 独立审核结论(重读了 diff 与两侧孪生实现,未照抄原 issue 结论): ① 方向关:#4512 的问题属实——#4335 在每次 ingestSession 存在块时整表 ② 回归关(逐项核过既有行为,全部保持):
③ 代码:干净最小,孪生对称,具名常量 ④ 测试有效性:两个新测试是真集成测试(真 UnifiedStore + planIngest),断言有牙——600 id > 500 批次断言 end_seq 落在第 2 批末端(丢批必红);directMessageIds-only 覆盖断言解析到真实边界而非 ⑤ diff 整洁度:3 文件 +179/-21,每一行都与本 PR 目的相关。 CI 事件(docs-sync 红)——已定位并处理,不是本 PR 的问题:
结构化八问
判定:代码可合入;待 |
a4aef61 to
e2ba34d
Compare
… a stale use #4491's host wiring (df3cd92) renamed the dsh AsyncLocalStorage scope sidScope(string) -> dispatchScope(LlmDispatchScope); #4215's fork-gate diagnostics (85af00f) landed in the same #4525 train merge still calling sidScope.getStore() - a cross-branch leftover that broke tsc on master at the merge (TS2304, src/agent/dsh-native.ts:1287). The broken line never compiled or shipped. Restored via the file's own established idiom (attributionOf, same file): dispatchScope.getStore() + scoped.sid check. No behavior change beyond letting #4215's blind-spot log compile as intended. Labeled pass-by fix found while reviewing PR #4522 (a red master blocks rebased heads from going green); kept as its own commit off the storage change.
(ai: vllm-qwen/qwen3.8-27b) 进度更新:发现并顺手修掉了 master 自身的 typecheck 红(与本 PR 无关的跨分支残留),PR 已 rebase 到最新 master,新一轮全量 CI 运行中。 发生了什么:审查期间发现 master 在合并 #4525(tier1-consolidation-train, 为什么它挡本 PR:ci.yml 的 checkout 对 pull_request 事件取的是 head+master 的 merge ref,所以任何 rebase 到该 master 之后的 PR,CI 都会连带红。上一轮 head( 处置(按「几行级 CI 红小修进当前 PR」政策,独立标注 commit,不混进存储改动):
行为变更声明:无。被修的 dsh 行从未存在过可运行版本,修复只是让 #4215 的 blind-spot 诊断日志按原意编译通过;存储优化部分维持原结论——产出的 start_seq/end_seq 逐字节不变。 等这轮 CI 落定即给最终判定(预期:merge ref = 本 head 本身,master 红已随本 PR 一并解除)。 |
(ai: vllm-qwen/qwen3.8-27b) 自动修复通道结论(第 2/2 次):停止,不 push。 当前红掉的检查不是本 PR 引入的——它们继承自本身变红的 master 基线,修复需要 master 侧的变更,超出本 PR 分支的小修范围。 先说最初报的那个 docs-sync:已经好了。根因是 master 侧文档漂移——CONFIGURATION.md/zh 里有 现在的红(9 个 test leg + lifecycle-ledger-guard @ e2ba34d):逐项比对确认全部可在裸 master 上复现——master@6d7c587(即本 PR 当前 base)自己的 CI(run 40093629255)就是 10/12 test leg + static-gates×2 + ledger-guard 全红,失败签名与本 PR head 逐条相同(如 master 侧修复进展(供参考):ledger-guard 缺的 BILI_CODEX_STATE_MODE 注册已合入(693bf55b1、afd6287de);#4427 publish mask 一族有在途修复 PR #4509;其余家族(#4260/#4241/latch/stale-dist/full-mode restart)暂无可见修复。其中 stale-dist 一族是机制性冲突:#4360 的 dist 缓存恢复(tar 保留旧 mtime)与 #3325 的纯 mtime 陈旧守卫打架,需要 owner 拍板修法方向。 已立项:master 红风暴按「同一症状一个 issue」立了 #4560(带来源标记与查重声明),内含 8 个失败家族的清单、证据链接与处置建议——后续修 master 的人直接照单认领,不再重复立项。 结构化八问:
收工判定:自动修复通道关闭(2/2,未 push 任何提交)。建议:master 转绿后将本分支 rebase 到 master 并重跑 CI;PR 自身改动不需要修改。跟踪项见 #4560。 |
e2ba34d to
bc05651
Compare
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决,rebase 完成并推送。 新 head 冲突实况与处置(机械性冲突,无需设计决策):
本地验证(全量以推送 head 上的远程 CI 为准):
行为变更声明:无。从分支上移除的 dsh commit 已由 master 自身版本取代(语义相同、守卫更严);存储优化部分维持原结论——产出的 结构化八问
收工判定:冲突通道关闭,PR 恢复可合并;全量回归绿红以远程 CI 在新 head |
The suite baseline preload (preload-storage-baseline.mjs) pins BILI_STORAGE_UNIFIED="legacy" for the broad corpus. After #6480 flipped the storage default to pure-sqlite, the notice-registry suite's visibleNotices assertions expect the pure-sqlite default notice, which is gated on unifiedSelectionIsSqlite (unified "sqlite" or absent) — the preload's "legacy" made the notice silent, so the suite was born-red on master. Pin the selection explicitly (#4011 lesson: a test that depends on the production default passes locally but fails in CI).
The #4512 perf fix (ingestSession fetches only block-covered rows via a chunked `msg_id IN (...)`) already landed on master through the #4725 N3 work in a superset form: it additionally filters `retired_at IS NULL` (live rows only, #4801 review) and stores the -1/-1 no-claim sentinel instead of the [0,0] placeholder. Re-applying this branch's older code would regress both, so the branch now carries only the regression test, pinning the two paths the original full-table scan never exercised: a covered-id union spanning multiple 500-id query batches, and directMessageIds feeding the union (not just effectiveMessageIds).
1cedd75 to
b0ff8f2
Compare
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved — PR #4522 is now mergeable (no conflict). The dirty merge state is gone. The PR head is now What I found and did this run:
One flag for the reviewer: test 1 (the 600-id multi-batch case) overlaps master's existing Your call on what this PR is now (the code fix is already on master, so #4512 is effectively fixed):
I won't close anything — that's yours. Live state (verified this run): 结构化八问
判定:冲突已解,PR 现在可合并(等 CI + 你的 review)。建议 A(合并 + 关 #4512);或 B(关 PR 为 superseded + 直接关 #4512)。合并按规矩由你来。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) PR #4522 conflict resolved — now mergeable. Confirming the outcome in-thread (posting with the bot prefix per policy):
结构化八问
判定:冲突已解,PR 现在可合并(等 CI + 你的 review)。建议 A(合并 + 关 #4512);或 B(关 PR 为 superseded + 直接关 #4512)。合并按规矩由你来。 |
背景 / What
#4335(#4316 layer 3)给
blocks.start_seq/end_seq从 append-only transcript 回填时,在每次ingestSession(=每次会话持久化;调用点 shadow.ts:330/437/490/792/800/876)只要存在块,就执行整表扫描建 Map:这是新增的每次持久化 O(全 transcript)扫描 + 全表内存分配。项目主打亿级 token / 上万轮的马拉松会话,messages 表很大——对旗舰场景是实打实的成本(数据目前只作诊断用,不阻断可用性)。来源:#4512。
修法 / How
按 #4512 建议的并集方案:先收集所有块 effective+direct 覆盖 id 的并集,再分片(
msg_id IN (...),每批 500)只取需要的行建 Map。(session_id, msg_id)索引(sqliteidx_messages_msg_id/ mysql 同名)使每批是定向查找,不是又一次全表扫。record()的三连击自禁用——比性能问题更糟,必须杜绝。[0,0]placeholder 语义逐字节不变;因为boundsForCovered只查覆盖 id,把 Map 限制到覆盖行是字节等价的。store.ts)与 mysql(mysql.ts)两个孪生同步改。行为变更 / Behavior change
无。 纯性能优化,产出的
start_seq/end_seq与改动前逐字节一致(只是少扫/少分配行)。不改配置面、不改持久化格式/版本、不改 wire、不动 kernel/、不碰 message-ref/id 逻辑、不碰 update.ts。回归审查 / Regression(既有行为逐项)
input.blocks.length === 0:守卫不变,跳过查询。[0,0],与改前一致。boundsForCovered各自 catch →[0,0],行为不变。测试 / Tests
本地定向验证(全量交给远程 CI):
tests/issue4512-ingest-span-in-clause.test.ts:钉住旧代码从未覆盖的两条路径——①覆盖 id 并集跨多个查询批次(600 > 500,断言 end_seq 落在第 2 批最后一个 id,证明后续批次确实执行);②directMessageIds 也进并集(不只 effectiveMessageIds)。tests/issue4316-seq-bounds.test.ts(happy path + placeholder gap)仍绿。tsc --noEmit通过(rebase 到最新 masterc81c17d9后复验)。Closes #4512