Remove legacy sessionOptions string value#303002
Merged
mjbvz merged 3 commits intomicrosoft:mainfrom Mar 18, 2026
Merged
Conversation
I believe the value should always be a `ChatSessionProviderOptionItem` now. I checked the copilot chat extension too and don't see anyone using the string value directly
Contributor
There was a problem hiding this comment.
Pull request overview
Removes legacy string-typed chat session option values and standardizes option passing on ChatSessionProviderOptionItem across the proposed chat sessions provider API and parts of the workbench implementation.
Changes:
- Updated
vscode.proposed.chatSessionsProvidertypes so session option values areChatSessionProviderOptionItem(notstring). - Updated internal chat sessions service APIs and caches to store/return option items.
- Adjusted a subset of tests/mocks to use option items instead of strings.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts | Removes string unions from session option values in the proposed API surface. |
| src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts | Updates mock session options storage to use option items. |
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Updates chat service test data to use option-item objects. |
| src/vs/workbench/contrib/chat/common/chatSessionsService.ts | Narrows session option APIs (get/set) to option-item types. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | Migrates contributed session option caching and notification plumbing to option items. |
| src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts | Partially updates tests to use option-item objects. |
| src/vs/workbench/api/common/extHost.protocol.ts | Updates protocol DTOs for initial options + session options record to option-item objects. |
| src/vs/workbench/api/browser/mainThreadChatSessions.ts | Narrows ObservableChatSession.options to option items. |
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts:1185
notifySessionOptionsChangewas narrowed to only acceptIChatSessionProviderOptionItem, but there are verified core call sites still passing string values (e.g.chatInputPart.tspasses''/modeName,newSession.tspassesvalue: IChatSessionProviderOptionItem | string). With the earlier removal oftypeof value === 'string' ? value : value.idconversion ingetSessionOptions, any string values that reach here will now be stored and later treated like an option-item object, causing type/logic errors. Please either (1) complete the migration by updating all callers + service interfaces/protocol DTOs to only use option items, or (2) keep backwards compatibility here by acceptingstring | IChatSessionProviderOptionItemand converting strings to{ id, name }(and handling clearing viaundefined/empty string) at the boundary.
public async notifySessionOptionsChange(sessionResource: URI, updates: ReadonlyArray<{ optionId: string; value: IChatSessionProviderOptionItem }>): Promise<void> {
if (!updates.length) {
return;
}
this._logService.trace(`[ChatSessionsService] notifySessionOptionsChange: starting for ${sessionResource}, ${updates.length} update(s): [${updates.map(u => u.optionId).join(', ')}]`);
// Fire event to notify MainThreadChatSessions (which forwards to extension host)
// Uses fireAsync to properly await async listener work via waitUntil pattern
await this._onRequestNotifyExtension.fireAsync({ sessionResource, updates }, CancellationToken.None);
this._logService.trace(`[ChatSessionsService] notifySessionOptionsChange: fireAsync completed for ${sessionResource}`);
for (const u of updates) {
this.setSessionOption(sessionResource, u.optionId, u.value);
}
You can also share your feedback on Copilot code review. Take the survey.
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts
Show resolved
Hide resolved
| [ | ||
| { optionId: 'model', value: 'claude-3.5-sonnet' }, | ||
| { optionId: 'repo', value: 'my-repo' }, | ||
| { optionId: 'model', value: { name: 'claude 3.5', id: 'claude-3.5-sonnet' } }, |
vijayupadya
approved these changes
Mar 18, 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.