Skip to content

perf(ci): use four Vitest workers on hosted runners - #10399

Merged
morluto merged 1 commit into
mainfrom
perf/ci-vitest-workers
Nov 13, 2026
Merged

morluto merged 1 commit into
mainfrom
perf/ci-vitest-workers

Conversation

@morluto

@morluto morluto commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Summary

Portable test shards dominate PR CI time. Hosted jobs own a four-core runner, but every Vitest project is capped at two workers. This raises the cap to four on GitHub Actions only, as a measured trial. Draft until this PR's own CI run provides the comparison.

Problem and expected behavior

Baseline, fast-tier run 43460768388 (executed, observed):

  • Eight built shards ran 10.6–17.0 minutes each, about 115 runner-minutes; source tests ran 7.3 minutes.
  • Checkout and npm ci took under 30 seconds per shard, so the time is test execution.
  • Summed per-file time was 218 minutes, giving about 1.8x effective parallelism.

Expected: shard and source-test job time drops on the same runners with no new failures.

Change and scope

  • vitest.config.ts: MAX_TEST_WORKERS is min(4, availableParallelism()) when GITHUB_ACTIONS=true, otherwise unchanged at min(2, ...).
  • Local and agent-shared hosts keep two workers.
  • process-boundary stays serial (fileParallelism: false).
  • The shard sequencer already reads each project's maxWorkers as its lane width, so allocation follows the new cap. Recorded history was measured under two workers and refreshes after the next default-branch run.
  • Not included: moving fresh CLI/MCP spawns onto file-scoped sessions, and shard rebalancing.

The cap was set to two in f47ee1a, citing descriptor pressure from boundary subprocesses. docs/development/testing.md records an earlier six-file acceptance sample that went from 96–101s to 71s at four workers. That sample is bounded by its longest file; a full shard has hundreds of files.

Contribution scope: not applicable (test runner configuration within existing boundaries).

Contract and boundary impact

  • Semantic owner and earliest changed stage: vitest.config.ts owns the worker budget; consumers are the Vitest projects and tests/ciTestSequencer.ts.

  • Contribution scope fit and linked maintainer decision: not applicable.

  • CLI and MCP/tool-catalog contract: none.

  • Provider, bridge, target-format, or platform compatibility: none. Windows and macOS CI lanes also read GITHUB_ACTIONS and may use up to their core count for their focused test files.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

  • Launch or attach to a process.

  • Inject instrumentation or run scripts/code.

  • Change process memory, registers, files, or configuration.

  • Contact network services.

  • Recover protected code or work around protections.

  • Documentation or usability only; no target interaction.

  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: none; this is runner configuration.
  • Base reproduction or other evidence: baseline job and file timings above. The four-worker measurement is this PR's CI run and is not yet recorded here.
  • User-visible CLI/MCP output (if applicable): not applicable.
  • Remaining proof gaps:
    • Shard time at four workers is unmeasured until this PR's CI completes.
    • One run does not establish flake rate for timing-sensitive tests under higher contention.
    • Full-tier (coverage) shards are not exercised by a PR run.
    • Memory headroom at four workers is inferred from runner size, not measured.

Validation performed

  • npm run check:fast — typecheck and lint passed (2 tasks successful).
  • GITHUB_ACTIONS=true npx vitest run --project evaluation --project composition — 55 files, 933 tests passed, 2 skipped (local macOS, Node 24.22.1; confirms the config resolves, not a CI timing).
  • npx prettier --check vitest.config.ts docs/development/testing.md — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none; more concurrent test subprocesses on CI runners only.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

Hosted CI jobs own a four-core runner but the suite ran on two workers.
Other hosts keep the two-worker bound because they are shared.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@morluto
morluto marked this pull request as ready for review November 13, 2026 18:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T18:46:57.680569Z fe712c5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The code appears safe to merge; no actionable defect was found.

Summary

Raises the Vitest worker cap from two to four when GITHUB_ACTIONS=true, still bounded by availableParallelism().

  • GitHub Actions test jobs can use up to four Vitest workers.

Acknowledged by morluto: hosted timing, full-coverage behavior, flake rate, and memory headroom remain unmeasured. The PR explicitly presents this as a draft trial pending CI results.

Supersession could not be checked because GitHub access required authentication. Tests were not run.

Reviews (1) · Last reviewed commit: "perf(ci): use four Vitest workers on hos..." · Reviewed by Greptile

@morluto
morluto enabled auto-merge (squash) November 13, 2026 18:50
@morluto
morluto disabled auto-merge November 13, 2026 18:51
@morluto
morluto merged commit 3403338 into main Nov 13, 2026
14 of 15 checks passed
@morluto
morluto deleted the perf/ci-vitest-workers branch November 13, 2026 18:51
@morluto morluto added area: build Build, CI, packaging, and publishing performance Performance regressions, scaling limits, and bounded-resource work labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build, CI, packaging, and publishing performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant