Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the id field from the model entry type definitions in IChatControlResponse. The change refactors the data structure so that model IDs are stored as keys in the Record rather than as a field within each entry object.
Changes:
- Removed
readonly id: stringfield from the type definitions for bothfreeandpaidmodel entries inIChatControlResponse - Removed validation checks for
typeof entry.id !== 'string'in the processing logic
Comments suppressed due to low confidence (3)
src/vs/workbench/contrib/chat/common/languageModels.ts:1432
- After removing the
idfield from the type definition, this code is accessingentry.idon line 1431, which will be undefined. Since the response format isRecord<string, {...}>where the key is the model ID, you need to useObject.entries()instead ofObject.values()to access both the key (model ID) and the value. The code should iterate over entries like:for (const [id, entry] of Object.entries(response.free))and then useidas the key instead ofentry.id.
This issue also appears on line 1435 of the same file.
if (response?.free) {
const freeEntries = Array.isArray(response.free) ? response.free : Object.values(response.free);
for (const entry of freeEntries) {
if (!entry || !isObject(entry)) {
continue;
}
free[entry.id] = { label: entry.label, featured: entry.featured };
}
src/vs/workbench/contrib/chat/common/languageModels.ts:1442
- After removing the
idfield from the type definition, this code is accessingentry.idon line 1441, which will be undefined. Since the response format isRecord<string, {...}>where the key is the model ID, you need to useObject.entries()instead ofObject.values()to access both the key (model ID) and the value. The code should iterate over entries like:for (const [id, entry] of Object.entries(response.paid))and then useidas the key instead ofentry.id.
if (response?.paid) {
const paidEntries = Array.isArray(response.paid) ? response.paid : Object.values(response.paid);
for (const entry of paidEntries) {
if (!entry || !isObject(entry)) {
continue;
}
paid[entry.id] = { label: entry.label, featured: entry.featured, minVSCodeVersion: entry.minVSCodeVersion };
}
src/vs/workbench/contrib/chat/common/languageModels.ts:1439
- The validation was updated to remove the
idtype check, but it should verify that required fields exist. Sincelabelis a required field in the type definition, consider adding a validation check liketypeof entry.label !== 'string'to ensure the data is well-formed before using it.
if (!entry || !isObject(entry)) {
continue;
joaomoreno
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.