Skip to content

Commit e42d3b2

Browse files
authored
chat - go back to installing only after sign-in has finished (microsoft#254960)
1 parent 4b8eae3 commit e42d3b2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/vs/workbench/contrib/chat/browser/chatSetup.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,13 +1248,13 @@ class ChatSetupController extends Disposable {
12481248
let session: AuthenticationSession | undefined;
12491249
let entitlement: ChatEntitlement | undefined;
12501250

1251-
const installation = this.doInstall();
1252-
12531251
// Entitlement Unknown or `forceSignIn`: we need to sign-in user
12541252
if (this.context.state.entitlement === ChatEntitlement.Unknown || options.forceSignIn) {
12551253
this.setStep(ChatSetupStep.SigningIn);
12561254
const result = await this.signIn({ useAlternateProvider: options.useAlternateProvider });
12571255
if (!result.session) {
1256+
this.doInstall(); // still install the extension in the background to remind the user to sign-in eventually
1257+
12581258
const provider = options.useAlternateProvider ? defaultChat.alternativeProviderId : options.useEnterpriseProvider ? defaultChat.enterpriseProviderId : defaultChat.providerId;
12591259
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
12601260
return undefined; // treat as cancelled because signing in already triggers an error dialog
@@ -1266,7 +1266,7 @@ class ChatSetupController extends Disposable {
12661266

12671267
// Await Install
12681268
this.setStep(ChatSetupStep.Installing);
1269-
success = await this.install(session, entitlement ?? this.context.state.entitlement, providerId, watch, installation, options);
1269+
success = await this.install(session, entitlement ?? this.context.state.entitlement, providerId, watch, options);
12701270
} finally {
12711271
this.setStep(ChatSetupStep.Initial);
12721272
this.context.resume();
@@ -1300,7 +1300,7 @@ class ChatSetupController extends Disposable {
13001300
return { session, entitlement: entitlements?.entitlement };
13011301
}
13021302

1303-
private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, installation: Promise<void>, options: { useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise<ChatSetupResultValue> {
1303+
private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, options: { useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise<ChatSetupResultValue> {
13041304
const wasRunning = this.context.state.installed && !this.context.state.disabled;
13051305
let signUpResult: boolean | { errorCode: number } | undefined = undefined;
13061306

@@ -1333,7 +1333,7 @@ class ChatSetupController extends Disposable {
13331333
}
13341334
}
13351335

1336-
await this.doInstallWithRetry(installation);
1336+
await this.doInstallWithRetry();
13371337
} catch (error) {
13381338
this.logService.error(`[chat setup] install: error ${error}`);
13391339
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: isCancellationError(error) ? 'cancelled' : 'failedInstall', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
@@ -1351,10 +1351,10 @@ class ChatSetupController extends Disposable {
13511351
return true;
13521352
}
13531353

1354-
private async doInstallWithRetry(installation: Promise<void>): Promise<void> {
1354+
private async doInstallWithRetry(): Promise<void> {
13551355
let error: Error | undefined;
13561356
try {
1357-
await installation;
1357+
await this.doInstall();
13581358
} catch (e) {
13591359
this.logService.error(`[chat setup] install: error ${error}`);
13601360
error = e;
@@ -1370,7 +1370,7 @@ class ChatSetupController extends Disposable {
13701370
});
13711371

13721372
if (confirmed) {
1373-
return this.doInstallWithRetry(this.doInstall());
1373+
return this.doInstallWithRetry();
13741374
}
13751375
}
13761376

0 commit comments

Comments
 (0)