don't block chat when collecting instructions fail (#306161)

This commit is contained in:
Martin Aeschlimann
2026-03-29 23:47:37 +02:00
committed by GitHub
parent ba1bdcd30b
commit d7ebb2cc7d

View File

@@ -2819,13 +2819,16 @@ export class ChatWidget extends Disposable implements IChatWidget {
this.logService.debug(`ChatWidget#_autoAttachInstructions: skipped, autoAttachReferences is disabled`);
return;
}
this.logService.debug(`ChatWidget#_autoAttachInstructions: prompt files are enabled`);
const enabledTools = this.input.currentModeKind === ChatModeKind.Agent ? this.input.selectedToolsModel.userSelectedTools.get() : undefined;
const enabledSubAgents = this.input.currentModeKind === ChatModeKind.Agent ? this.input.currentModeObs.get().agents?.get() : undefined;
const sessionResource = this._viewModel?.model.sessionResource;
const computer = this.instantiationService.createInstance(ComputeAutomaticInstructions, this.input.currentModeKind, enabledTools, enabledSubAgents, sessionResource);
await computer.collect(attachedContext, CancellationToken.None);
try {
this.logService.debug(`ChatWidget#_autoAttachInstructions: prompt files are enabled`);
const enabledTools = this.input.currentModeKind === ChatModeKind.Agent ? this.input.selectedToolsModel.userSelectedTools.get() : undefined;
const enabledSubAgents = this.input.currentModeKind === ChatModeKind.Agent ? this.input.currentModeObs.get().agents?.get() : undefined;
const sessionResource = this._viewModel?.model.sessionResource;
const computer = this.instantiationService.createInstance(ComputeAutomaticInstructions, this.input.currentModeKind, enabledTools, enabledSubAgents, sessionResource);
await computer.collect(attachedContext, CancellationToken.None);
} catch (err) {
this.logService.error(`ChatWidget#_autoAttachInstructions: failed to compute automatic instructions`, err);
}
}
delegateScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent): void {