Skip to content

Commit d7ebb2c

Browse files
authored
don't block chat when collecting instructions fail (#306161)
1 parent ba1bdcd commit d7ebb2c

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,13 +2819,16 @@ export class ChatWidget extends Disposable implements IChatWidget {
28192819
this.logService.debug(`ChatWidget#_autoAttachInstructions: skipped, autoAttachReferences is disabled`);
28202820
return;
28212821
}
2822-
2823-
this.logService.debug(`ChatWidget#_autoAttachInstructions: prompt files are enabled`);
2824-
const enabledTools = this.input.currentModeKind === ChatModeKind.Agent ? this.input.selectedToolsModel.userSelectedTools.get() : undefined;
2825-
const enabledSubAgents = this.input.currentModeKind === ChatModeKind.Agent ? this.input.currentModeObs.get().agents?.get() : undefined;
2826-
const sessionResource = this._viewModel?.model.sessionResource;
2827-
const computer = this.instantiationService.createInstance(ComputeAutomaticInstructions, this.input.currentModeKind, enabledTools, enabledSubAgents, sessionResource);
2828-
await computer.collect(attachedContext, CancellationToken.None);
2822+
try {
2823+
this.logService.debug(`ChatWidget#_autoAttachInstructions: prompt files are enabled`);
2824+
const enabledTools = this.input.currentModeKind === ChatModeKind.Agent ? this.input.selectedToolsModel.userSelectedTools.get() : undefined;
2825+
const enabledSubAgents = this.input.currentModeKind === ChatModeKind.Agent ? this.input.currentModeObs.get().agents?.get() : undefined;
2826+
const sessionResource = this._viewModel?.model.sessionResource;
2827+
const computer = this.instantiationService.createInstance(ComputeAutomaticInstructions, this.input.currentModeKind, enabledTools, enabledSubAgents, sessionResource);
2828+
await computer.collect(attachedContext, CancellationToken.None);
2829+
} catch (err) {
2830+
this.logService.error(`ChatWidget#_autoAttachInstructions: failed to compute automatic instructions`, err);
2831+
}
28292832
}
28302833

28312834
delegateScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent): void {

0 commit comments

Comments
 (0)