fix: handle GitHub Copilot gpt-4.1 model ID response bug #6106
+184
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes issue #6105 where GitHub Copilot's gpt-4.1 model returns only the model ID ("copilot/gpt-4.1") instead of generating actual AI responses.
Problem
When using the VS Code Language Model API with GitHub Copilot's gpt-4.1 model, users were seeing "copilot/gpt-4.1" as the response instead of actual AI-generated content. This appears to be a bug in either the VS Code Language Model API or the GitHub Copilot extension.
Solution
Testing
Notes
This is a workaround for what appears to be an upstream bug in the VS Code Language Model API or GitHub Copilot extension. The fix ensures users get a clear error message instead of seeing the model ID as the response.
Fixes #6105
Important
Fixes GitHub Copilot gpt-4.1 model bug by skipping model ID responses and throwing errors for invalid content in
vscode-lm.ts
.vscode-lm.ts
, added logic to detect and skip chunks containing only the model ID for GitHub Copilot's gpt-4.1 model.vscode-lm.spec.ts
to verify handling of model ID responses, including variations in model ID patterns.vscode-lm.ts
to track responses and identify when model ID is returned as content.This description was created by
for 9c8b9e4. You can customize this summary. It will automatically update as commits are pushed.