Skip to content

perf(ci): parallelize CI jobs and speed up slow test suites - #399

Open
PerfectPan wants to merge 4 commits into
mainfrom
perf/ci-speedup
Open

PerfectPan wants to merge 4 commits into
mainfrom
perf/ci-speedup

Conversation

@PerfectPan

@PerfectPan PerfectPan commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Reduce CI wall-clock time on both Linux and Windows by parallelizing serial bottlenecks and preventing CPU/disk oversubscription on 4-core runners:

  1. Parallelize architecture boundary lint cases (infra/architecture):
    • Group the 72 run-lint-cases.ts batches by package (largest first) and run disjoint package groups concurrently (capped at 4 with RAYON_NUM_THREADS=1).
    • Cache pnpm ls -r --depth -1 --json once per unchanged root via AGENT_KIT_PNPM_LIST_ROOT / AGENT_KIT_PNPM_LIST_JSON so repeated vp lint startups skip spawning pnpm ls.
  2. Reduce redundant full-GC overhead in streaming memory tests (packages/testing, claude-code, codex, grok):
    • Sample heap / trigger gc() every 8 chunks (~512 KB) in withSampledReads instead of every 64 KB chunk (~32 samples across a 16 MB session), and run 3 measured rounds after warm-up instead of 5.
  3. Split long serial test files for Vitest file-level parallelism:
    • Split packages/harness/test/uninstall-created-config.test.ts by agent (codex + cross-agent in original file, claude-code in uninstall-created-config-claude-code.test.ts, shared cases in test/support/uninstall-created-config.ts).
    • Split packages/acp/test/connect-agent.test.ts into connect-agent.test.ts and connect-agent-lifecycle.test.ts.
  4. Parallelize CI jobs and avoid oversubscription (.github/workflows/ci.yml, package.json):
    • Pass --no-sort to root format, format:check, lint, typecheck, and test scripts.
    • Split Linux check into parallel lint (building only shells + tsr generate with cached pnpm ls), verify (build + knip + typecheck + check:package), test (--workspace-concurrency=2), and architecture jobs while keeping an aggregate check job for branch protection.
    • Split Windows tests into parallel windows, windows-harness, and windows-architecture jobs so heavy NTFS/icacls churn does not contend with SQLite provider tests.

Validation

  • Local full gate: pnpm run format && pnpm run check passed.
  • Local repo checks: gh repo-checks repository && gh repo-checks release-plan passed.
  • CI measurements on PR perf(ci): parallelize CI jobs and speed up slow test suites #399 vs baseline #46891786147 on main (Linux check 4m40s, Windows windows 3m31s):
    • Run #46912772152 (all green): Linux check 2m18s (static 2m14s, test 1m35s, architecture 1m19s, check 4s); Windows Architecture tests dropped from 175.9s -> 55.0s.
    • Run #46922540056 (after splitting static -> lint/verify and windows-architecture): lint 1m19s, verify 1m20s, windows-architecture 1m21s, architecture 1m31s, test 2m16s, check 4s (all green); windows hit NTFS contention between harness and SQLite tests (goose/kilo), addressed in 789b88e7 by isolating windows-harness (pending GitHub Actions webhook dispatch).

Risks

  • withSampledReads samples every 8 chunks instead of every chunk; heap retention regressions on large streams (16 MB) are still sampled ~32 times per run and asserted against the same thresholds.
  • Splitting Linux and Windows workflows into parallel jobs trades additional runner minutes for lower wall-clock latency and isolation.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant