Refactor Copilot CLI session management and improve folder handling#309779
Merged
DonJayamanne merged 1 commit intomainfrom Apr 14, 2026
Merged
Refactor Copilot CLI session management and improve folder handling#309779DonJayamanne merged 1 commit intomainfrom
DonJayamanne merged 1 commit intomainfrom
Conversation
- Mark `onDidChangeSessions` as deprecated in `ICopilotCLISessionService`. - Enhance session deletion logic in `ChatSessionMetadataStore`. - Update `CopilotCLIChatSessionInitializer` to support new branch creation. - Refine session option group handling in `SessionOptionGroupBuilder`, ensuring previous selections persist. - Adjust tests to validate new folder handling and session state persistence.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors parts of the Copilot CLI chat sessions implementation to improve folder MRU/selection handling, support passing a “new branch” signal into session initialization, and tighten session metadata cleanup.
Changes:
- Updated folder option-group building to re-resolve and persist previously selected folders even when they’re no longer in MRU, and removed the dedicated
setNewFolderForInputStateAPI in favor ofrebuildInputState. - Added support for passing a
newBranchpromise through session initialization so worktree creation can use a generated branch name. - Improved session cleanup by deleting additional on-disk session metadata artifacts and adjusted tests to validate the new folder/state behavior.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/chatSessions/vscode-node/test/sessionOptionGroupBuilder.spec.ts | Updates/extends tests to validate folder selection persistence and re-resolution behavior. |
| extensions/copilot/src/extension/chatSessions/vscode-node/sessionOptionGroupBuilder.ts | Refactors welcome-view folder list building to re-add selected/previous folders and persist browsed folder across rebuilds. |
| extensions/copilot/src/extension/chatSessions/vscode-node/folderRepositoryManagerImpl.ts | Minor output formatting tweak for migration messaging. |
| extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts | Adjusts new-session input-state handling and routes branch name generation into initialization paths. |
| extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionInitializer.ts | Plumbs newBranch into folder repository initialization. |
| extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionMetadataStoreImpl.ts | Expands deletion to remove more per-session files on disk. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts | Marks onDidChangeSessions as deprecated for legacy/non-controller usage. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 4
Contributor
alexr00
approved these changes
Apr 14, 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.
onDidChangeSessionsas deprecated inICopilotCLISessionService.ChatSessionMetadataStore.CopilotCLIChatSessionInitializerto support new branch creation.SessionOptionGroupBuilder, ensuring previous selections persist.