Skip to content

build: avoid per-section Electron re-download in PR test runs#323341

Merged
alexdima merged 1 commit into
mainfrom
agents/investigate-vscode-action-failure-ca00b9aa
Jun 29, 2026
Merged

build: avoid per-section Electron re-download in PR test runs#323341
alexdima merged 1 commit into
mainfrom
agents/investigate-vscode-action-failure-ca00b9aa

Conversation

@alexdima

Copy link
Copy Markdown
Member

What

Stops the GitHub Actions PR test workflows from deleting and re-downloading .build/electron on every test section, which intermittently fails the Windows / Remote job with the bare The 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.batbuild/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 rimraf-ed and re-extracted .build/electron each time.

In the failing run (job 83783207946), the ### TypeScript tests section 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 produced The system cannot find the path specified. (Win32 ERROR_PATH_NOT_FOUND), failing the whole job. The two prior sections that ran the identical command moments earlier had succeeded, and Linux/Remote + macOS/Remote passed — the race is Windows-specific.

The dedicated workflow steps already prepare everything preLaunch would 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

  • CI fix: set VSCODE_SKIP_PRELAUNCH=1 on the unit/integration/remote test steps of the win32, linux and darwin PR workflows, matching what Azure Pipelines already does.
  • Defense in depth: make getElectron() version-aware — skip the destructive re-download when the installed Electron already matches the expected electronVersion, 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).
  • Observability: scripts/code.bat now fails fast with a clear message when preLaunch.ts fails, instead of falling through to launch a missing executable (which is what turned the real failure into a contextless "path not specified" message).
  • Resilience: util.rimraf now retries on EBUSY/EPERM (the Windows file-lock error codes), not just ENOTEMPTY.

Notes for reviewers

  • The version-aware guard reads the version file inside .build/electron and compares it to electronVersion from build/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.
  • Validated with the build typecheck (build && npm run typecheck) and the pre-commit hygiene hook. Full compile/integration validation is left to CI.

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>
Copilot AI review requested due to automatic review settings June 28, 2026 12:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=1 for key unit/integration/remote test steps in PR workflows to avoid redundant per-section prelaunch work.
  • Make preLaunch skip re-downloading Electron when the currently installed Electron matches the expected version.
  • Improve robustness and diagnostics: retry rimraf on common Windows lock errors, and make scripts/code.bat fail 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

Comment thread build/lib/preLaunch.ts
@alexdima alexdima marked this pull request as ready for review June 29, 2026 08:34
@alexdima alexdima enabled auto-merge (squash) June 29, 2026 08:34
@alexdima alexdima merged commit 884913d into main Jun 29, 2026
30 checks passed
@alexdima alexdima deleted the agents/investigate-vscode-action-failure-ca00b9aa branch June 29, 2026 08:44
@vs-code-engineering vs-code-engineering Bot added this to the 1.128.0 milestone Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants