Skip to content

Commit 4e7d416

Browse files
authored
fix(chatsessions): handle incorrect option groups being sent in request handler (#309982)
1 parent 06c64c2 commit 4e7d416

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
10361036
}
10371037

10381038
let session: IChatSession;
1039-
const newSessionOptionGroups = await this.getNewChatSessionInputState(resolvedType);
1039+
const newSessionOptionGroups = isUntitledChatSession(sessionResource) ? await this.getNewChatSessionInputState(resolvedType) : undefined;
10401040
if (isUntitledChatSession(sessionResource) && newSessionOptionGroups) {
10411041
const options: ChatSessionOptionsMap = new Map();
10421042
for (const group of newSessionOptionGroups) {

src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,14 +878,15 @@ export class ChatService extends Disposable implements IChatService {
878878

879879
const newItem = await this.chatSessionService.createNewChatSessionItem(getChatSessionType(sessionResource), { prompt: requestText, command: commandPart?.text, initialSessionOptions }, CancellationToken.None);
880880
if (newItem) {
881+
// Register alias so session-option lookups work with the new resource
882+
this.chatSessionService.registerSessionResourceAlias(sessionResource, newItem.resource);
883+
881884
tempRef = await this.loadRemoteSession(newItem.resource, model.initialLocation, CancellationToken.None);
882885
model = tempRef?.object as ChatModel | undefined;
883886
if (!model) {
884887
throw new Error(`Failed to load session for resource: ${newItem.resource}`);
885888
}
886889

887-
// Register alias so session-option lookups work with the new resource
888-
this.chatSessionService.registerSessionResourceAlias(sessionResource, newItem.resource);
889890

890891
// Update the new model's contributed session with initialSessionOptions
891892
// so that the agent receives them when invoked.

0 commit comments

Comments
 (0)