Skip to content

[PR] ci(#4360): content-hash caching for pretest dist + bolder Windows sharding — test lane down to ~6.5 min | ci(#4360): pretest dist 内容哈希缓存 + windows 分片加粗 — 测试车道压到 ~6.5 分钟 - #4361

Closed
ranxianglei wants to merge 2 commits into
masterfrom
2026-10-23_ci_windows_under_8min

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Closes #4360

目标

CI 测试车道 <8 分钟(Windows)。三个杠杆,前两个已进 master,本 PR 是最后一个:

  1. pretest dist 内容哈希缓存 —— 已由 [PR] CI: build once, reuse everywhere — cache kernel/pi-subagents dist by content hash so legs stop rebuilding 6 minutes of artifacts every run #4377 进 master(经由 package.json pretest 脚本接线;本 PR 与之完全兼容,rebase 后零重叠)。
  2. closeAllConnections() 的 linger 3s 税 —— 已由 [PR] fix(server): closeAllConnections() cuts through the post-response linger (#4380) #4384 进 master:每个 proxy teardown 固定 ~3s 空等被消除(lane matrix 194s→2.6s、plugin-fork 150s→8.9s)。
  3. 本 PR:按实测耗时平衡分片 + Windows 分片加密。

问题:行数均衡 ≠ 耗时均衡

旧 LPT 按行数分片,「完美均衡」的字节数产出了 5min..37min 的腿(同一 run 的 windows 22-1=5.1min vs 22-5=37min+):spawn 密集型套件每行成本比纯断言文件高一两个数量级。

修复

  • scripts/ci-shard-partition.mjs(+.d.mts):权重 = 实测 ms(scripts/ci-shard-weights.json),未测量文件回退 lineCount × msPerLineFallback(中位数);LPT 算法不变,仍是确定性、total(union == 全部文件,零覆盖损失)。
  • scripts/ci-shard-weights.json:840 文件全量实测表,post-[PR] fix(server): closeAllConnections() cuts through the post-response linger (#4380) #4384 树上单文件计时(~66min 串行总量);本地环境挂起文件按 150s 超时下界记录并列入 timedOut,本地 rc=1 环境失败排除。平衡退化时用 scripts/measure-test-durations.mjs 再生。
  • ci.yml:windows-22 CORE 3→5 分片;FULL windows(22+24)3→5。
  • 效果(本地预演):最大片串行 1984s → 794s(片内 c=4 并行,目标 ~7min worst-leg 含 setup)。
  • 顺带(d06d192):[PR] fix(ci): run corrupt index.db degrade checks in a child process so windows cleanup can't hit EBUSY (#4338) #4378 把 corrupt-index 检查移进子进程时漏了 LIVE_FILES 登记,SPAWN_RE 绊线在 master 上正拦着每条腿——本 PR 尾部追加登记(storage-engine-proofs、web-storage-banner)。

测试

  • tests/ci-shard-weights.test.ts 4 test:测量值优先/行数兜底、monster 隔离、确定性+total、表内条目必须真实存在(防 stale)。
  • 45/45 绿(ci-shard-weights + ci-pretest-cache + ci-runner-failure-shapes),typecheck 干净,LIVE_FILES 43 条,storage-engine-proofs 12/12 绿(带新端口带)。

注意

  • 分片名变化:test (windows-latest, 22, 4)、(22, 5)、(24, 4)、(24, 5) 为新检查名,若 branch protection 精确枚举了检查名需要同步(用通配则无需)。
  • 权重表是快照不是持续校准:新落地的重量级套件先走行数兜底,平衡明显退化时跑一次 regen 即可(README 注释里写明)。

@ranxianglei ranxianglei changed the title ci(#4360): pretest dist 内容哈希缓存 + windows 分片加粗 — 测试车道压到 ~6.5 分钟 [PR] ci(#4360): content-hash caching for pretest dist + bolder Windows sharding — test lane down to ~6.5 min | ci(#4360): pretest dist 内容哈希缓存 + windows 分片加粗 — 测试车道压到 ~6.5 分钟 Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-23_ci_windows_under_8min (d06d192)

Option A — Install this exact build (recommended)

npm install -g [email protected]

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zai/glm-5.3)

关联:#4380 / PR #4384 修复了每个 proxy teardown 固定 ~3s 的 post-response linger 税(lane matrix 194s→2.6s)。这是本 PR 8 分钟目标的最大单项杠杆——本分支的分片权重表将在 #4384 合并后用修复后的真实耗时重新生成。

ework-agent added 2 commits October 23, 2026 20:30
Line-count LPT balanced bytes, not seconds: process-spawning suites
cost orders of magnitude more per line than pure assertion files, and
the 'perfectly balanced' layouts still produced 5min..37min legs from
equal byte counts (windows 22-2/22-3 vs 22-1/22-4 on the same run).
With #4384's linger cut landed the per-file wall times are stable
enough to weight the partition by MEASURED duration:

- scripts/ci-shard-partition.mjs: fileWeight = last measured ms per
  file (scripts/ci-shard-weights.json), new files fall back to
  lineCount x msPerLineFallback (median ms/line); same deterministic
  total LPT otherwise.
- scripts/ci-shard-weights.json: 840-file table measured post-#4384
  (single-file node --test runs, VM, ~66min serial total); local-env
  hangs capped at the 150s timeout and listed under timedOut, local
  rc=1 env-fails excluded. Regenerate via
  scripts/measure-test-durations.mjs when shard balance degrades.
- run-ci-tests.mjs delegates partitionAll to the module (this script
  has top-level side effects and cannot be imported by tests).
- ci.yml: windows-22 CORE 3->5 shards, windows FULL 3->5 (both node
  versions) — measured max shard drops 1984s->794s serial (concurrency
  c=4 per shard => ~7min worst-leg target incl. setup).

Closes #4360 (with #4377's dist cache + #4384's linger cut, the three
levers of the 8-minute goal)
…follow-up)

#4378 moved the corrupt index.db degrade checks into spawned child
processes but skipped the LIVE_FILES registration, so the SPAWN_RE
tripwire fails every run-ci-tests leg on master right now. Appended at
the tail (slot = index, no renumbering).
@ranxianglei
ranxianglei force-pushed the 2026-10-23_ci_windows_under_8min branch from 92cd873 to d06d192 Compare October 23, 2026 12:32
@ranxianglei

Copy link
Copy Markdown
Owner Author

#4377(dist 内容哈希缓存,叠在 #4355 上)已于 2026-10-23 09:59 合并,与本 PR 目标相同;本 PR 关闭作为被取代。若这里面还有 #4377 没覆盖的点,欢迎在新 PR 里捡起来。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复——这是对已关闭条目的遗留点捡起,不是新立项;检索 open issues/PRs(sharding / 分片 / duration-weighted CI)无在途同类工作。

两条未答评论的回应

按你 4F 的指示捡起了本分支剩余杠杆(「若这里面还有 #4377 没覆盖的点,欢迎在新 PR 里捡起来」):

分支 2026-10-23_ci_windows_under_8min 上共 2 个 commit,逐一核对:

commit 内容 处置
d06d192ff LIVE_FILES 注册两个 corrupt-index spawn 套件 不捡——已经由 #4416 进了 master(同一机制,行内容一致)
0569781af 分片按实测耗时加权(LPT)+ windows 3→5 腿 捡起——master 没有,cherry-pick 到当前 master 干净落地 → PR #4439(issue #4437,标签 scope/ci + p3)

效果:测量时点 max-shard 串行 1984s→794s;对当前 master 文件集(861 文件,21 个新增走回退权重)本地复算 n=3 max≈1360s → n=5 max≈816s,五腿负载差 <1s,Windows 最重腿目标 ≈7 分钟(含 setup)。

需要 owner 动作一项:出现 4 个新 check 名 test (windows-latest, 22, 4|5)、test (windows-latest, 24, 4|5)——branch protection 按 test (os, node, shard) 名 keying,需把这 4 个加入 required checks,否则新 shard 失败不挡合并(PR 描述与 #4437 均已披露)。

结构化八问

  1. 是什么问题:CI 测试分片按行数切,但行数 ≠ 耗时——进程派生型套件几百行要跑几分钟,导致个别 Windows 腿 20+ 分钟、别的腿 5 分钟,整条车道墙钟被最重一腿拖着。
  2. 什么原因导致的:LPT bin-packing 以行数为权重;spawn 型套件每行成本比纯断言文件高几个数量级,「按字节均分」≠「按秒均分」。
  3. 影响范围与严重程度:仅内部 CI,无外部用户影响;性能/体验级(lane 墙钟 10–18 min → 目标 ~7 min),非功能缺陷。
  4. 怎么修复的:分区权重换成每文件实测毫秒([PR] fix(server): closeAllConnections() cuts through the post-response linger (#4380) #4384 后实测表;新文件回退 lineCount×fallback),LPT 保持确定性+全覆盖(所有 shard 并集 == 全部文件,零覆盖损失);windows 分片 3→5。
  5. 是否有回归问题:审过既有行为——分区仍 total/deterministic(新测试钉并集不变量+确定性);ubuntu 车道保持 /3 不变;既有 12 个 check 名不变且继续生效;唯一风险面是 4 个新 shard 未入 required checks 前的保护缺口(已披露,方向是少挡不多挡)。无 kernel/wire/config/持久化变更。
  6. 是否破坏缓存:不涉及(CI 基建,与运行时缓存/重试/增量游标无关)。
  7. 是否改了设计方向:没有——同一 LPT 框架内换权重来源+加粗分片数,架构与数据流不变。
  8. 是否引入了新的配置:没有(无新 env/config/默认值;权重表是仓库内数据文件,配再生成脚本 scripts/measure-test-durations.mjs)。

结论:本条目保持关闭(被取代判定成立,不回滚);剩余杠杆已由 #4439 独立闭环(Closes #4437),等 CI 绿光 + 人工合并;branch protection 补 4 个 check 名需要你操作。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

这条(4F 的「捡起来」指示)已在 7F 完整处理——遗留杠杆已捡起为 PR #4439(issue #4437),八问与 owner 动作项都在那条回复里,不重复。

补充一个状态更新:#4439 的首次 CI 运行在 16:22:32Z 被整体取消(10 个 workflow 同一时刻 cancelled)。取消前 guard 类 job 正常跑了约 4 分钟,零失败;分支上没有第二次运行记录,不是并发组自取消,属外部/手动取消。改动本身不需要任何代码动作——随时可 Re-run 或在下次 push 时自动重跑;如果你是想等 branch protection 补上 4 个新 check 名(test (windows-latest, 22|24, 4|5))再跑,那正好可以一起办。

ranxianglei pushed a commit that referenced this pull request Oct 23, 2026
Line-count LPT balanced bytes, not seconds: process-spawning suites
cost orders of magnitude more per line than pure assertion files, and
the 'perfectly balanced' layouts still produced 5min..37min legs from
equal byte counts (windows 22-2/22-3 vs 22-1/22-4 on the same run).
With #4384's linger cut landed the per-file wall times are stable
enough to weight the partition by MEASURED duration:

- scripts/ci-shard-partition.mjs: fileWeight = last measured ms per
  file (scripts/ci-shard-weights.json), new files fall back to
  lineCount x msPerLineFallback (median ms/line); same deterministic
  total LPT otherwise.
- scripts/ci-shard-weights.json: 840-file table measured post-#4384
  (single-file node --test runs, VM, ~66min serial total); local-env
  hangs capped at the 150s timeout and listed under timedOut, local
  rc=1 env-fails excluded. Regenerate via
  scripts/measure-test-durations.mjs when shard balance degrades.
- run-ci-tests.mjs delegates partitionAll to the module (this script
  has top-level side effects and cannot be imported by tests).
- ci.yml: windows-22 CORE 3->5 shards, windows FULL 3->5 (both node
  versions) — measured max shard drops 1984s->794s serial (concurrency
  c=4 per shard => ~7min worst-leg target incl. setup). Four NEW check
  names appear (windows 22/24 shards 4/5); branch protection must add
  them before they gate merges.

Cherry-picked from closed PR #4361 (commit 0569781, stranded when
the PR was superseded by #4377; picked up per owner invitation in the
#4361 thread). The sibling LIVE_FILES commit (d06d192) is already on
master via #4416 and is not included.

Closes #4437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant