Skip to content

Comments

sessions welcome flow: fix stale session after sign in#297481

Merged
joshspicer merged 1 commit intomainfrom
joshspicer/reload
Feb 24, 2026
Merged

sessions welcome flow: fix stale session after sign in#297481
joshspicer merged 1 commit intomainfrom
joshspicer/reload

Conversation

@joshspicer
Copy link
Member

After the welcome overlay completes (extension installed + user signed in), restart the extension host so the copilot-chat extension picks up the new auth session cleanly. Without this, the extension activates before the auth provider is ready, gets stuck in GitHubLoginFailed, and models never appear.

The overlay stays visible during the restart so the user doesn't see a broken intermediate state. Dismiss is controlled by the contribution via an autorun watching isComplete, not by the overlay itself.

The copilot-chat code is really tangled and I don't see a safe way to fix this in the extension itself during endgame week.

…istration

After the welcome overlay completes (extension installed + user signed in),
restart the extension host so the copilot-chat extension picks up the new
auth session cleanly. Without this, the extension activates before the auth
provider is ready, gets stuck in GitHubLoginFailed, and models never appear.

The overlay stays visible during the restart so the user doesn't see a
broken intermediate state. Dismiss is controlled by the contribution via
an autorun watching isComplete, not by the overlay itself.
Copilot AI review requested due to automatic review settings February 24, 2026 20:16
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 24, 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 pull request fixes a stale session issue in the Agent Sessions welcome flow by restarting the extension host after the user completes setup (extension installed + signed in). Without this restart, the copilot-chat extension activates before the auth provider is ready and gets stuck in a failed state, preventing models from appearing.

Changes:

  • Move dismiss control from overlay to contribution via autorun watching isComplete
  • Restart extension host when welcome flow completes, keeping overlay visible during restart
  • Make dismiss() public on SessionsWelcomeOverlay for external control

Reviewed changes

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

File Description
src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts Add IExtensionService and ILogService dependencies; implement autorun to detect completion and call new restartExtensionHostThenDismiss() method; move storage write from onDidDismiss to autorun
src/vs/sessions/contrib/welcome/browser/sessionsWelcomeOverlay.ts Remove auto-dismiss logic from overlay's autorun (still reads isComplete for reactivity); change dismiss() from private to public
Comments suppressed due to low confidence (2)

src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts:167

  • The async method restartExtensionHostThenDismiss lacks cancellation support. If the overlay is disposed while the extension host is restarting, the method will continue to execute and call overlay.dismiss() on a potentially disposed object. Consider accepting a CancellationToken parameter and checking for cancellation before calling overlay.dismiss(), similar to patterns seen in src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.ts:225-265.
	private async restartExtensionHostThenDismiss(overlay: SessionsWelcomeOverlay): Promise<void> {
		this.logService.info('[sessions welcome] Restarting extension host after welcome completion');
		const stopped = await this.extensionService.stopExtensionHosts(
			localize('sessionsWelcome.restart', "Completing sessions setup")
		);
		if (stopped) {
			await this.extensionService.startExtensionHosts();
		}
		overlay.dismiss();
	}

src/vs/sessions/contrib/welcome/browser/sessionsWelcomeOverlay.ts:139

  • The dismiss() method can be called multiple times (e.g., from restartExtensionHostThenDismiss at line 166), which will schedule multiple timeouts that each call this.dispose(). While this.dispose() is idempotent, multiple calls are unnecessary. Consider adding a guard flag (e.g., private dismissed = false) to ensure dismiss() only executes once, similar to how actionRunning is used in the button click handler.
	dismiss(): void {
		this.overlay.classList.add('sessions-welcome-overlay-dismissed');
		this._onDidDismiss.fire();
		// Allow CSS transition to finish before disposing
		const handle = setTimeout(() => this.dispose(), 200);
		this._register(toDisposable(() => clearTimeout(handle)));
	}

@joshspicer joshspicer merged commit f3dba00 into main Feb 24, 2026
24 checks passed
@joshspicer joshspicer deleted the joshspicer/reload branch February 24, 2026 21:05
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.

2 participants