Harden Agent Host E2E and protocol integration tests#327421
Merged
roblourens merged 2 commits intoJul 25, 2026
Merged
Conversation
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
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.
Hardens Agent Host E2E + protocol integration tests to reduce flakiness (timeouts/races), improve shutdown/cleanup reliability, and avoid cross-suite process overlap.
Changes:
- Introduces platform/coverage-aware protocol operation timeouts and removes wall-clock sleeps in favor of protocol barriers.
- Registers pending JSON-RPC calls before sending to avoid fast-response races; improves client cleanup paths.
- Centralizes graceful server shutdown with a bounded timeout and SIGKILL fallback; updates protocol suites to await shutdown.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/serverIntegrationTestHelpers.ts | Adds protocol timeouts, fixes JSON-RPC call ordering race, and centralizes bounded server shutdown (stopServer). |
| src/vs/platform/agentHost/test/node/protocol/turnExecution.integrationTest.ts | Replaces sleeps with turn-specific notification matching and uses shared stopServer. |
| src/vs/platform/agentHost/test/node/protocol/toolApproval.integrationTest.ts | Switches suite teardown to await stopServer with extended timeout. |
| src/vs/platform/agentHost/test/node/protocol/sessionLifecycle.integrationTest.ts | Tracks/cleans secondary clients; replaces sleeps with protocol barriers; awaits server shutdown. |
| src/vs/platform/agentHost/test/node/protocol/sessionFeatures.integrationTest.ts | Switches suite teardown to await stopServer with extended timeout. |
| src/vs/platform/agentHost/test/node/protocol/sessionDiffs.integrationTest.ts | Switches suite teardown to await stopServer with extended timeout. |
| src/vs/platform/agentHost/test/node/protocol/sessionConfig.integrationTest.ts | Replaces bespoke stdin-close shutdown with centralized stopServer. |
| src/vs/platform/agentHost/test/node/protocol/resourceOperations.integrationTest.ts | Adds retry-backed temp dir cleanup (Windows-friendly) and secondary client cleanup; awaits server shutdown. |
| src/vs/platform/agentHost/test/node/protocol/otlpLogs.integrationTest.ts | Updates timeouts and suite teardown to await stopServer. |
| src/vs/platform/agentHost/test/node/protocol/networkDiagnostics.integrationTest.ts | Awaits target close and server shutdown with extended timeout. |
| src/vs/platform/agentHost/test/node/protocol/multiClient.integrationTest.ts | Tracks/cleans secondary clients; replaces sleeps with protocol barriers; awaits server shutdown. |
| src/vs/platform/agentHost/test/node/protocol/handshake.integrationTest.ts | Improves raw client cleanup with try/finally; updates timeouts and server teardown. |
| src/vs/platform/agentHost/test/node/protocol/clientTools.integrationTest.ts | Switches suite teardown to await stopServer with extended timeout. |
| src/vs/platform/agentHost/test/node/protocol/agentHostServer.integrationTest.ts | Switches suite teardown to await stopServer with extended timeout. |
| src/vs/platform/agentHost/test/node/e2e/harness/agentHostE2ETestHarness.ts | Removes local shutdown helper and reuses shared stopServer. |
Review details
Comments suppressed due to low confidence (1)
src/vs/platform/agentHost/test/node/serverIntegrationTestHelpers.ts:1
- In the catch block,
reject(error)can reject with a non-Errorvalue (unknown), while the rest of this helper (andIPendingCall.reject) assumesError. To keep error handling consistent and predictable across tests, coerceerrorinto anErrorinstance before rejecting (e.g.,error instanceof Error ? error : new Error(String(error))).
/*---------------------------------------------------------------------------------------------
- Files reviewed: 15/15 changed files
- Comments generated: 2
- Review effort level: Low
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
marked this pull request as ready for review
July 25, 2026 17:14
roblourens
enabled auto-merge (squash)
July 25, 2026 17:15
rzhao271
approved these changes
Jul 25, 2026
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.
Hardens the Agent Host E2E and protocol integration tests following the failures reported in this PR comment.
Changes
Validation
npm run typecheck-clientnpm run precommit(Written by Copilot)