Copilot CLI: refactor how uncommitted changes are determined before creating a new CLI session#4756
Merged
Copilot CLI: refactor how uncommitted changes are determined before creating a new CLI session#4756
Conversation
…reating a new CLI session
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the Copilot CLI “uncommitted changes” detection/prompting path that runs before creating a new CLI session/worktree, and adjusts related workspace-change tracking and tests.
Changes:
- Update
FolderRepositoryManagerto determine uncommitted changes viagitService.getRepository(...)using the selected repository URI (and requested branch), and always use thevscode_get_modified_files_confirmationtool for the prompt. - Remove filesystem-watcher-based cache invalidation from
ChatSessionWorkspaceFolderServiceand simplify constructor dependencies. - Update unit tests/fakes to align with the new repository lookup and revised service constructor.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/extension/chatSessions/vscode-node/folderRepositoryManagerImpl.ts | Refactors uncommitted-change prompting flow and repo lookup; removes old fallback confirmation path. |
| src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts | Removes workspace file watcher invalidation; relies on repo HEAD change to clear cached workspace changes. |
| src/extension/chatSessions/vscode-node/test/folderRepositoryManager.spec.ts | Updates fake git service behavior to support new repo lookup during prompting. |
| src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts | Adjusts delegate-path setup to ensure repo is discoverable via getRepository. |
| src/extension/chatSessions/vscode-node/test/chatSessionWorkspaceFolderService.spec.ts | Updates constructor usage and removes watcher-based cache invalidation tests. |
Comments suppressed due to low confidence (1)
src/extension/chatSessions/vscode-node/folderRepositoryManagerImpl.ts:452
- Skipping the uncommitted-changes confirmation when
repository.headBranchName !== branchcan suppress the prompt even when there are local changes, which means the user won't get a chance to copy/move them into the new worktree. Uncommitted changes (and the file list) can still be determined regardless of the target branch; if the concern is applying them onto a different branch, consider still prompting but adding a warning about potential conflicts, or compute the list against the correct ref instead of returningundefinedhere.
if (branch && repository.headBranchName !== branch) {
return undefined;
…Impl.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
lszomoru
previously approved these changes
Mar 27, 2026
justschen
approved these changes
Mar 28, 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.