Harden Copilot Electron test temp-dir cleanup on Windows#314901
Merged
Conversation
Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/4fc94938-ddf6-47c3-9ad8-342f7156a10f Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/4fc94938-ddf6-47c3-9ad8-342f7156a10f Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix build failure: Electron tests fail with EBUSY
Harden Copilot Electron test temp-dir cleanup on Windows
May 7, 2026
dmitrivMS
requested changes
May 7, 2026
Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/6b8300d2-f7ec-495d-81d5-03363352274a Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Contributor
Author
dmitrivMS
approved these changes
May 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Hardens the Copilot Electron test runner teardown path so transient Windows file locks (e.g., Crashpad artifacts after an extension host crash) don’t cause the overall test run to fail during best-effort cleanup.
Changes:
- Added a
cleanupTestDirectoryhelper that deletes directories usingfs.rmwithforceplus retry options (maxRetries,retryDelay) and logs failures without throwing. - Applied the improved cleanup to both the temporary
--user-data-dirand the temporary workspace folder in the runner’sfinallyblock.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/completions-core/vscode-node/extension/test/runTest.ts | Makes temp-dir cleanup resilient to transient Windows locks by adding retry-enabled, non-fatal teardown for both created temp directories. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
amunger
approved these changes
May 7, 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.
Fixes #314897
Description
Electron tests were intermittently failing after the extension host crashed because Windows still held
Crashpaddump files open during temp-dir teardown, surfacing asEBUSYfromfs.rm. This updates the Copilot Electron test runner cleanup path to tolerate transient file locks instead of failing the run during best-effort cleanup.Problem
runTest.tsremoved the test user-data dir once, without retries.Crashpadartifacts can still be locked briefly, so teardown could fail even after the real test failure had already been handled.Changes
runTest.ts.fs.rm(..., { recursive: true, force: true, maxRetries, retryDelay })so transientEBUSY/EPERMlocks are retried by Node.--user-data-dirExample
Testing
cd extensions/copilot && npm run typechecknode --experimental-strip-types build/hygiene.ts extensions/copilot/src/extension/completions-core/vscode-node/extension/test/runTest.ts