Skip to content

Reduce server test time and Windows package setup costs - #6227

Merged
ymichael merged 4 commits into
mainfrom
bb/ci-next-speedups
Oct 24, 2026
Merged

ymichael merged 4 commits into
mainfrom
bb/ci-next-speedups

Conversation

@ymichael

@ymichael ymichael commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Linux server shards used only two Vitest workers on four-vCPU runners while each shard ran one package, leaving parallelism unused. Windows package smokes downloaded npm packages and native prebuilds again on every job. Provider parity launched 70 real bridge replays for 48 scenarios because separate conformance tests repeated 22 scenarios already covered by the self-suite. The update-resolver tests independently constructed the same eight-commit Git repository seven times, starting 245 Git setup processes. Both repeated work on the Windows CI path after #6222 and #6225.

What changed

  • Cache only npm _cacache and _prebuilds for the Windows app smoke, with exact dependency/Node/OS keys. Fresh npm/npx installations, scripts, metadata refreshes, and assertions remain. Installed _npx trees and consumer directories are excluded. Hard restore failure/timeout leaves npm on its default cache; misses and suppressed restore errors clear partial downloads before activation. Successful misses save once, and exact hits remain immutable.
  • Give each existing Linux server shard four Vitest workers. Other Linux package groups retain two workers per package because several Turbo tasks run concurrently. No extra shards or larger runners.
  • Apply all five independent recorded conformance checks to the self-suite's existing Claude, Codex, and Pi replay results before event/timeline comparison. Keep the provider inventory assertions, all 48 replay scenarios, and all 59 test cases; remove 22 duplicate bridge launches and 77 repeated runtime requests. Preserve startup throttling and exported conformance helpers.
  • Build the real Git fixture once, then copy its entire repository and commit map per test. All 15 tests and assertions remain; moved and deleted tags still affect independent repositories. This removes 210 repeated Git setup processes.
  • Document the measurements and conformance ownership. No production code, public API, protocol, dependency, SDK version, or shard-count changes.

An SDK compiler-reuse experiment produced identical declarations but inconsistent timing improvements, so it is excluded from this PR.

How you verified

Windows npm-cache comparison 40106037278 passed cold → restored-download → cold-again smokes on two runners: 50.9 → 37.3 → 43.0s, and 74.3 → 43.9 → 60.6s. Local archive creation took 1–3s and extraction 0–1s. On the final PR commit, the cold-cache job passed its package smoke in 36.8s and saved the cache successfully. The exact-hit rerun restored the 68 MB archive in 0.8s, passed the fresh-install smoke in 30.7s, and correctly skipped saving. The smoke steps including Turbo took 38s cold and 32s warm; the warm restore adds about 1s. These two jobs are an integration confirmation, with the repeated controlled comparisons above providing the broader timing evidence. Actual action code passed a local exact-hit/miss/suppressed-error check, including removal of simulated partial prebuild archives. Turbo dry-run confirmed that only the smoke receives the cache variable and the smoke remains uncached. CI selection/workflow tests passed (30 tests), and actionlint passed.

Server worker comparison 40104954325 ran both existing shards twice per worker setting on four-vCPU Linux runners. All four candidate jobs passed. The actual server test tasks took 66–79s with two workers versus 46–60s with four, excluding SDK prerequisites. Whole steps took 85/95s versus 63/70s for shard 1, and 99s versus 72/81s for shard 2. One additional two-worker baseline failed the unchanged bundled-dependency rebuild assertion and is excluded from successful timings. All arrangements discovered the same 3,681 cases (3,680 passing and one existing skip in passing runs); only generated timestamps in test names were normalized for inventory comparison.

Two controlled comparisons, 40104010818 and 40104177343, each passed all eight jobs: two baseline and candidate replicas on each of four-vCPU Windows and Linux runners.

Measurement Before After
Windows provider-parity test step, four replicas each 31–33s; median 32s 25–31s; median 26s
Linux provider-parity test step, four replicas each 25–26s 21–22s
Windows update-resolver file, two replicas each 4.00–4.02s 1.76–3.32s
Linux update-resolver file, two replicas each 0.79–0.94s 0.41–0.55s

The Git file measurements include shared fixture setup. The original busy main run took 14.5s for this file; the table uses the controlled comparison instead. These are component measurements, not additive whole-CI savings. The benchmark also tried the excluded compiler change; emitted declarations were byte-identical across both platforms, and compiler prerequisites are excluded from the Git file measurement.

Independent mutation verification made all five Pi conformance checks fail in both the old aggregate test and retained replay: dropped reply, invalid event schema, duplicate turn start, missing completion, and empty output. Dropped replies also failed both old and retained Claude/Codex tests at the intended check. All mutations were restored byte-for-byte; independent review found no issues.

Local Turbo validation passed: provider parity (59 tests), update resolver (15 tests, also shuffled with seed 104), SDK (402 tests during the rejected experiment), and lint/typecheck for server, provider parity, and SDK. Formatting and diff checks passed. Initial full PR CI 40104525770 passed all 41 selected jobs, including all 16 Windows jobs, on ae0c029fb0. Worker-allocation full PR CI 40105491281 passed all 41 selected jobs, including all 16 Windows jobs, on 85a4a88ce2, in 2m14s from workflow creation to final completion. Linux server steps took 74s and 56s; the previous PR run took 99s and 94s. Whole-workflow timing also includes cache and runner variability, so the controlled component comparison above is the evidence for the optimization. Final full CI 40107142996, attempt 1 passed all 41 selected jobs, including all 16 Windows jobs, on d6831a1d4e. That run took 4m17s from workflow creation, including 70s before the first job started; Windows host packages finished last. The exact-hit Windows app smoke rerun also passed on the same commit. No checks remain pending.

AGENT GENERATED

@ymichael ymichael changed the title Avoid repeated provider replays and Git fixture setup in CI Reduce server CI time and repeated test setup Oct 24, 2026
@ymichael ymichael changed the title Reduce server CI time and repeated test setup Reduce server test time and Windows package setup costs Oct 24, 2026
@ymichael
ymichael merged commit 86be007 into main Oct 24, 2026
97 checks passed
@ymichael
ymichael deleted the bb/ci-next-speedups branch October 24, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant