Skip to content

Fix double update issue on Windows#292746

Merged
dmitrivMS merged 23 commits intomainfrom
dev/dmitriv/windows-double-update
Feb 10, 2026
Merged

Fix double update issue on Windows#292746
dmitrivMS merged 23 commits intomainfrom
dev/dmitriv/windows-double-update

Conversation

@dmitrivMS
Copy link
Contributor

@dmitrivMS dmitrivMS commented Feb 4, 2026

Fixes #268531

@dmitrivMS dmitrivMS self-assigned this Feb 4, 2026
@dmitrivMS dmitrivMS added this to the February 2026 milestone Feb 4, 2026
@dmitrivMS dmitrivMS added install-update VS Code installation and upgrade system issues windows VS Code on Windows issues labels Feb 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This change adjusts the Windows update feed construction so that, when a specific pending commit is being overwritten, the update check can be targeted at that pending commit instead of always using the currently installed commit. This supports the overwrite/update machinery needed to avoid scenarios where a user effectively has to restart twice to land on the latest Insiders build.

Changes:

  • Extend Win32UpdateService.doCheckForUpdates to accept an optional pendingCommit parameter.
  • Use pendingCommit ?? this.productService.commit! when building the Windows update feed URL so that, if a pending update commit is known, the server is queried as if that pending commit were the current version.

@dmitrivMS dmitrivMS marked this pull request as draft February 4, 2026 09:19
@dmitrivMS dmitrivMS requested a review from deepak1556 February 4, 2026 09:34
@dmitrivMS dmitrivMS marked this pull request as ready for review February 5, 2026 18:45
@dmitrivMS dmitrivMS requested a review from Copilot February 5, 2026 19:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

src/vs/platform/update/electron-main/updateService.win32.ts:272

  • When restoring the Ready state after an Overwriting check fails, the explicit parameter passed to State.Ready should be the original explicit value from when the update was first Ready, not the explicit parameter from the current doCheckForUpdates call. The current explicit parameter represents whether the overwrite check was explicit, not whether the original update check was explicit. This should use this.state.explicit to preserve the original state.
					this.setState(State.Ready(this.state.update, explicit, false));

src/vs/platform/update/electron-main/updateService.win32.ts:272

  • When restoring the Ready state after an Overwriting check fails, the instance variable this._overwrite should be reset to false to match the overwrite flag in the state. Without this, subsequent state transitions may incorrectly use this._overwrite = true even though we're no longer in an overwrite scenario.
				// If we were checking for an overwrite update and it failed,
				// restore the Ready state with the pending update
				if (this.state.type === StateType.Overwriting) {
					this.setState(State.Ready(this.state.update, explicit, false));

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/vs/platform/update/electron-main/updateService.win32.ts:381

  • The optional chaining this.availableUpdate?.updateProcess?.once('exit', ...) on line 380 could resolve to undefined, causing the Promise.race to wait indefinitely. This could happen if this.availableUpdate or this.availableUpdate.updateProcess becomes undefined between line 377 (where pid is captured) and line 380. While unlikely due to the synchronous execution, if the method is called concurrently or if there's a race with another part of the code clearing availableUpdate, this could cause the timeout to always be hit.

A safer approach would be to capture the updateProcess reference at the start of the method (alongside availableUpdate), ensuring the same object is used throughout the cancellation logic.

					new Promise<boolean>(resolve => this.availableUpdate?.updateProcess?.once('exit', () => resolve(true))),
					timeout(30 * 1000).then(() => false)

@dmitrivMS dmitrivMS requested a review from deepak1556 February 9, 2026 15:20
@dmitrivMS dmitrivMS enabled auto-merge (squash) February 10, 2026 09:58
@dmitrivMS dmitrivMS requested a review from deepak1556 February 10, 2026 12:11
Copy link
Collaborator

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@dmitrivMS dmitrivMS merged commit e60eb8c into main Feb 10, 2026
18 checks passed
@dmitrivMS dmitrivMS deleted the dev/dmitriv/windows-double-update branch February 10, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

install-update VS Code installation and upgrade system issues windows VS Code on Windows issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: VS Code Insiders requires two restarts to update, if an update is already pending and another is available

3 participants