Skip to content

test(ci): raise Windows vitest worker cap from 2 to 4#6005

Merged
killagu merged 2 commits into
nextfrom
feat/windows-ci-concurrency
Jun 27, 2026
Merged

test(ci): raise Windows vitest worker cap from 2 to 4#6005
killagu merged 2 commits into
nextfrom
feat/windows-ci-concurrency

Conversation

@killagu

@killagu killagu commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Motivation

The Windows CI override in vitest.config.ts pinned the vitest threads pool to maxWorkers: 2 (added in #5926 for stability). The standard GitHub windows-latest runner 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 maxWorkers cap from 2 to 4, with a comment documenting the rationale. No change to posix (linux/macOS) behavior.

+    // 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,
         }
       : {}),

Stability

The original cap was conservative; stability is preserved by the existing retry safety net — the root test script runs vitest 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) plus test-egg-bin Windows leg in this CI run are the real validation. If higher contention proves flaky, the fallback is maxWorkers: 3.

Test evidence

  • oxfmt --check vitest.config.ts passes.
  • Windows stability can only be validated on the runner itself — this is verified by the Test (windows-latest, 22/24) and Test bin (windows-latest, 24) CI legs on this PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved test stability on Windows CI by increasing the maximum parallel test workers (from 2 to 4), which may reduce flaky failures and speed up validation.

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>
Copilot AI review requested due to automatic review settings June 27, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 80683bb4-99ab-4e15-9de6-7bafa119f1f9

📥 Commits

Reviewing files that changed from the base of the PR and between 36d8650 and ec598c8.

📒 Files selected for processing (1)
  • vitest.config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • vitest.config.ts

📝 Walkthrough

Walkthrough

The Vitest configuration's Windows CI concurrency cap (maxWorkers) is increased from 2 to 4, with new inline comments explaining that this uses the full windows-latest runner capacity and relies on --retry 2 for flaky tests.

Windows CI Vitest Config

Layer / File(s) Summary
Windows CI maxWorkers update
vitest.config.ts
maxWorkers under the isWindowsCI condition raised from 2 to 4; added comments on contention handling and flaky test retry strategy.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops through CI lanes,
Four workers now share Windows pains,
No more two-worker crawl so slow,
With retries set, we let it flow,
🐇 More cores, more speed, let tests go! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main Windows CI Vitest worker cap increase from 2 to 4.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/windows-ci-concurrency

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread vitest.config.ts
Comment on lines +9 to 16
// 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,
}
: {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
// 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,
}
: {}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploying egg with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

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

View logs

@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.91%. Comparing base (f9662dc) to head (ec598c8).
⚠️ Report is 1 commits behind head on next.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@killagu killagu merged commit 4fa509e into next Jun 27, 2026
22 of 25 checks passed
@killagu killagu deleted the feat/windows-ci-concurrency branch June 27, 2026 14:50
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.

2 participants