test: reduce flakiness in Copilot Chat sanity tests#319695
Merged
Merged
Conversation
The Copilot Chat sanity tests in extensions/copilot hit the live model endpoint, so they can fail for transient upstream reasons such as empty responses, intermittent rate limiting, or model errors that do not represent an actual regression. - Bump mocha retries for sanity tests from 1 to 2 (3 attempts total) so a single transient failure no longer fails the build. - Add a shared describeOutcome() helper that dumps the response stream items and any errorDetails into assertion messages, so the next failure (after retries are exhausted) carries enough context to distinguish a flake from a real bug. - Reuse the helper in the existing agent-mode timeout diagnostics instead of duplicating the dump logic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Giuspepe
approved these changes
Jun 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces flakiness in the Copilot Chat sanity test suite (which hits live model endpoints) by increasing retry budget and improving failure diagnostics so CI logs can distinguish transient upstream failures from real regressions.
Changes:
- Increase Mocha retries for sanity runs from 1 to 2 (3 total attempts).
- Add a shared
describeOutcome(stream, result?)helper and use it in assertion messages and agent-mode timeout errors to include stream-part breakdown,currentProgress,responseId, anderrorDetails.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/test/vscode-node/sanity.sanity-test.ts | Adds/uses describeOutcome to enrich assertion and timeout diagnostics for flaky upstream failures. |
| extensions/copilot/.vscode-test.mjs | Increases Mocha retries for sanity tests to allow additional attempts against transient endpoint issues. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 5
This was referenced Jun 3, 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.
The Copilot Chat sanity tests in
extensions/copilothit the live model endpoint, so they can fail for transient upstream reasons (empty response, intermittent rate limiting, model errors) that do not represent an actual regression.Most recent example: build 444205 failed at macOS (ARM64) attempt 1, where
Slash Commands work properlyhit:The
/explainrequest returned, butcurrentProgress(which only accumulatesMarkdownPart/AnchorParttext) was empty. Withretries: 1already configured, both attempts failed and we had zero diagnostics to tell a flake from a real bug.Changes
extensions/copilot/.vscode-test.mjs— bump mocharetriesfor sanity tests from1to2(3 attempts total). The suite-level timeout is 1 min per test, and the pipeline job has a 30 min timeout, so this is well within budget.extensions/copilot/src/extension/test/vscode-node/sanity.sanity-test.ts— add a shareddescribeOutcome(stream, result?)helper used in everyassert.ok(currentProgress, …)call site. On failure the assertion message now includes:currentProgressvalue,result.metadata.responseIdfor correlating with server-side logs,result.errorDetailsif the chat handler reported an upstream error (rate limit, content filter, server error — these are returned via the result, not thrown).Also reuses the helper in the existing agent-mode timeout diagnostics instead of duplicating the dump logic.
Verification
tsgo --noEmit --project tsconfig.jsoninextensions/copilotpasses.cc @lramos15 @roblourens
Related: #312131, #313303, #317255