Repository navigation
test: run the longest Agent Host E2E suites in two processes - #345871
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Shard filtering leaves Mocha’s exclusive-test selection intact, allowing a discarded test.only(...) to be restored and run in both shards.
1 open issue
What changed in this PR
This PR aims to shorten Agent Host E2E checks by splitting the four longest suites across two processes each, using new test-level sharding in the Electron runner.
Changes:
- Adds
--testShardto partition loaded tests, disables worker mode when supplied, and clears it for failed-test reruns. - Schedules ten suite processes, prioritizes longer suites, and distributes processes across CI shards.
- Updates startup-test expectations, script help, and E2E documentation.
| File | Description |
|---|---|
test/unit/electron/renderer.js |
Partitions loaded tests into contiguous shards. |
test/unit/electron/index.js |
Parses sharding options and handles workers and reruns. |
test/integration/agentHost/runner.ts |
Splits long suites and schedules their processes. |
src/vs/platform/agentHost/test/node/e2e/README.md |
Documents split-suite execution. |
scripts/test-agent-host-e2e.sh |
Updates process-level sharding help for POSIX. |
scripts/test-agent-host-e2e.bat |
Updates process-level sharding help for Windows. |
build/lib/testAgentHostE2EStartup.test.ts |
Updates expected process counts and shard assignments. |
Review effort: Balanced
|
Base:
|
0cf3111 to
bed7491
Compare
The Agent Host E2E runner runs each suite in one process, and the Copilot, Conformance and Claude suites take about 240s each on Linux, twice as long as the others. The machine is busy for the first 80s, then idles at 20-65% while those suites finish. The Electron test runner's new --testShard <i>/<n> keeps one contiguous part of the loaded tests, so that the runner can run the Copilot, Conformance, Claude and Codex suites in two processes each, longest first, each with its own Agent Host server. --shard now distributes these processes. Reruns of failed tests ignore --testShard. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…us halves The slow tests sit at the end of each file, so the second contiguous half of each suite took 3-5 times as long as the first (Conformance 53s vs 241s), and the longest process was as long as the whole suite before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mocha restores the tests selected with .only() before running, so each shard ran them all. Errors thrown before the run were also reported as {}, because JSON.stringify drops an Error's message.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bed7491 to
08a325c
Compare
|
Logan Ramos (@lramos15) FYI: since this merged, Windows x64 Agent Host E2E fails in main CI (492607). All 8 two-process suites exit 255 right away with The cause is a latent bug in I'm preparing a small fix that saves the script name before the loop, as a draft with a Windows proof run. I'll link it here.
|
shift also shifts %0, so after the argument loop %~nx0 is the last argument. Since #345871 the Agent Host E2E runner passes --tfs values such as "Integration Tests Copilot (1/2) full", which made %~nx0 "2) full". cmd parses the whole help block even when it does not run it, so the ")" ended the block and every two-process suite failed with "full was unexpected at this time." on Windows. Save the script name before parsing instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ck (#345947) shift also shifts %0, so after the argument loop %~nx0 is the last argument. Since #345871 the Agent Host E2E runner passes --tfs values such as "Integration Tests Copilot (1/2) full", which made %~nx0 "2) full". cmd parses the whole help block even when it does not run it, so the ")" ended the block and every two-process suite failed with "full was unexpected at this time." on Windows. Save the script name before parsing instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ct builds Product builds pass --tfs last, so the --tfs value, with the suite label the runner appends, is the last argument that reaches test-integration.bat. PR CI passed --rerun-failed-files 2 after it, so the #345871 break in that script, which depended on the last argument, passed PR CI and failed product builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ct builds (#345957) * ci: end the Windows PR Agent Host E2E arguments with --tfs like product builds Product builds pass --tfs last, so the --tfs value, with the suite label the runner appends, is the last argument that reaches test-integration.bat. PR CI passed --rerun-failed-files 2 after it, so the #345871 break in that script, which depended on the last argument, passed PR CI and failed product builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: keep --runList last and pair the node.js integration step The Agent Host E2E runner consumes --runList and --shard, so --tfs before --runList still makes the --tfs value the last forwarded argument. The paired node.js integration step takes the same order, as agentHostTestSelection.test.ts requires. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Note
Builds on #345835 (merged), which split the Windows Agent Host E2E job into three shards. With this PR, the 10 processes split 4/3/3 across them, and this PR's CI will show whether the third shard is still worth a runner.
Part of an effort to speed up the PR checks. Agent Host E2E is the longest test step:
The runner runs each of its six suites in its own process, so the step lasts as long as the longest suite. On Linux (run 41674329242), Copilot, Conformance and Claude each took ~230–240s and Codex ~190s; the others take well under a minute.
The runner's
/procsamples show the cost of that imbalance:Changes
--testShard <i>/<n>in the Electron test runner (test/unit/electron/renderer.js,index.js): after the files load, it keeps every<n>th loaded test, starting with the<i>th. Contiguous halves were unbalanced because the slow tests sit at the end of each file (Conformance 53s vs 241s). Mocha skips suites left without tests, hooks included. It is excluded from--workerslike--testSplit, and reruns of failed tests clear it so a rerun can't filter out the test it reruns.test/integration/agentHost/runner.ts): Copilot, Conformance, Claude and Codex run in two processes each (parts: 2). Each process runs half of the file's tests against its own Agent Host server, which the suites' lease already handles: there is per-test setup and teardown, and no assertion spans all tests.--shardnow distributes processes, so the two halves of a suite can run on different Windows shard jobs.build/lib/testAgentHostE2EStartup.test.ts, the script help, and the E2E README.Results
Measured before #345835 merged, with two Windows shards.
🧪 Run Agent Host E2E tests (Electron), one run with every-other-test shards:The halves are balanced now (Copilot 228s/243s, Conformance 135s/154s, Claude 204s/190s, Codex 185s/171s). On Linux, though, each half takes about as long as the whole suite took before: 10 processes on 8 cores are CPU-bound, so Linux gains little beyond noise. Windows and macOS gain 50–145s.
Validation
cd build && node --test lib/testAgentHostE2EStartup.test.ts lib/test/agentHostTestSelection.test.ts: 14/14 pass, after updating the expected processes and shard assignment.shardTestsagainst a real mocha suite tree: shards cover each test exactly once, and suites left without tests skip their hooks.eslinton the changed runner files: clean