Skip to content

[PR] fix: ingestSession fetches only block-covered rows for seq bounds (#4512) - #4522

Open
ranxianglei wants to merge 3 commits into
masterfrom
2026-10-24_4512-ingest-seq-span-in-clause
Open

ranxianglei wants to merge 3 commits into
masterfrom
2026-10-24_4512-ingest-seq-span-in-clause

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

背景 / What

#4335(#4316 layer 3)给 blocks.start_seq/end_seq 从 append-only transcript 回填时,在每次 ingestSession(=每次会话持久化;调用点 shadow.ts:330/437/490/792/800/876)只要存在块,就执行整表扫描建 Map:

SELECT msg_id, seq FROM messages WHERE session_id = ?

这是新增的每次持久化 O(全 transcript)扫描 + 全表内存分配。项目主打亿级 token / 上万轮的马拉松会话,messages 表很大——对旗舰场景是实打实的成本(数据目前只作诊断用,不阻断可用性)。来源:#4512。

修法 / How

按 #4512 建议的并集方案:先收集所有块 effective+direct 覆盖 id 的并集,再分片(msg_id IN (...),每批 500)只取需要的行建 Map。

  • (session_id, msg_id) 索引(sqlite idx_messages_msg_id / mysql 同名)使每批是定向查找,不是又一次全表扫。
  • 分片是必须的:IN 列表参数数随并集增长,重折叠会话可能超驱动绑定参数上限(SQLite 999–32766 视构建而异)。超限查询会抛错并喂给 record() 的三连击自禁用——比性能问题更糟,必须杜绝。
  • min/max span 累积逻辑与 [0,0] placeholder 语义逐字节不变;因为 boundsForCovered 只查覆盖 id,把 Map 限制到覆盖行是字节等价的。
  • sqlite(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],与改前一致。
  • 畸形 payloadJson:并集收集与 boundsForCovered 各自 catch → [0,0],行为不变。
  • 同一 msg_id 多 seq:min/max 累积逻辑未动。
  • IN 子句全走占位符绑定,无 SQL 注入 / 特殊字符风险。

测试 / 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 到最新 master c81c17d9 后复验)。

Closes #4512

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-24_4512-ingest-seq-span-in-clause (b0ff8f2)

Latest build — install this exact version

npm install -g billion-context@0.0.9702-pr.4522.50cf67d

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

Recent builds (commit → version)

commit version build
b0ff8f2 billion-context@0.0.9702-pr.4522.50cf67d build
1cedd75 billion-context@0.0.5998-pr.4522.cc3f936 build
bc05651 billion-context@0.0.5523-pr.4522.49de6d7 build
e2ba34d billion-context@0.0.5490-pr.4522.fbef184 build
a4aef61 billion-context@0.0.5485-pr.4522.d317ae9 build
b5c60b1 billion-context@0.0.5476-pr.4522.e284137 build
ab5b0cb billion-context@0.0.5456-pr.4522.a302202 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: ingestSession fetches only block-covered rows for seq bounds (#4512) [PR] fix: ingestSession fetches only block-covered rows for seq bounds (#4512) Oct 24, 2026
@ranxianglei
ranxianglei force-pushed the 2026-10-24_4512-ingest-seq-span-in-clause branch from ab5b0cb to b5c60b1 Compare October 24, 2026 11:45
@ranxianglei ranxianglei added bug Something isn't working p2 scope/storage labels Oct 24, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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 存在块时整表 SELECT msg_id, seq FROM messages WHERE session_id=? 建 Map。修法方向正确:并集 + 分片 IN,且前提成立——(session_id, msg_id) 索引在 sqlite(src/storage/schema.ts:268)与 mysql(src/storage/mysql.ts:119)都存在,每批是定向索引查找而非再次全表扫。分片必要性成立:批内绑定参数 ≤501,低于 SQLite 最低绑定上限 999,不会触发超限抛错喂给三连击自禁用。

② 回归关(逐项核过既有行为,全部保持):

  • input.blocks.length === 0 守卫不变,零查询;
  • 覆盖并集为空 → 一条查询都不发 → 各块 [0,0](改前是全表查询后查无命中,输出相同);
  • 畸形 payloadJson:并集收集与 boundsForCovered 各自 catch → [0,0],与改前一致;
  • 字节等价性独立验证:boundsForCovered(store.ts:904-917 / mysql.ts:561-574)只查 effective+direct 并集内的 id,把 Map 限制到覆盖行不可能改变任何输出值;同一 msg_id 多 seq 的 min/max 累积逻辑逐字未动;
  • 边缘:字段为非数组(如字符串)时,新并集收集与 boundsForCovered 用同一个展开表达式,行为自洽且与改前一致;
  • SQL 全占位符绑定,无注入面;sqlite/mysql 孪生对称修改,mysql-contract 车道绿。
    高危模式逐项过:无语义漂移、无 fail-fast 变吞错(catch 是该字段既有模式)、无阈值/时序/输出格式变化。

③ 代码:干净最小,孪生对称,具名常量 SEQ_SPAN_QUERY_BATCH = 500,注释讲清为什么(#4512)。无死代码、无新依赖。

④ 测试有效性:两个新测试是真集成测试(真 UnifiedStore + planIngest),断言有牙——600 id > 500 批次断言 end_seq 落在第 2 批末端(丢批必红);directMessageIds-only 覆盖断言解析到真实边界而非 [0,0](只读 effective 必红)。既有 #4316 测试继续钉住 happy path + placeholder gap。

⑤ diff 整洁度:3 文件 +179/-21,每一行都与本 PR 目的相关。

CI 事件(docs-sync 红)——已定位并处理,不是本 PR 的问题:

结构化八问

  1. 是什么问题:统一存储每次持久化会话、只要存在折叠块,就把整个 messages 表拉出来建 Map 算块 seq 边界——马拉松会话下每次持久化 O(全 transcript)扫描+分配。
  2. 什么原因导致的:[PR] #4316 Layer 3 (number directly mapped to canonical seq) PR 1/3: Fold-overwrite into real seq range | #4316 层3(编号直连正史 seq)PR 1/3:折叠覆盖写入真实 seq 区间 #4335 实现「从 append-only transcript 回填块 start_seq/end_seq」时用了不带范围的全会话 SELECT,而这些边界只需要被块覆盖的那些 id 对应的行。
  3. 影响范围与严重程度:所有走统一存储且有块的会话;成本随 transcript 大小线性增长,旗舰场景最痛。p2:性能下降,非可用性阻断、非缓存泄露。
  4. 怎么修复的:先收所有块 effective+direct 覆盖 id 的并集,再分片(每批 500)msg_id IN (...) 只取需要的行建 Map,靠既有 (session_id,msg_id) 索引做定向查找;两个后端孪生同步。
  5. 是否有回归问题:无。字节等价性独立验证过(见上),空块/空并集/畸形 payload/多 seq 累积/注入面逐项核过均保持原语义。
  6. 是否破坏缓存:不涉及——纯存储侧诊断数据回填路径,不碰前缀缓存/cache ref/游标/去重键。
  7. 是否改了设计方向:没有。仍是 After model switch / client-side history rewrite, all message identities (content hashes) are replaced: ACP numbers re-m | 切模型/客户端重写历史后,消息身份(内容哈希)全部更换:acp 编号重铸、折叠覆盖大规模重挂、死 ref、churn 区临时膨胀重折 #4316 layer 3 同一机制,只是缩小取数范围。
  8. 是否引入新的配置:没有。仅模块内常量 SEQ_SPAN_QUERY_BATCH = 500,非用户可见配置面。

判定:代码可合入;待 b5c60b1c0 上远程 CI(test 车道这次会真正跑起来)转绿后即可由你合并。我持续盯 CI,结果出来再跟帖。

@ranxianglei
ranxianglei force-pushed the 2026-10-24_4512-ingest-seq-span-in-clause branch from a4aef61 to e2ba34d Compare October 24, 2026 12:51
ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
… 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.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

进度更新:发现并顺手修掉了 master 自身的 typecheck 红(与本 PR 无关的跨分支残留),PR 已 rebase 到最新 master,新一轮全量 CI 运行中。

发生了什么:审查期间发现 master 在合并 #4525(tier1-consolidation-train,6d7c58711)后自己是红的:src/agent/dsh-native.ts(1287,28): TS2304 Cannot find name 'sidScope'。根因是同一火车内的跨分支残留——df3cd929f(#4491 host wiring)把 dsh 的 AsyncLocalStorage 作用域从 sidScope(string store)改名重构为 dispatchScope(LlmDispatchScope { sid, msgIds } store),稍后合入的 85af00f11(#4215 fork-gate diagnostics)基于未含改名的分支写出、仍调用旧名。被坏的这行从未编译过、从未上线。

为什么它挡本 PR:ci.yml 的 checkout 对 pull_request 事件取的是 head+master 的 merge ref,所以任何 rebase 到该 master 之后的 PR,CI 都会连带红。上一轮 head(a4aef61ad)的全矩阵红全部源于此:static-gates 的 tsc 报同一错误,12 个 test shard 里共 6 个失败子测试全是运行时 ReferenceError: sidScope is not defined(栈顶 noteForkVerdict → dsh-native.ts:1287,测试文件 dsh-llm-stream-attribution / dsh-msgids)。不是本 PR 代码的问题,也不是环境抖动(同一树形在更早一轮是全绿的)。

处置(按「几行级 CI 红小修进当前 PR」政策,独立标注 commit,不混进存储改动):

  • e2ba34d85 fix(dsh):两行,改用同文件 attributionOf 的既有惯用法——dispatchScope.getStore() + scoped !== undefined && scoped.sid.length > 0(与文件内其它读法逐字一致);
  • 本地验证:tsc 干净;tests/issue4215-fork-gate-diagnostics.test.ts 8/8 绿;上一轮 CI 失败的两个测试文件 tests/dsh-llm-stream-attribution.test.ts + tests/dsh-msgids.test.ts 本地 9/9 绿;
  • 已 rebase 到最新 master 6d7c58711(新 delta 与本 PR 三个文件零重叠),当前 head = e2ba34d85(两个 commit:存储优化 + dsh typecheck 修复),force-push 更新分支(仅动自己的 PR 分支),全量矩阵正在跑;
  • 留痕 issue:master typecheck red after #4525 merge: stale sidScope use in dsh-native.ts (fixed in PR #4522) #4550([no-dispatch],仅作可见性记录,不触发调度)。

行为变更声明:无。被修的 dsh 行从未存在过可运行版本,修复只是让 #4215 的 blind-spot 诊断日志按原意编译通过;存储优化部分维持原结论——产出的 start_seq/end_seq 逐字节不变。

等这轮 CI 落定即给最终判定(预期:merge ref = 本 head 本身,master 红已随本 PR 一并解除)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

自动修复通道结论(第 2/2 次):停止,不 push。 当前红掉的检查不是本 PR 引入的——它们继承自本身变红的 master 基线,修复需要 master 侧的变更,超出本 PR 分支的小修范围。

先说最初报的那个 docs-sync:已经好了。根因是 master 侧文档漂移——CONFIGURATION.md/zh 里有 rollout.features.pluginLaneServerHistory 一行但 yaml 种子缺失,重新生成时该行被删导致 diff 非空(#2107 漂移守卫)。master 已由 8daae67「docs: add missing pluginLaneServerHistory config seed(#4520)」修复;本分支 rebase 到修复后的 master 后,docs-sync 在最近两个 head(ab5b0cb、e2ba34d8)上均为绿,无需本 PR 做任何改动。

现在的红(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 逐条相同(如 #4260 epoch confirmation all-missing、#4241 judge render baseline、escalation latch recovery、storage-render golden chat 的 stale-dist 报错、#4427 publish mask 四连、storage full-mode restart golden)。本 PR diff 只碰 src/storage/{mysql,store}.ts(ingestSession seq-span 取数)+ src/agent/dsh-native.ts 两行 typecheck 修复,不在任何失败路径上。最新 master tip 0d9fdae 的 CI(run 40098236463,13:50Z 完成)仍有 7 个 test leg 红——也就是说现在 rebase 到最新 master 也还是红的。

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 的人直接照单认领,不再重复立项。


结构化八问:

  1. 是什么问题:最初报的 docs-sync 是 master 侧文档漂移(已随 rebase 解决);当前红的是 9 个测试腿 + ledger-guard,全部继承自变红的 master 基线,不是本 PR 引入。
  2. 什么原因导致的:分三层——① docs-sync:配置文档行有而 yaml 种子无(master 漂移,docs-sync has been all red on master since the merge of #4505: the rollout.features.pluginLaneServerHistory seed entry i | docs-sync 自 #4505 合并起在 master 全红:rollout.features.pluginLaneServerHistory 种子条目丢失 #4520 已修);② ledger-guard:BILI_CODEX_STATE_MODE 未登记 LIFECYCLE.md(master 已修);③ 其余测试家族在 master 自身 CI 上以完全相同的签名复现,属 master 侧缺陷/抖动(详见 Master CI red: multiple unrelated test families fail across legs (per-failure checklist inside) #4560 清单)。
  3. 影响范围与严重程度:所有以 master 为基线的 PR 合并被阻塞(含本 PR);发版流程无法切出健康版本;对终端用户无直接影响(红着 = 发不出去)。
  4. 怎么修复的:本 PR 分支无需改代码——正确动作是等 master 恢复绿后 rebase + 重跑;stale-dist 一类需 owner 决策(mtime 语义 vs CI Windows test lane takes 20+ minutes: every leg does a full rebuild of kernel/pi-subagents dist — the sharding is way | CI windows 测试车道 20+ 分钟:每条腿都全量重建 kernel/pi-subagents dist,分片也太粗 #4360 内容哈希 oracle),已作为 Master CI red: multiple unrelated test families fail across legs (per-failure checklist inside) #4560 第 3 项单列。
  5. 是否有回归问题:无。本 PR 触碰路径(storage ingest seq-span、dsh-native 两行)与所有失败路径不相交;失败家族在不含本 PR 的裸 master 上同样出现,已逐一对照日志核实。
  6. 是否破坏缓存:不涉及——本 PR 未动任何缓存/重试/去重策略。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:无。

收工判定:自动修复通道关闭(2/2,未 push 任何提交)。建议:master 转绿后将本分支 rebase 到 master 并重跑 CI;PR 自身改动不需要修改。跟踪项见 #4560。

@ranxianglei
ranxianglei force-pushed the 2026-10-24_4512-ingest-seq-span-in-clause branch from e2ba34d to bc05651 Compare October 24, 2026 14:52
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

冲突已解决,rebase 完成并推送。 新 head bc0565195(分支 2026-10-24_4512-ingest-seq-span-in-clause,force-push 仅动本 PR 自己的分支)。PR 状态已从 dirty 恢复为可合并(mergeable=true;当前 state=behind——rebase 后 master 又前进了,属正常非阻塞项)。

冲突实况与处置(机械性冲突,无需设计决策):

  • 文件级重叠只有 一个:src/agent/dsh-native.ts。存储三件套(src/storage/store.ts / src/storage/mysql.ts / 新测试文件)在 master 侧零改动,干净落位。
  • 冲突原因:本 PR 的第二个 commit(e2ba34d85,顺手修 dsh typecheck 红)与 master 已合入的同源修复改的是同一行——master 先由 673bf55b1 修掉 sidScope 残留,随后 f4c923550/de296983f 又把该处精化为更保守的写法(变量名 scopedStore + 额外 typeof scopedStore.sid === "string" 守卫)。git 无法把两者自动识别为「已应用」,故报内容冲突。
  • 解法:保留 master 版本,跳过本 PR 的冗余 commit(git rebase --skip)。两处修复语义完全相同(读 dispatchScope.getStore()、按 .sid 判作用域归因是否活跃),master 版严格更保守。未改动 master 的任何代码。
  • rebase 后 PR 内容收敛为单一存储优化 commit,对 master 窗口零重叠:3 文件 +179/-21。

本地验证(全量以推送 head 上的远程 CI 为准):

  • tsc --noEmit 干净;
  • 定向测试 12/12 绿:tests/issue4512-ingest-span-in-clause.test.ts(2)、tests/issue4316-seq-bounds.test.ts、tests/issue4215-fork-gate-diagnostics.test.ts(8,覆盖冲突所在行所属路径)。

行为变更声明:无。从分支上移除的 dsh commit 已由 master 自身版本取代(语义相同、守卫更严);存储优化部分维持原结论——产出的 start_seq/end_seq 逐字节不变。


结构化八问

  1. 是什么问题:PR 分支在 master 连合多个火车后与目标分支产生文本冲突(dirty),阻塞合并。
  2. 什么原因导致的:两侧唯一重叠文件是 src/agent/dsh-native.ts——本 PR 顺手修的 dsh typecheck 残留与 master 随后合入的同源修复(且被进一步精化)落在同一行,git 不能自动判为已应用。
  3. 影响范围与严重程度:仅本 PR 分支自身;对用户零影响。
  4. 怎么修复的:rebase 到 master tip ba5ab0bce;唯一冲突点取 master 既有版本、跳过冗余 PR commit。PR 现在只剩存储优化一个 commit,与 master 窗口零文件重叠。
  5. 是否有回归问题:无。tsc 干净 + 定向测试 12/12 绿;dsh 行行为与 master 现状逐字一致(未动 master 代码);高危模式(语义漂移/吞错/阈值时序输出格式)逐项过,均不涉及。
  6. 是否破坏缓存:不涉及——本次只动分支拓扑,未改任何缓存/重试/游标逻辑。
  7. 是否改了设计方向:没有。
  8. 是否引入新的配置:没有。

收工判定:冲突通道关闭,PR 恢复可合并;全量回归绿红以远程 CI 在新 head bc0565195 上的结果为准——若再红且失败签名与 #4560 清单里的 master 基线家族一致,那是 master 侧问题,不是本 PR 的。

ework-agent and others added 2 commits November 14, 2026 04:35
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).
@ranxianglei
ranxianglei force-pushed the 2026-10-24_4512-ingest-seq-span-in-clause branch from 1cedd75 to b0ff8f2 Compare November 13, 2026 23:20
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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 b0ff8f2fb1 = current master + the PR's regression test only.

What I found and did this run:

  1. The PR's code fix is already on master — in a strictly better form. The #4335 Performance Regression Risk | #4335性能回归风险 #4512 fix (ingestSession fetches only block-covered rows via a chunked msg_id IN (...)) landed on master through the [PR] chore: empty PR (no changes) #4725 N3 review train, and master's version is a superset: it additionally filters retired_at IS NULL (live rows only, [PR] chore: empty PR (no changes) #4801 review) and stores the -1/-1 no-claim sentinel instead of the [0,0] placeholder ([PR] chore: empty PR (no changes) #4725 N1 — a [0,0] would read back as a real claim over seq 0). Re-applying this branch's older code would have regressed both.

  2. Resolution = master + the PR's unique test file. I dropped the superseded store.ts/mysql.ts changes and kept only tests/issue4512-ingest-span-in-clause.test.ts (114 lines, new). The branch diff vs master is now purely additive: +114, 1 file.

  3. Verified the test passes against master's code (targeted run, 2/2 green): both tests exercise paths the original full-table scan never hit — a covered-id union spanning multiple 500-id query batches, and directMessageIds feeding the union (not just effectiveMessageIds).

One flag for the reviewer: test 1 (the 600-id multi-batch case) overlaps master's existing tests/issue4725-covered-seq-sentinel.test.ts "covered-seq resolution survives the 500-id chunk boundary" (same 600-id scenario). Test 2 is unique (no master test feeds directMessageIds into the union). Trimming test 1 is a content change beyond conflict resolution, so I left the file as-is — happy to trim it if you prefer.

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): mergeable: true, mergeable_state: blocked (normal — awaiting CI + your review), head b0ff8f2fb1, base e1f31ad9d5. CI is queued on the new head (22 checks pending, 0 failed); my change is a pure test addition, so it should land green.

结构化八问

  1. 是什么问题:PR [PR] fix: ingestSession fetches only block-covered rows for seq bounds (#4512) #4522 与 base 冲突(merge state: dirty),需解冲突;解冲突时发现 PR 的代码修复已被 master 以更优超集形式收录。
  2. 什么原因导致的:master 这 20 天大改了 store.ts/mysql.ts(2162 增/428 删)造成文本冲突;更关键的是 #4335 Performance Regression Risk | #4335性能回归风险 #4512 的修复已通过 [PR] chore: empty PR (no changes) #4725 N3 评审列车合入 master,且 master 版本是超集(额外 retired_at IS NULL + -1/-1 无声明哨兵),PR 旧代码是严格劣化子集。
  3. 影响范围与严重程度:若机械 rebase 回 PR 代码 = 回退 master 已修好的 retired 行过滤 + seq-0 声明两处语义(回归)。正确处理 = 零回归。
  4. 怎么修复的:把 PR 分支重构成 = 当前 master + PR 独有测试文件(114 行新增),丢弃被取代的 store.ts/mysql.ts 改动;diff 变纯新增(+114,1 文件);本地定向验证 2/2 通过;force-push(本次任务明确授权)。
  5. 是否有回归问题:无。纯新增一个测试文件,未动任何既有代码/测试;既有 issue4725-covered-seq-sentinel.test.ts 不受影响。测试 1 与 master N3 测试场景重复 = 冗余非回归,保留原样并标注,由你决定是否裁剪。
  6. 是否破坏缓存:不涉及。改动只在存储侧诊断回填路径的测试,不碰前缀缓存 / cache ref / 增量游标 / 去重键。
  7. 是否改了设计方向:没有。仍是 After model switch / client-side history rewrite, all message identities (content hashes) are replaced: ACP numbers re-m | 切模型/客户端重写历史后,消息身份(内容哈希)全部更换:acp 编号重铸、折叠覆盖大规模重挂、死 ref、churn 区临时膨胀重折 #4316 layer 3 同一机制(coverage → canonical seq interval)。
  8. 是否引入了新的配置:没有。无新 env/config/默认值。

判定:冲突已解,PR 现在可合并(等 CI + 你的 review)。建议 A(合并 + 关 #4512);或 B(关 PR 为 superseded + 直接关 #4512)。合并按规矩由你来。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[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):

  • What I did: The PR's code fix was already on master in a strictly-better superset form (via the [PR] chore: empty PR (no changes) #4725 N3 review train: retired_at IS NULL live-row filter + -1/-1 no-claim sentinel). Re-applying the branch's older code would have regressed both, so I resolved the conflict by making the branch = current master + the PR's unique regression test only (tests/issue4512-ingest-span-in-clause.test.ts, +114, 1 file, purely additive). Force-pushed (authorized for this conflict rebase).
  • Verified: targeted test 2/2 green against master's code; live mergeable: true, mergeable_state: blocked (normal — awaiting CI + review); CI queued on the new head (22 pending, 0 failed).
  • Flag: test 1 (600-id multi-batch) overlaps master's existing issue4725-covered-seq-sentinel.test.ts N3 test; test 2 (directMessageIds feeds the union) is unique. Left the file as-is — happy to trim test 1 if you prefer.
  • Your call: (A) merge this PR (adds the unique test) then close #4335 Performance Regression Risk | #4335性能回归风险 #4512 — recommended; or (B) close the PR as superseded and close #4335 Performance Regression Risk | #4335性能回归风险 #4512 directly. I won't close anything (owner-only).

结构化八问

  1. 是什么问题:PR [PR] fix: ingestSession fetches only block-covered rows for seq bounds (#4512) #4522 与 base 冲突(merge state: dirty),需解冲突;解冲突时发现 PR 的代码修复已被 master 以更优超集形式收录。
  2. 什么原因导致的:master 这 20 天大改了 store.ts/mysql.ts(2162 增/428 删)造成文本冲突;更关键的是 #4335 Performance Regression Risk | #4335性能回归风险 #4512 的修复已通过 [PR] chore: empty PR (no changes) #4725 N3 评审列车合入 master,且 master 版本是超集(额外 retired_at IS NULL + -1/-1 无声明哨兵),PR 旧代码是严格劣化子集。
  3. 影响范围与严重程度:若机械 rebase 回 PR 代码 = 回退 master 已修好的 retired 行过滤 + seq-0 声明两处语义(回归)。正确处理 = 零回归。
  4. 怎么修复的:把 PR 分支重构成 = 当前 master + PR 独有测试文件(114 行新增),丢弃被取代的 store.ts/mysql.ts 改动;diff 变纯新增(+114,1 文件);本地定向验证 2/2 通过;force-push(本次任务明确授权)。
  5. 是否有回归问题:无。纯新增一个测试文件,未动任何既有代码/测试;既有 issue4725-covered-seq-sentinel.test.ts 不受影响。测试 1 与 master N3 测试场景重复 = 冗余非回归,保留原样并标注,由你决定是否裁剪。
  6. 是否破坏缓存:不涉及。改动只在存储侧诊断回填路径的测试,不碰前缀缓存 / cache ref / 增量游标 / 去重键。
  7. 是否改了设计方向:没有。仍是 After model switch / client-side history rewrite, all message identities (content hashes) are replaced: ACP numbers re-m | 切模型/客户端重写历史后,消息身份(内容哈希)全部更换:acp 编号重铸、折叠覆盖大规模重挂、死 ref、churn 区临时膨胀重折 #4316 layer 3 同一机制(coverage → canonical seq interval)。
  8. 是否引入了新的配置:没有。无新 env/config/默认值。

判定:冲突已解,PR 现在可合并(等 CI + 你的 review)。建议 A(合并 + 关 #4512);或 B(关 PR 为 superseded + 直接关 #4512)。合并按规矩由你来。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#4335 Performance Regression Risk | #4335性能回归风险

1 participant