refactor: streamline session option group selection logic and improve test coverage#308743
Merged
DonJayamanne merged 10 commits intomainfrom Apr 10, 2026
Merged
refactor: streamline session option group selection logic and improve test coverage#308743DonJayamanne merged 10 commits intomainfrom
DonJayamanne merged 10 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Copilot CLI session option-group selection behavior (repo/branch/isolation) to produce more consistent defaults—especially in welcome-view (MRU) scenarios—and expands unit test coverage around these flows. It also starts returning locked option values for existing sessions so the session UI can reflect the resolved/locked selections.
Changes:
- Auto-select the first MRU repository in welcome view (and fall back to the first item when a previous selection is no longer present).
- When branch selection is locked (workspace isolation), ignore any previous branch selection and snap back to HEAD; adjust locked branch group items accordingly.
- For existing sessions, populate
ChatSession.optionswith locked option values derived from the existing-session input-state groups.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/chatSessions/vscode-node/test/sessionOptionGroupBuilder.spec.ts | Updates/extends tests to cover new selection/locking behavior for MRU repo + branch groups. |
| extensions/copilot/src/extension/chatSessions/vscode-node/sessionOptionGroupBuilder.ts | Refines welcome-view repository selection and locked-branch selection behavior. |
| extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts | Adds locked option values to existing session content and removes an unused no-op handler. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 2
...nsions/copilot/src/extension/chatSessions/vscode-node/test/sessionOptionGroupBuilder.spec.ts
Outdated
Show resolved
Hide resolved
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts
Show resolved
Hide resolved
7c86367 to
3042bde
Compare
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors Copilot CLI session dropdown handling to derive selections from ChatSessionInputState (instead of legacy option payloads), while expanding unit coverage for selection/locking behavior in welcome-view and branch/isolation scenarios.
Changes:
- Add
ChatSessionContext.inputStateto the proposed sessions provider API and deprecateinitialSessionOptions. - Centralize extraction of selected folder/branch/isolation from
ChatSessionInputStateand update session initialization call sites accordingly. - Expand tests around option group building, default selections, and lock/reset behavior.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/vscode.proposed.chatSessionsProvider.d.ts | Deprecates initialSessionOptions and introduces inputState on ChatSessionContext; clarifies command arg behavior. |
| extensions/copilot/src/extension/chatSessions/vscode-node/sessionOptionGroupBuilder.ts | Adds helper to read selected options from input state; adjusts default selection and locked-branch behavior; simplifies input-state rebuild path. |
| extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts | Switches request/session init plumbing to pass selections derived from input state; populates options for existing sessions from locked groups. |
| extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionInitializer.ts | Refactors initializer APIs to take a chat resource + structured init options rather than parsing legacy option entries. |
| extensions/copilot/src/extension/chatSessions/vscode-node/test/sessionOptionGroupBuilder.spec.ts | Adds/updates unit tests for new selection extraction and welcome-view/locking behaviors. |
| extensions/copilot/src/extension/chatSessions/vscode-node/test/chatSessionInitializer.spec.ts | Updates tests to match the initializer API refactor and option-passing changes. |
| extensions/copilot/package.json | Bumps vscodeCommit pointer. |
Copilot's findings
- Files reviewed: 6/7 changed files
- Comments generated: 2
extensions/copilot/src/extension/chatSessions/vscode-node/sessionOptionGroupBuilder.ts
Outdated
Show resolved
Hide resolved
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts
Show resolved
Hide resolved
…ure and improve input state handling
…/sessionOptionGroupBuilder.spec.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
333bd69 to
5167b56
Compare
roblourens
previously approved these changes
Apr 10, 2026
roblourens
approved these changes
Apr 10, 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.