Skip to content

ci: split Windows Agent Host E2E into three shards - #343354

Draft
Michael Lively (Yoyokrazy) wants to merge 1 commit into
mainfrom
agents/shard-windows-agent-host-e2e
Draft

Michael Lively (Yoyokrazy) wants to merge 1 commit into
mainfrom
agents/shard-windows-agent-host-e2e

Conversation

@Yoyokrazy

@Yoyokrazy Michael Lively (Yoyokrazy) commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Splits the Windows Agent Host E2E job into three shards of about two suites each. Without this, Windows Agent Host E2E becomes the slowest and flakiest PR check when the Windows jobs move to the GitHub-hosted 8-core pool (#343094). Tracking: microsoft/vscode-engineering#4273.

Changes

  • test/integration/agentHost/runner.ts: new --shard <index>/<total> option (or AGENT_HOST_E2E_SHARD). It works like the smoke tests' --shard (test/smoke/src/shard.ts):
    • Each suite has an estimatedSeconds.
    • Suites go longest first to the shard with the least estimated time, so every shard computes the same assignment and each suite runs exactly once.
    • With 3 shards: {Copilot, Copilot managed settings}, {Conformance, Copilot OTel}, {Claude, Codex}. A new suite is assigned automatically.
  • pr.yml: windows-agent-host-e2e-tests becomes a shard: [1, 2, 3] matrix: Windows (shard <n>/3) / Agent-Host-E2E. required-checks still reports the shards as part of the required Windows / Electron check. It reads the matrix job's combined result, as it does for the smoke shards.
  • pr-win32-test.yml: new agent_host_e2e_shard_index / agent_host_e2e_shard_total inputs, passed to the runner as AGENT_HOST_E2E_SHARD. The shard number is also added to the 1ES JobId, which must be unique per job, and to the artifact names.
  • build/lib/test/agentHostTestSelection.test.ts:
    • A new test checks the Windows matrix wiring, the 3-way assignment, and that every shard count from 1 to 6 runs each suite exactly once.
    • The test that pairs the Agent Host E2E step with the integration-test step now ignores AGENT_HOST_E2E_SHARD, as it already ignores the change-detection skip.
  • The Agent Host E2E README, the integration-tests skill and the script help mention --shard and the Windows shards.

Linux and macOS are unchanged: Agent Host E2E takes about 4–5 min there, because the Linux CI runs keep test data in memory.

Why

The suites are disk-bound on Windows. On the GitHub-hosted 8-core Windows runners they slow each other down when too many share one machine (measurements in microsoft/vscode-engineering#4273):

Layout (GitHub-hosted 8-core Windows) Agent Host E2E (slowest runner) Result
1 runner, all 6 suites at once 26.5–32.0 min 3 of 6 runs failed (request timeouts)
2 runners × 3 suites 12.4–12.9 min ❌ the heavy shard failed in both runs
3 runners × 2 suites 7.9, 9.1 min ✅ 6 of 6 jobs passed
6 runners × 1 suite 8.5 min ✅ 6 of 6 jobs passed
1 runner, 2 suites at a time (--jobs 2) 17.8, 27.8, 27.6 min ✅ 3 of 3, but slow on 2 runners
1ES today, 1 runner median 15.8 min 5.9% of runs failed

The experiment used {Conformance, Claude}, {Codex, Copilot OTel}, {Copilot, Copilot managed settings}. The runner's balancing produces the same structure: each shard has about two suites, and one shard has two heavy ones. Only one pairing differs: Claude + Codex instead of Conformance + Claude.

Cost: the 3 shards use about 36 runner-minutes, against about 16 for Agent Host E2E inside the single 1ES job today. That's 2 more Windows runners than the separate job from #342735, and only on PRs that run Agent Host E2E.

How to test

  • cd build && node --test lib/test/agentHostTestSelection.test.ts lib/test/detectChanges.test.ts lib/test/detectMissingCaches.test.ts: passed locally (22 tests).
  • node build/node_modules/typescript/bin/tsc --project build/tsconfig.json --noEmit: no new errors in the changed files. The only error in agentHostTestSelection.test.ts is the existing missing js-yaml types, from a root dependency not installed locally.
  • node test/integration/agentHost/runner.ts --shard 4/3 and AGENT_HOST_E2E_SHARD=0/2 node test/integration/agentHost/runner.ts fail with Invalid Agent Host E2E shard before any setup. npm run test-agent-host-e2e -- --shard 1/3 runs Copilot and Copilot managed settings.
  • This PR's CI changes the runner, so it runs the full Agent Host E2E profile in the three Windows (shard <n>/3) / Agent-Host-E2E jobs. Those run on the 1ES pool until ci: move PR checks to GitHub-hosted 8-core runners #343094 lands. ci: move PR checks to GitHub-hosted 8-core runners #343094 will be rebased on this PR to confirm the shards on the 8-core pool.
  • CI results (run 39680392871, 1ES): all three shards passed. Shard 1/3 (Copilot, Copilot managed settings) took 7.1 min, 2/3 (Conformance, Copilot OTel) 7.8 min, and 3/3 (Claude, Codex) 9.1 min, against a 15.8-min median with all 6 suites in one job. Each 1ES job got a unique JobId (...-Agent-Host-E2E-shard<n>-...). Compile & Hygiene passed, including ESLint, hygiene, the build-script type check and the build-script tests.

Add --shard <index>/<total> (or AGENT_HOST_E2E_SHARD) to the Agent Host
E2E runner. Like the smoke tests, suites go longest first to the shard
with the least estimated time, so every shard computes the same
assignment and each suite runs exactly once.

Run the Windows Agent Host E2E job as three shards of about two suites
each. The suites are disk-bound on Windows: with all six on one
GitHub-hosted 8-core runner they took 26.5-32 min and often timed out,
while two per runner finished in 8-9 min. required-checks still reports
the shards as part of Windows / Electron.

Refs: microsoft/vscode-engineering#4273

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 21:38
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: fc01a9db Current: 3372c387

Changed (1)

chat/aiCustomizations/customizationMigrationDashboard/MigrationsTooltip/Light
Before After
before after

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Splits Windows Agent Host E2E CI execution into multiple balanced shards to reduce wall-clock time and flakiness, and updates tooling/docs to support shard selection.

Changes:

  • Added sharding support (--shard / AGENT_HOST_E2E_SHARD) and suite duration estimates to balance shards deterministically.
  • Updated GitHub workflows to run Windows Agent Host E2E as a 3-shard matrix and wire shard inputs/artifacts/JobId uniquely.
  • Added tests and documentation to validate shard assignment and describe new usage.
File Description
test/​integration/​agentHost/​runner.ts Adds shard parsing/selection logic and exports helpers for tests.
src/​vs/​platform/​agentHost/​test/​node/​e2e/​README.md Documents --shard/AGENT_HOST_E2E_SHARD usage and new Windows CI layout.
scripts/​test-agent-host-e2e.sh Updates CLI help to include --shard.
scripts/​test-agent-host-e2e.bat Updates CLI help to include --shard.
build/​lib/​test/​agentHostTestSelection.test.ts Adds coverage for shard wiring and “runs each suite exactly once” invariant.
.github/​workflows/​pr.yml Converts Windows Agent Host E2E job into a 3-shard matrix and passes shard inputs.
.github/​workflows/​pr-win32-test.yml Adds shard inputs, threads shard env var, and makes artifacts/JobId unique per shard.
.github/​skills/​integration-tests/​SKILL.md Updates contributor documentation to reflect sharded Windows Agent Host E2E CI.

Review effort: Lite

Comment on lines +343 to +349
const assignments = new Map<ISuite, number>();
for (const suite of [...suites].sort((a, b) => b.estimatedSeconds - a.estimatedSeconds)) {
const target = shardSeconds.indexOf(Math.min(...shardSeconds));
assignments.set(suite, target);
shardSeconds[target] += suite.estimatedSeconds;
}
return suites.filter(suite => assignments.get(suite) === shard.index - 1);
}

// Loaded by build/lib/test/agentHostTestSelection.test.ts to check the shard assignment.
module.exports = { suites, parseShard, selectShardSuites };
function selectShardSuites(shard: IShard): readonly ISuite[] {
const shardSeconds = new Array<number>(shard.total).fill(0);
const assignments = new Map<ISuite, number>();
for (const suite of [...suites].sort((a, b) => b.estimatedSeconds - a.estimatedSeconds)) {

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.

2 participants