Repository navigation
[PR] fix: build bounded-boot file index in O(N) instead of O(N^2) - #6688
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10120-pr.6688.e68d7d4This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6688.tgz
npm install -g packageInstall instructions are refreshed on each push. |
🔶 需要决策 (ai: vllm-qwen/qwen3.8-27b) 背景一句话: 本 PR 与更早开出的 #6663(外部贡献者 Afloat16,2026-11-14 06:59 UTC)是同一 issue #6662 的两个 PR,修复完全相同(bootBounded 的 O(N²)→O(N) 索引构建,src 改动字节等价),违反「一条线程一个修复 PR」;按先来后到应关后到的 #6688、保留 #6663,但 agent 无权关闭 PR,且我无外部贡献者 fork 分支的推送权限,无法把 #6688 的回归测试移植进 #6663。 查重: 重复 —— #6688 与 #6663 重复(同一目标 issue #6662、同一机制、同一修法)。#6663 先到(06:59 UTC),#6688 后到(09:32 UTC);#6688 开 PR 前的查重(见 #6662 线程 09:45 评论)漏检了当时已 open 的 #6663,属流程违规,在此如实记录。 待决问题: 保留哪个 PR?
我的推荐: 选项 A。不决定的默认行为: 两个 PR 都挂着、都不合并,#6662 保持未修——现状是最坏结果。 Review 结论(八问):
验证证据:
标签: 已给 #6688 补 结论: 代码本身可合(§7.4 自动合并门禁 1-8 全满足,待 CI 绿);唯一阻塞是两 PR 一线程的处置,请按选项 A/B 拍板。 |
bootBounded() re-copied every previously-accepted path reference for each new file when building the per-root index, giving O(N^2) copies per root that ran even with maxSessions=0 (decode window disabled, #5219). At 20k files/root the two roots copied ~400M references before listen. Allocate each root's file list once and append accepted paths in traversal order; the complete disk index, hot/cold separation, content-store filtering, candidate ordering, and background scan are all unchanged. Closes #6662
a7c048a to
7c3ba91
Compare
(ai: vllm-qwen/qwen3.8-27b) 本轮收工:PR #6688 与 master 的冲突已解决并推送。rebase 后净变更只剩回归门禁测试——因为 O(N) 修复本身已经通过 #6663 合入 master 了。 七问:
|
What
SessionStore.bootBounded()built each root's file index withfilesByRoot.set(root, [...(filesByRoot.get(root) ?? []), file]), re-copying everypreviously-accepted path reference for each new accepted file — O(N^2) copies per
root. The work runs even when
maxSessions=0disables the decode window (#5219),so that cap could not remove it. At 20k files/root the two roots copied ~400M
references before the proxy could listen.
Fix
Allocate each root's file list once and append accepted paths in traversal order:
The complete disk index, hot/cold separation, content-store filtering, candidate
ordering, warm limits, and the background scan are all unchanged — only the index
build's allocation pattern changes.
filesByRootis read later (hot path +legacy loop) in traversal order, which is preserved.
Verification
tests/issue6662-bounded-boot-file-index.test.ts: timesboot({ maxSessions: 0 })over 20k files/root (40k total) and asserts thelinear cost. Measured on this machine: 181ms (fixed) vs 2913ms (O(N^2))
— the gate's 1000ms bound separates the two with wide margin.
tsc --noEmitclean.scripts/bench-bounded-boot-index.mjs):base median 3595ms vs fixed 253.5ms for 20k/root.
Closes #6662