Skip to content

Refactor Copilot CLI session management and improve folder handling#309779

Merged
DonJayamanne merged 1 commit intomainfrom
don/vertical-bobcat
Apr 14, 2026
Merged

Refactor Copilot CLI session management and improve folder handling#309779
DonJayamanne merged 1 commit intomainfrom
don/vertical-bobcat

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

  • 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.

- 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.
Copilot AI review requested due to automatic review settings April 14, 2026 08:46
@DonJayamanne DonJayamanne self-assigned this Apr 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 setNewFolderForInputState API in favor of rebuildInputState.
  • Added support for passing a newBranch promise 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

@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: b8258174 Current: b305b249

Changed (2)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

@DonJayamanne DonJayamanne marked this pull request as ready for review April 14, 2026 09:43
@DonJayamanne DonJayamanne enabled auto-merge (squash) April 14, 2026 09:43
@DonJayamanne DonJayamanne merged commit a47cd69 into main Apr 14, 2026
30 checks passed
@DonJayamanne DonJayamanne deleted the don/vertical-bobcat branch April 14, 2026 10:08
@vs-code-engineering vs-code-engineering bot added this to the 1.117.0 milestone Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants