Skip to content

Fix remote extension init: await installs and match the synced extension - #340771

Open
Minho Yoo (irontaek) wants to merge 2 commits into
microsoft:mainfrom
irontaek:fix/remote-extensions-init-await-and-match
Open

Minho Yoo (irontaek) wants to merge 2 commits into
microsoft:mainfrom
irontaek:fix/remote-extensions-init-await-and-match

Conversation

@irontaek

@irontaek Minho Yoo (irontaek) commented Oct 9, 2026 •

Copy link
Copy Markdown

Remote extension initialization can apply the first synced extension’s pre-release choice to every extension being installed. This PR matches each gallery extension to its own synced entry. It also returns the installation promises in InstallRemoteExtensionsContribution so Promise.allSettled waits for them.

Changes and reproduction

  • Per-extension release channel: Initialize a new remote from Settings Sync data containing two workspace extensions with opposite preRelease values. Before this change, both installations receive the first synced entry’s flag. Afterward, each receives its own flag. Regression tests cover both flag orders and reversed gallery result order.
  • Installation promises: Set remote.defaultExtensionsIfInstalledLocally to a locally installed extension that is absent remotely and keep its installInServer promise pending. Previously, installExtensionsIfInstalledLocallyInRemote resolved before the installation settled. It now waits. The constructor does not await this method, so this is not evidence that the change fixes a user-visible startup race.

Validation

Added remoteExtensionsInit.test.ts, exercising the actual contribution and initializer with stubbed remote services. The initializer is exported for these tests.

VSCODE_SKIP_PRELAUNCH=1 ./scripts/test.sh --run src/vs/workbench/contrib/extensions/test/electron-browser/remoteExtensionsInit.test.ts

On macOS arm64, with only the two original fixes reverted, all three new tests fail. With the fixes restored, all three pass (four total including the runner’s clean-state check). Targeted ESLint passes.

This is service-boundary regression coverage, not SSH/container end-to-end validation. Normal dependency installation failed in node-gyp because of the local Xcode toolchain; dependencies were installed with scripts disabled. The Electron runner emitted a missing vscode_fs.node warning in both runs. An isolated type check reports dependency Timeout/TimeoutHandle conflicts, so a clean full build/type check is not claimed.

No linked issue; the changes were found while reading the file.

Original implementation session: https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq

- RemoteExtensionsInitializerContribution passed Promise.allSettled a map
  callback with a block body and no return, so it settled immediately
  instead of waiting for installInServer.
- RemoteExtensionsInitializer looked up the synced extension with
  remoteExtensions.find(e => areSameExtensions(e.identifier, e.identifier)).
  The callback parameter shadows the gallery extension e, so it compared
  each entry with itself and always took the first synced extension's
  preRelease flag.

Claude-Session: https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq
Copilot AI balanced review requested due to automatic review settings October 9, 2026 17:53

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.

🟢 Approval recommended

Both focused changes correctly address the identified promise and extension-matching defects.

0 open findings

What changed in this PR

Fixes two remote-extension initialization bugs.

Changes:

  • Awaits remote extension installation promises.
  • Matches each gallery extension to its corresponding synced extension.
File Description
src/​vs/​workbench/​contrib/​extensions/​electron-browser/​remoteExtensionsInit.ts Fixes install synchronization and pre-release selection.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sandy081

Copy link
Copy Markdown
Member

Thanks for the contribution. The changes look plausible from code inspection, but it is difficult for us to take this change without a concrete user-facing bug or reproduction and validation of the fix. This touches remote extension initialization and installation behavior, where a seemingly small change can cause regressions, and the PR has not been tested in a remote setup.

Could you please provide a concrete scenario demonstrating the current failure and expected behavior, and add a focused regression test or document manual remote validation covering both changes?

@irontaek

Minho Yoo (irontaek) commented Oct 24, 2026 •

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@irontaek

Copy link
Copy Markdown
Author

Sandeep Somavarapu (@sandy081) thanks for the review, and sorry for not replying here earlier. I pushed 4d104f4 and updated the description on Oct 24 but didn't follow up in the thread.

Concrete scenario (pre-release choice): A user syncs two workspace extensions, one installed as pre-release and one as stable, then opens a fresh remote. RemoteExtensionsInitializer looks up the synced entry with e.identifier compared to itself, so every lookup returns the first synced extension. Both extensions are then installed on the remote with the first one's preRelease flag, so one of them ends up on the wrong release channel.

Regression coverage: remoteExtensionsInit.test.ts runs the real initializer with stubbed services, covers both flag orders, and returns the gallery results in reverse order. With only the one-line fix reverted, those tests fail. With it restored, they pass.

What I have not done: I have not validated this end to end on an SSH, container or tunnel remote, and the description says so.

The other change, returning the installInServer promises, isn't user-visible because the constructor doesn't await that method. If it's easier to review, I'm happy to drop it and keep this PR to the one-line pre-release fix plus its tests.

This branch has not been deployed

No deployments
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.

4 participants