-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Open
Description
Bug
The editTools field in BYOK model configuration (e.g., editTools: ['apply-patch']) is accepted by the schema but has no effect on which edit tools are exposed to the model.
Root Cause
The plumbing between BYOKModelCapabilities.editTools and IChatEndpoint.supportedEditTools is broken:
BYOKModelCapabilities(invscode-copilot-chat: src/extension/byok/common/byokProvider.ts) defineseditTools?: EndpointEditToolName[]resolveModelInfo()(same file) converts capabilities toIChatModelInformationbut dropseditTools— it's not mapped to any fieldExtensionContributedChatEndpoint(invscode-copilot-chat: src/platform/endpoint/vscode-node/extChatEndpoint.ts) reads edit tools fromlanguageModel.capabilities.editToolsHint— a VS Code API capabilityEditToolLearningService.getPreferredEndpointEditTool()checksendpoint.supportedEditToolsfirst, but it's always empty for BYOK models, so it falls through to hardcoded name matching or the learning state machine
Expected Behavior
Setting editTools: ['apply-patch'] in a BYOK model config should cause the model to use applyPatch instead of the default replace_string_in_file.
Actual Behavior
editTools is silently ignored. The edit tool is determined by:
- Hardcoded model name matching (
_getHardcodedPreferences— names containing 'gpt'/'openai' → applyPatch, 'sonnet' → replaceString) - The learning state machine (defaults to replaceString for unknown models)
Suggested Fix
Either:
- Map
BYOKModelCapabilities.editToolsthrough tolanguageModel.capabilities.editToolsHintduring BYOK model registration soExtensionContributedChatEndpointpicks it up - Or have
resolveModelInfo()includeeditToolsin a field thatEditToolLearningServicecan read from the endpoint
Reproduction
customModels:
customoai:
my-model:
name: 'My Model'
url: 'http://localhost:3234/v1/responses'
toolCalling: true
vision: false
maxInputTokens: 200000
maxOutputTokens: 32768
requiresAPIKey: true
editTools: ['apply-patch'] # <-- this has no effectThe model will still get replace_string_in_file / insert_edit_into_file instead of applyPatch.
Workaround
Name the model to include 'gpt' or 'openai' to trigger the hardcoded preference in _getHardcodedPreferences().
References (in microsoft/vscode-copilot-chat)
src/extension/byok/common/byokProvider.ts—BYOKModelCapabilities.editToolsandresolveModelInfo()src/platform/endpoint/vscode-node/extChatEndpoint.ts—supportedEditToolsfromeditToolsHintsrc/extension/tools/common/editToolLearningService.ts—getPreferredEndpointEditTool()and_getHardcodedPreferences()
Reactions are currently unavailable