Skip to content

Commit e24d07f

Browse files
authored
Chat: sign-out/sign-in flow very broken (fix #276246) (#276278)
1 parent 7bcad78 commit e24d07f

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

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

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -332,24 +332,16 @@ class SetupAgent extends Disposable implements IChatAgentImplementation {
332332
try {
333333
const ready = await Promise.race([
334334
timeout(this.environmentService.remoteAuthority ? 60000 /* increase for remote scenarios */ : 20000).then(() => 'timedout'),
335-
this.whenDefaultAgentFailed(chatService).then(() => 'error'),
335+
this.whenDefaultAgentActivated(chatService),
336336
Promise.allSettled([whenLanguageModelReady, whenAgentReady, whenToolsModelReady])
337337
]);
338338

339-
if (ready === 'error' || ready === 'timedout') {
339+
if (ready === 'timedout') {
340340
let warningMessage: string;
341-
if (ready === 'timedout') {
342-
if (this.chatEntitlementService.anonymous) {
343-
warningMessage = localize('chatTookLongWarningAnonymous', "Chat took too long to get ready. Please ensure that the extension `{0}` is installed and enabled.", defaultChat.chatExtensionId);
344-
} else {
345-
warningMessage = localize('chatTookLongWarning', "Chat took too long to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.", defaultChat.provider.default.name, defaultChat.chatExtensionId);
346-
}
341+
if (this.chatEntitlementService.anonymous) {
342+
warningMessage = localize('chatTookLongWarningAnonymous', "Chat took too long to get ready. Please ensure that the extension `{0}` is installed and enabled.", defaultChat.chatExtensionId);
347343
} else {
348-
if (this.chatEntitlementService.anonymous) {
349-
warningMessage = localize('chatFailedWarningAnonymous', "Chat failed to get ready. Please ensure that the extension `{0}` is installed and enabled.", defaultChat.chatExtensionId);
350-
} else {
351-
warningMessage = localize('chatFailedWarning', "Chat failed to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.", defaultChat.provider.default.name, defaultChat.chatExtensionId);
352-
}
344+
warningMessage = localize('chatTookLongWarning', "Chat took too long to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.", defaultChat.provider.default.name, defaultChat.chatExtensionId);
353345
}
354346

355347
this.logService.warn(warningMessage, {
@@ -439,10 +431,12 @@ class SetupAgent extends Disposable implements IChatAgentImplementation {
439431
}));
440432
}
441433

442-
private async whenDefaultAgentFailed(chatService: IChatService): Promise<void> {
443-
return new Promise<void>(resolve => {
444-
chatService.activateDefaultAgent(this.location).catch(() => resolve());
445-
});
434+
private async whenDefaultAgentActivated(chatService: IChatService): Promise<void> {
435+
try {
436+
await chatService.activateDefaultAgent(this.location);
437+
} catch (error) {
438+
this.logService.error(error);
439+
}
446440
}
447441

448442
private async doInvokeWithSetup(request: IChatAgentRequest, progress: (part: IChatProgress) => void, chatService: IChatService, languageModelsService: ILanguageModelsService, chatWidgetService: IChatWidgetService, chatAgentService: IChatAgentService, languageModelToolsService: ILanguageModelToolsService): Promise<IChatAgentResult> {

0 commit comments

Comments
 (0)