Skip to content

Reduce CI work and eliminate long test waits - #6225

Merged
ymichael merged 5 commits into
mainfrom
bb/ci-runtime-performance
Oct 24, 2026
Merged

ymichael merged 5 commits into
mainfrom
bb/ci-runtime-performance

Conversation

@ymichael

@ymichael ymichael commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Windows usually finishes last, but Linux plugin and standalone fork checks also constrain PR latency. Pi's scripted subprocesses repeatedly loaded its whole runtime entry point, Connect's server-move integration test accidentally waited for an existing 25-second long poll, and several app tests spent seconds on mock-query polling and real enrollment timers. Repeated Markdown reference rendering and the single Linux plugin group added further work and a long completion tail. Full validation also exposed a real-clock account-test race and unnecessary skill-scanner metadata lookups.

What changed

Stacked on #6222, which adds Windows dependency-image reuse.

  • Load the real pinned Pi SessionManager directly in the scripted fixture; retain real CLI, public SDK persistence, settlement, and Bun checks.
  • Synchronize the Connect fixture's simulated RPC transport before enabling the server-move freeze. Both real plugins, the real tunnel socket, retry/resume assertions, and separate account timeout coverage remain.
  • Reuse identical independent Markdown reference renders; retain every incremental render/assertion. Reduce polling intervals only in the sequential mock-query helper and advance enrollment timers inside React act.
  • Skip ordinary supporting files before skill-scanner metadata lookups, preserving actual skill, link, boundary, and command handling. This removes 2,010 redundant calls from the existing 1,005-file fixture. Bump the bundled SDK runtime to 0.6.80, as required by the npm content guard.
  • Advance the account API malformed/null-response test with fake time and fixed retry jitter through its unchanged 300ms deadline. A random value of 0.66 reproduced the old error-classification failure deterministically by landing a retry exactly on the deadline; the fixed value of zero passes. The neighboring stale-answer test also uses fake time through its unchanged 50ms deadline and background-refresh windows, retaining expiry, retry-suppression, and recovery assertions.
  • Start the slow Pi fork first within its existing shard and cap each fork at two Vitest workers.
  • Split Linux plugins into two balanced groups. Windows app shards remain at four, now with four Vitest workers each. The net addition is one Linux job and zero Windows jobs. All existing blocking coverage remains.

The initial eight-Windows-shard experiment was removed: 15–19 seconds earlier completion cost approximately 31% more app runner time. Fewer shards with more workers were measured rather than assumed faster. No test cases were deleted and no timeouts were increased. The scanner optimization preserves discovery behavior; no wire or public API contracts changed.

How you verified

Wait-removal comparison passed all eight jobs, including before/after replicas on each OS, with identical test identities/counts/statuses:

Test step Before After
Windows Connect, 143 tests 36, 37s 12, 14s
Linux Connect, 143 tests 34, 34s 9, 11s

Windows query-file execution fell from 4.66–4.69s to 1.31–1.47s (30 tests); enrollment-file execution fell from 3.37s to 0.39–0.59s (8 tests). Local Connect freeze-case timing fell from 25.2s to 0.19s while preserving its assertions.

Windows worker comparison, using the same 6,303 app test identities:

Arrangement Longest test step Result
Four 4-vCPU shards, 3 workers each 82s Passed
Four 4-vCPU shards, 4 workers each 73s Passed; retained
Two 4-vCPU shards, 4 workers each 137s Passed
One 4-vCPU shard, 4 workers 374s Passed
One 16-vCPU shard, 12 workers 160s Passed
One 4-vCPU shard, 8 workers 353s Retry-button assertion failed; rejected

Actual CPU allocations were logged. The retained layout completed including queue/setup/teardown in 122s versus 131s for three workers, and consumed 392 versus 426 aggregate runner-seconds. These are individual-run measurements with runner variability.

Windows package-group worker comparison passed all four replicas with identical 41-task inventories on measured 4-vCPU runners. Two workers took 97–101s; three workers took 98–136s. The slow three-worker replica also spent 56s building SDK types versus 23–35s elsewhere. This does not establish a consistent worker-count improvement, so that setting remains unchanged. An earlier attempt omitted required mobile dependencies and was excluded from the comparison.

Earlier controlled measurements retained by this change: Windows Pi 61–62s → 34–39s, prepared Linux fork shard 84–85s → 60–72s, and balanced Linux plugins 136s → 68s. Group savings are not additive whole-workflow savings.

Timing-fix comparison passed both Windows control and candidate replicas with identical inventories/statuses (2 skill-index tests; 39 passing and 51 existing skipped Connect Next cases). Skill-index execution fell from 275–432ms to 179–184ms. An earlier full run hit timing failures in those unchanged tests; its remaining work was cancelled while these fixes were prepared. Controlled baselines passed, so this is not presented as a deterministic baseline correctness failure.

Local Turbo tests, CI-selection tests, lint/typecheck, actionlint, and diff checks passed, including 14 SDK/skill-index/Connect Next build/test/lint/typecheck tasks and the npm content guard. Final full CI 40077183131 passed on 42bf4d4e8f: 42 successful jobs, including all 16 Windows jobs, with 2 jobs skipped by existing conditions. Workflow creation to final completion was 3m12s. This is an integration result, not a controlled whole-workflow speedup measurement. Reviewed against the repository code-review guide and test-audit/deslop guidance.

AGENT GENERATED

@ymichael
ymichael marked this pull request as ready for review October 24, 2026 07:25
@ymichael ymichael changed the title Reduce CI test runtime and balance Windows and Linux shards Reduce CI work and eliminate long test waits Oct 24, 2026
Base automatically changed from bb/investigate-slow-windows-ci-builds-thr_gtbhvapit2 to main October 24, 2026 14:33
@ymichael
ymichael force-pushed the bb/ci-runtime-performance branch from 42bf4d4 to d67d0e9 Compare October 24, 2026 14:33
@ymichael
ymichael merged commit efd10ce into main Oct 24, 2026
51 checks passed
@ymichael
ymichael deleted the bb/ci-runtime-performance branch October 24, 2026 14:36
ymichael added a commit that referenced this pull request Oct 24, 2026
## 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](https://github.com/get-bb/bb/actions/runs/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](https://github.com/get-bb/bb/actions/runs/40107142996/job/120911379596)
passed its package smoke in **36.8s** and saved the cache successfully.
The [exact-hit
rerun](https://github.com/get-bb/bb/actions/runs/40107142996/job/120912184625)
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](https://github.com/get-bb/bb/actions/runs/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](https://github.com/get-bb/bb/actions/runs/40104010818) and
[40104177343](https://github.com/get-bb/bb/actions/runs/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](https://github.com/get-bb/bb/actions/runs/40104525770)
passed all 41 selected jobs, including all 16 Windows jobs, on
`ae0c029fb0`. [Worker-allocation full PR CI
40105491281](https://github.com/get-bb/bb/actions/runs/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](https://github.com/get-bb/bb/actions/runs/40107142996/attempts/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
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