Repository navigation
ci: split Windows Agent Host E2E into three shards - #343354
Draft
Michael Lively (Yoyokrazy) wants to merge 1 commit into
Draft
Michael Lively (Yoyokrazy) wants to merge 1 commit into
Michael Lively (Yoyokrazy) wants to merge 1 commit into
Conversation
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]>
Contributor
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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 (orAGENT_HOST_E2E_SHARD). It works like the smoke tests'--shard(test/smoke/src/shard.ts):estimatedSeconds.pr.yml:windows-agent-host-e2e-testsbecomes ashard: [1, 2, 3]matrix:Windows (shard <n>/3) / Agent-Host-E2E.required-checksstill reports the shards as part of the requiredWindows / Electroncheck. It reads the matrix job's combined result, as it does for the smoke shards.pr-win32-test.yml: newagent_host_e2e_shard_index/agent_host_e2e_shard_totalinputs, passed to the runner asAGENT_HOST_E2E_SHARD. The shard number is also added to the 1ESJobId, which must be unique per job, and to the artifact names.build/lib/test/agentHostTestSelection.test.ts:AGENT_HOST_E2E_SHARD, as it already ignores the change-detection skip.--shardand 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):
--jobs 2)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 inagentHostTestSelection.test.tsis the existing missingjs-yamltypes, from a root dependency not installed locally.node test/integration/agentHost/runner.ts --shard 4/3andAGENT_HOST_E2E_SHARD=0/2 node test/integration/agentHost/runner.tsfail withInvalid Agent Host E2E shardbefore any setup.npm run test-agent-host-e2e -- --shard 1/3runs Copilot and Copilot managed settings.Windows (shard <n>/3) / Agent-Host-E2Ejobs. 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.JobId(...-Agent-Host-E2E-shard<n>-...). Compile & Hygiene passed, including ESLint, hygiene, the build-script type check and the build-script tests.