feat: updates for Copilot CLI to include mode instructions#303962
Merged
DonJayamanne merged 8 commits intomainfrom Mar 24, 2026
Merged
feat: updates for Copilot CLI to include mode instructions#303962DonJayamanne merged 8 commits intomainfrom
DonJayamanne merged 8 commits intomainfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the chat/session plumbing to carry “mode instructions” through Copilot CLI (and other contributed session) request history, so the UI can rehydrate picker state (mode/agent + model) based on prior requests.
Changes:
- Bumps
chatParticipantPrivateproposed API version and addsmodeInstructions2toChatRequestTurn2. - Threads
modeInstructionsthrough chat session history DTOs and ext host/main thread converters, with added unit tests. - Introduces an extension-point flag
useRequestToPopulateBuiltInPickersand uses it during remote session restoration / input picker preselection.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts | Proposed API version bump + modeInstructions2 added to ChatRequestTurn2. |
| src/vs/platform/extensions/common/extensionsApiProposals.ts | Updates proposal version to match the d.ts bump. |
| src/vs/workbench/contrib/chat/common/chatSessionsService.ts | Adds modeInstructions to session history items + new extension point flag. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | Adds useRequestToPopulateBuiltInPickers to extension point schema. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Restores picker state from remote session history; persists modeInstructions into history export. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Adjusts picker preselection logic and sets mode from last request’s mode instructions (when applicable). |
| src/vs/workbench/contrib/chat/common/model/chatModel.ts | Minor formatting change in addRequest response model creation. |
| src/vs/workbench/api/common/extHostTypes.ts | Ext host ChatRequestTurn now carries modeInstructions2. |
| src/vs/workbench/api/common/extHostTypeConverters.ts | Adds converters for ChatRequestModeInstructions (including Dto handling) + reverse conversion. |
| src/vs/workbench/api/common/extHostChatSessions.ts | Passes mode instructions into/out of ChatRequestTurn. |
| src/vs/workbench/api/common/extHostChatAgents2.ts | Includes modeInstructions2 when exposing request turns to extensions (gated by proposal). |
| src/vs/workbench/api/common/extHost.protocol.ts | Adds modeInstructions to the session history DTO. |
| src/vs/workbench/api/browser/mainThreadChatSessions.ts | Revives mode instructions from history + forwards them in fork DTOs. |
| src/vs/workbench/api/test/common/extHostTypeConverters.test.ts | Adds unit tests for mode-instructions conversion roundtrips and DTO revival. |
| src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts | Adds tests for mode-instructions revival and DTO pass-through. |
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts:616
findLast(providedSession.history.filter(...))allocates filtered arrays and then scans again. Since this runs on remote session load and history can be large, consider scanning once from the end ofprovidedSession.history(or usingfindLastdirectly on the full history with a predicate that checkstype === 'request') to avoid extra allocations and passes.
const modelId = findLast(providedSession.history.filter(m => m.type === 'request'), req => req.modelId)?.modelId;
const agentUri = findLast(providedSession.history.filter(m => m.type === 'request'), req => req.modeInstructions?.uri)?.modeInstructions?.uri;
let initialData: ISerializedChatDataReference | undefined = undefined;
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts
Outdated
Show resolved
Hide resolved
…s.contribution.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
37b1f47 to
829ee49
Compare
osortega
approved these changes
Mar 24, 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.