diff --git a/src/vs/workbench/contrib/chat/browser/chatSetup.ts b/src/vs/workbench/contrib/chat/browser/chatSetup.ts index 22d6de21673..517b7cb5c90 100644 --- a/src/vs/workbench/contrib/chat/browser/chatSetup.ts +++ b/src/vs/workbench/contrib/chat/browser/chatSetup.ts @@ -1252,13 +1252,13 @@ class ChatSetupController extends Disposable { let session: AuthenticationSession | undefined; let entitlement: ChatEntitlement | undefined; - const installation = this.doInstall(); - // Entitlement Unknown or `forceSignIn`: we need to sign-in user if (this.context.state.entitlement === ChatEntitlement.Unknown || options.forceSignIn) { this.setStep(ChatSetupStep.SigningIn); const result = await this.signIn({ useAlternateProvider: options.useAlternateProvider }); if (!result.session) { + this.doInstall(); // still install the extension in the background to remind the user to sign-in eventually + const provider = options.useAlternateProvider ? defaultChat.alternativeProviderId : options.useEnterpriseProvider ? defaultChat.enterpriseProviderId : defaultChat.providerName; this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider }); return undefined; // treat as cancelled because signing in already triggers an error dialog @@ -1270,7 +1270,7 @@ class ChatSetupController extends Disposable { // Await Install this.setStep(ChatSetupStep.Installing); - success = await this.install(session, entitlement ?? this.context.state.entitlement, providerId, watch, installation, options); + success = await this.install(session, entitlement ?? this.context.state.entitlement, providerId, watch, options); } finally { this.setStep(ChatSetupStep.Initial); this.context.resume(); @@ -1304,7 +1304,7 @@ class ChatSetupController extends Disposable { return { session, entitlement: entitlements?.entitlement }; } - private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, installation: Promise, options: { useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise { + private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, options: { useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise { const wasRunning = this.context.state.installed && !this.context.state.disabled; let signUpResult: boolean | { errorCode: number } | undefined = undefined; @@ -1337,7 +1337,7 @@ class ChatSetupController extends Disposable { } } - await this.doInstallWithRetry(installation); + await this.doInstallWithRetry(); } catch (error) { this.logService.error(`[chat setup] install: error ${error}`); this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: isCancellationError(error) ? 'cancelled' : 'failedInstall', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider }); @@ -1355,10 +1355,10 @@ class ChatSetupController extends Disposable { return true; } - private async doInstallWithRetry(installation: Promise): Promise { + private async doInstallWithRetry(): Promise { let error: Error | undefined; try { - await installation; + await this.doInstall(); } catch (e) { this.logService.error(`[chat setup] install: error ${error}`); error = e; @@ -1374,7 +1374,7 @@ class ChatSetupController extends Disposable { }); if (confirmed) { - return this.doInstallWithRetry(this.doInstall()); + return this.doInstallWithRetry(); } }