build: avoid per-section Electron re-download in PR test runs#323341
Merged
Conversation
The GitHub Actions PR test workflows run integration/smoke tests out of sources, so each test section launches scripts/code.bat, which runs build/lib/preLaunch.ts. Unlike the Azure Pipelines product builds, the GitHub workflows did not set VSCODE_SKIP_PRELAUNCH, so preLaunch ran on every section and getElectron() unconditionally deleted and re-downloaded .build/electron each time. On Windows this races with file locks held by the just-exited Electron process and intermittently fails the whole job with the bare 'The system cannot find the path specified.' error. - Set VSCODE_SKIP_PRELAUNCH=1 on the unit/integration/remote test steps of the win32, linux and darwin PR workflows, matching Azure Pipelines (the workflows already prepare node_modules, out, built-in extensions and Electron in dedicated steps before the tests run). - Make getElectron() version-aware: skip the destructive re-download when the installed Electron already matches the expected version, falling back to a download on any detection failure. - Make scripts/code.bat fail fast with a clear message when preLaunch.ts fails instead of falling through to launch a missing executable. - Retry rimraf on EBUSY/EPERM (Windows file-lock codes), not just ENOTEMPTY. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces flakiness in GitHub Actions PR test workflows by preventing repeated, destructive Electron refreshes during multi-section test runs (especially on Windows), and improves failure clarity when prelaunch setup fails.
Changes:
- Set
VSCODE_SKIP_PRELAUNCH=1for key unit/integration/remote test steps in PR workflows to avoid redundant per-section prelaunch work. - Make
preLaunchskip re-downloading Electron when the currently installed Electron matches the expected version. - Improve robustness and diagnostics: retry
rimrafon common Windows lock errors, and makescripts/code.batfail fast with a clearer error when prelaunch fails.
Show a summary per file
| File | Description |
|---|---|
| scripts/code.bat | Fail-fast behavior if build/lib/preLaunch.ts fails, avoiding confusing “missing path” launches. |
| build/lib/util.ts | Adds retry on EBUSY/EPERM to make deletes more resilient on Windows. |
| build/lib/preLaunch.ts | Skips Electron refresh if expected version is already installed (defense-in-depth). |
| .github/workflows/pr-win32-test.yml | Sets VSCODE_SKIP_PRELAUNCH on relevant PR test steps to avoid repeated prelaunch. |
| .github/workflows/pr-linux-test.yml | Sets VSCODE_SKIP_PRELAUNCH on relevant PR test steps to avoid repeated prelaunch. |
| .github/workflows/pr-darwin-test.yml | Sets VSCODE_SKIP_PRELAUNCH on relevant PR test steps to avoid repeated prelaunch. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Low
lszomoru
approved these changes
Jun 29, 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.
What
Stops the GitHub Actions PR test workflows from deleting and re-downloading
.build/electronon every test section, which intermittently fails the Windows / Remote job with the bareThe system cannot find the path specified.error.Why
The PR test workflows run integration/smoke tests out of sources, so each test section launches
scripts/code.bat→build/lib/preLaunch.ts. Unlike the Azure Pipelines product builds, the GitHub workflows did not setVSCODE_SKIP_PRELAUNCH, sopreLaunchran on every section andgetElectron()unconditionallyrimraf-ed and re-extracted.build/electroneach time.In the failing run (job 83783207946), the
### TypeScript testssection ran this re-download ~0.45s after the previous section's Electron process exited. On Windows the just-terminated executable's files are still locked, so the delete-then-re-extract churn raced the OS and producedThe system cannot find the path specified.(Win32ERROR_PATH_NOT_FOUND), failing the whole job. The two prior sections that ran the identical command moments earlier had succeeded, andLinux/Remote+macOS/Remotepassed — the race is Windows-specific.The dedicated workflow steps already prepare everything
preLaunchwould do (Install dependencies,Download built-in extensions,Transpile client and extensions,Download Electron and Playwright— the latter with a 3× retry), so the per-section prelaunch is pure redundancy and a flake source.Changes
VSCODE_SKIP_PRELAUNCH=1on the unit/integration/remote test steps of thewin32,linuxanddarwinPR workflows, matching what Azure Pipelines already does.getElectron()version-aware — skip the destructive re-download when the installed Electron already matches the expectedelectronVersion, falling back to a download on any detection failure (covers paths that don't set the env var, e.g. smoke/browser and local dev).scripts/code.batnow fails fast with a clear message whenpreLaunch.tsfails, instead of falling through to launch a missing executable (which is what turned the real failure into a contextless "path not specified" message).util.rimrafnow retries onEBUSY/EPERM(the Windows file-lock error codes), not justENOTEMPTY.Notes for reviewers
versionfile inside.build/electronand compares it toelectronVersionfrombuild/lib/electron.ts; any failure (missing file, unexpected format, import error) falls back to the original always-download behavior, so it is strictly non-regressive.build && npm run typecheck) and the pre-commit hygiene hook. Full compile/integration validation is left to CI.