Skip to content

Commit fb40fed

Browse files
authored
ChatRequest.tools should only include tools that are in the tool picker (#247491)
Otherwise it includes tools that aren't supposed to be enabled for agent mode
1 parent 5bc8b80 commit fb40fed

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/vs/workbench/api/common/extHostChatAgents2.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,9 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS
567567
}
568568
const result = new Map<string, boolean>();
569569
for (const tool of this._tools.getTools(extension)) {
570-
result.set(tool.name, request.userSelectedTools2[tool.name] ?? false);
570+
if (typeof request.userSelectedTools2[tool.name] === 'boolean') {
571+
result.set(tool.name, request.userSelectedTools2[tool.name]);
572+
}
571573
}
572574
return result;
573575
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ export class ChatSelectedTools extends Disposable {
142142
const result = new Map<IToolData, boolean>();
143143
const enabledTools = new Set(this.tools.get().map(t => t.id));
144144
for (const tool of this._allTools.get()) {
145-
result.set(tool, enabledTools.has(tool.id));
145+
if (tool.supportsToolPicker) {
146+
result.set(tool, enabledTools.has(tool.id));
147+
}
146148
}
147149
return result;
148150
}

0 commit comments

Comments
 (0)