test(ci): raise Windows vitest worker cap from 2 to 4#6005
Conversation
The Windows CI override pinned the vitest threads pool to `maxWorkers: 2`, leaving half of the 4-vCPU `windows-latest` runner idle. Raise the cap to 4 to fully use the runner and roughly halve Windows test wall-clock. Stability is preserved by the existing retry safety net: the root `test` script runs with `--retry 2`, so transient contention flakes are retried before failing the run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Vitest configuration's Windows CI concurrency cap ( Windows CI Vitest Config
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request increases the maxWorkers limit from 2 to 4 for Windows CI in vitest.config.ts. The reviewer points out that standard GitHub-hosted Windows runners only have 2 vCPUs, so setting maxWorkers to 4 may cause CPU contention and increase test flakiness. They suggest reverting the limit back to 2.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // Windows CI is more contention-sensitive than posix, so we cap the thread | ||
| // pool. Use the full standard `windows-latest` runner (4 vCPU) instead of the | ||
| // previous hard cap of 2; the suite already retries flaky tests (--retry 2). | ||
| ...(isWindowsCI | ||
| ? { | ||
| maxWorkers: 2, | ||
| maxWorkers: 4, | ||
| } | ||
| : {}), |
There was a problem hiding this comment.
The standard GitHub-hosted windows-latest runner actually has 2 vCPUs (2 cores), not 4 vCPUs. Setting maxWorkers: 4 on a 2-core machine will cause over-provisioning, leading to CPU contention and thread thrashing. Since Windows is particularly sensitive to process/thread context switching and file I/O overhead, this can significantly increase test flakiness and potentially slow down the overall test execution rather than speeding it up. It is highly recommended to keep maxWorkers: 2 to match the actual hardware resources of the standard runner.
| // Windows CI is more contention-sensitive than posix, so we cap the thread | |
| // pool. Use the full standard `windows-latest` runner (4 vCPU) instead of the | |
| // previous hard cap of 2; the suite already retries flaky tests (--retry 2). | |
| ...(isWindowsCI | |
| ? { | |
| maxWorkers: 2, | |
| maxWorkers: 4, | |
| } | |
| : {}), | |
| // Windows CI is more contention-sensitive than posix, so we cap the thread | |
| // pool. Use the standard windows-latest runner's 2 vCPUs to avoid | |
| // excessive resource contention. | |
| ...(isWindowsCI | |
| ? { | |
| maxWorkers: 2, | |
| } | |
| : {}), |
There was a problem hiding this comment.
This is based on an outdated spec. GitHub doubled the public-repository standard runners (Linux + Windows) to 4 vCPU / 16 GiB in early 2024:
Any Linux or Windows workflow triggered from a public repository, using GitHub's default labels, will run on 4-vCPU runners.
windows-latest standard |
Public repo | Private repo |
|---|---|---|
| vCPU / RAM | 4 / 16 GB | 2 / 8 GB |
The "2 vCPU" figure is the private-repo tier. eggjs/egg is a public repository, so its windows-latest legs run on the 4-vCPU runner — maxWorkers: 4 matches the hardware 1:1, it is not over-provisioning. The previous maxWorkers: 2 was leaving half the runner idle.
The general point about Windows being context-switch/IO-sensitive is fair, but it was derived from the wrong core count. As a safeguard the suite already runs with --retry 2, and the Windows CI legs on this PR are the empirical check; if they flake at 4 workers the fallback is maxWorkers: 3 (one core of headroom).
Refs:
Deploying egg with
|
| Latest commit: |
ec598c8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://86a81813.egg-cci.pages.dev |
| Branch Preview URL: | https://feat-windows-ci-concurrency.egg-cci.pages.dev |
Deploying egg-v3 with
|
| Latest commit: |
ec598c8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7aed09f9.egg-v3.pages.dev |
| Branch Preview URL: | https://feat-windows-ci-concurrency.egg-v3.pages.dev |
…rrency # Conflicts: # vitest.config.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #6005 +/- ##
==========================================
- Coverage 84.92% 84.91% -0.01%
==========================================
Files 676 676
Lines 20513 20513
Branches 4058 4058
==========================================
- Hits 17421 17419 -2
- Misses 2663 2665 +2
Partials 429 429 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Motivation
The Windows CI override in
vitest.config.tspinned the vitest threads pool tomaxWorkers: 2(added in #5926 for stability). The standard GitHubwindows-latestrunner has 4 vCPUs, so this left half the runner idle and made Windows the slowest matrix leg.Scope
Single-line config change: raise the Windows-CI
maxWorkerscap from2to4, with a comment documenting the rationale. No change to posix (linux/macOS) behavior.Stability
The original cap was conservative; stability is preserved by the existing retry safety net — the root
testscript runsvitest run --bail 1 --retry 2 ..., so transient contention flakes are retried (up to 2×) before failing the run. The Windows test matrix (windows-latest× Node 22/24) plustest-egg-binWindows leg in this CI run are the real validation. If higher contention proves flaky, the fallback ismaxWorkers: 3.Test evidence
oxfmt --check vitest.config.tspasses.Test (windows-latest, 22/24)andTest bin (windows-latest, 24)CI legs on this PR.🤖 Generated with Claude Code
Summary by CodeRabbit