Skip to content

ci: shard Electron smoke tests across two jobs per platform - #341808

Merged
Logan Ramos (lramos15) merged 2 commits into
mainfrom
lramos15/agents/shard-tests-for-faster-ci
Oct 16, 2026
Merged

Logan Ramos (lramos15) merged 2 commits into
mainfrom
lramos15/agents/shard-tests-for-faster-ci

Conversation

@lramos15

Copy link
Copy Markdown
Member

Refs #341382

The Electron smoke tests are the slowest PR job on all three platforms. On the slower Linux runners they take about 20 minutes and keep hitting the smoke step's 20 minute timeout. This PR splits them into two shards per platform. The required checks keep their names, so branch protection doesn't change.

Changes

  • New --shard <index>/<total> runner option, in test/smoke/src/shard.ts.
    • Each top-level suite runs in exactly one shard. Suites are assigned longest first, using a small table of estimated CI durations.
    • Suites whose tests are all skipped on the current platform count as zero (for example, Terminal on Linux).
    • An out-of-date estimate only makes the shards uneven; it never skips a suite.
  • Matrix shards: pr.yml runs the Electron smoke tests as a two-shard matrix per platform. The shards report as <OS> (shard 1/2) / Electron-Smoke and <OS> (shard 2/2) / Electron-Smoke.
  • Gate job: a matrix gate job, electron-smoke-checks, reports the existing required <OS> / Electron-Smoke checks. A platform's check fails if any of its shards did not succeed.
  • Placement tied to the workflows:
    • On Windows, WSL is set up only in shard 1, and the WSL Dev Container suite is pinned there. VSCODE_SMOKE_TEST_WSL_REQUIRED stays set in every shard so all shards register the same suites and compute the same split.
    • On macOS, the PAC proxy Agents Window runs happen only in the last shard, and the balancer reserves about 270s for them there.
  • Duration summary: the runner prints each top-level suite's duration at the end of a run, so the estimate table is easy to update.
  • Docs: updated the smoke-tests skill and the smoke README.

Expected impact

These estimates use the per-suite timings from run 38443277116:

Platform Smoke step today Slower shard (estimated)
Linux 1179s ~591s
macOS (incl. proxy runs) ~1027s ~551s
Windows (incl. WSL setup) ~1024s ~546s

Notes for reviewers

  • Every shard must register the same list of suites; otherwise suites can be skipped or run twice. Don't make suite registration depend on anything that differs between shards.
  • Artifact names and the Windows JobId runner label get a -shard<N> suffix.
  • Each extra shard repeats about 1.5–3.5 minutes of job setup. That includes one more macOS xlarge runner per run.
  • This doesn't address the roughly 6 seconds each app launch got slower around Sep 16, which the issue also describes.

How to test

Run one shard locally with npm run smoketest -- --shard 1/2. This PR's CI exercises the sharded jobs end to end.

Validation done:

  • node ../../node_modules/typescript/bin/tsc6 (in test/smoke): passed.
  • Throwaway mocha dry-run harness over the compiled runner, with VSCODE_QUALITY=oss VSCODE_SMOKE_TEST_POLICY=1 and --shard values 1/2, 2/2, 1/3, 2/3, 3/3 and 1/1. Run both with and without VSCODE_SMOKE_TEST_WSL_REQUIRED=1. Passed: shards never overlap and together match the unsharded list of 132 tests, 1/1 matches the unsharded run, and the WSL suite always lands in shard 1.
  • --shard values 0/2, 3/2, 1/0, abc and 2 each exit with code 1 and a clear message: passed.
  • The end-of-run duration summary, checked against fake suites including a failing run: passed. The exit codes are unchanged.
  • npm run eslint -- test/smoke/src/shard.ts test/smoke/src/main.ts test/smoke/test/index.js: passed.
  • node build/hygiene.ts on the changed files: passed.
  • actionlint -shellcheck= .github/workflows/pr.yml .github/workflows/pr-linux-test.yml .github/workflows/pr-darwin-test.yml .github/workflows/pr-win32-test.yml: no new findings. The only findings are 6 existing warnings about unknown self-hosted runner labels.
  • Not run locally: the smoke tests themselves, because they launch VS Code windows.

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.

🔵 Needs a closer look

Required-check cancellation handling needs correction, and cross-platform orchestration still needs end-to-end CI confirmation.

1 open finding
What changed in this PR

Splits Electron smoke tests across two jobs per platform to reduce timeout failures while preserving required-check names.

Changes:

  • Adds duration-balanced suite sharding and timing summaries.
  • Configures platform matrices, aggregation gates, and shard-specific setup.
  • Documents sharding and artifact naming.
File Description
test/​smoke/​test/​index.js Reports suite durations.
test/​smoke/​src/​shard.ts Parses shard selections and balances suites.
test/​smoke/​src/​main.ts Applies shard selection.
test/​smoke/​README.md Documents the shard option.
.github/​workflows/​pr.yml Adds shard matrices and required-check gates.
.github/​workflows/​pr-win32-test.yml Adds sharding and first-shard WSL setup.
.github/​workflows/​pr-linux-test.yml Passes shard inputs and separates artifacts.
.github/​workflows/​pr-darwin-test.yml Adds sharding and last-shard proxy runs.
.github/​skills/​smoke-tests/​SKILL.md Updates CI and debugging guidance.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/pr.yml Resolved
The Electron smoke step takes up to ~20 minutes on the PR runners and is hitting its 20 minute timeout. Add a --shard <index>/<total> option to the smoke runner that balances top-level suites by estimated duration, run two shards per platform as a matrix, and keep the required <OS> / Electron-Smoke checks with a gate job.

Refs #341382

Co-authored-by: Copilot <[email protected]>
…ired checks

A skipped job counts as passing for required status checks, so gating on !cancelled() let a cancelled run satisfy the required <OS> / Electron-Smoke checks. Run the gate with always() and keep failing it unless every shard succeeded.

Co-authored-by: Copilot <[email protected]>
@lramos15
Logan Ramos (lramos15) merged commit 4d18028 into main Oct 16, 2026
67 of 68 checks passed
@lramos15
Logan Ramos (lramos15) deleted the lramos15/agents/shard-tests-for-faster-ci branch October 16, 2026 11:08
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 16, 2026
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.

4 participants