feat: Implement Copillot CLI's Plan mode#4933
Draft
DonJayamanne wants to merge 8 commits intomainfrom
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in setting to enable AI-generated branch names when Copilot CLI creates isolated worktrees, wiring the generator into the Copilot CLI session participants (both the “controller” and V1 implementations).
Changes:
- Add new configuration key
github.copilot.chat.cli.aiGenerateBranchNames.enabled(default:false) with localization. - Conditionally instantiate
GitBranchNameGeneratorbased on the new setting and pass it into Copilot CLI session participants. - Thread an (optional) generated branch name into worktree initialization for new untitled CLI sessions; update unit tests for the new constructor parameter.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/platform/configuration/common/configurationService.ts | Registers the new config key in ConfigKey.Advanced. |
| src/extension/chatSessions/vscode-node/chatSessions.ts | Reads the new config and conditionally creates/passes GitBranchNameGenerator. |
| src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts | Makes branch name generator optional and guards its usage. |
| src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts | Adds optional branch-name generation and passes it into folder/worktree initialization for V1 participant. |
| src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts | Updates participant construction to account for the new optional constructor parameter. |
| package.json | Contributes the new setting to VS Code configuration. |
| package.nls.json | Adds the localized description string for the new setting. |
Comments suppressed due to low confidence (2)
src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:1314
- There are two statements on the same line (
const branchNamePromise = ...; const [model, agent] = ...). This makes the control flow harder to read and is easy to miss during reviews/merges. Split these into separate lines/statements (and consider extractingisNewSessionandbranchNamePromiseinto clearly named variables).
};
const branchNamePromise = (isUntitled && request.prompt && this.branchNameGenerator) ? this.branchNameGenerator.generateBranchName(fakeContext, token) : Promise.resolve(undefined); const [model, agent] = await Promise.all([
this.getModelId(request, token),
this.getAgent(id, request, token),
src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:1313
- New behavior: when starting an untitled session, the participant may call
branchNameGenerator.generateBranchName(...)and thread the result intoinitializeFolderRepository(... newBranch: ...). The existing unit tests for this participant never pass aGitBranchNameGenerator(they always passundefined), so this feature path isn’t covered. Add a test that injects a stub generator and asserts it is invoked only for new sessions and that the resolved branch name is forwarded to worktree creation (viainitializeFolderRepository/createWorktree).
const requestTurn = new ChatRequestTurn2(request.prompt ?? '', request.command, [], '', [], [], undefined, undefined, undefined);
const fakeContext: vscode.ChatContext = {
history: [requestTurn],
yieldRequested: false,
};
const branchNamePromise = (isUntitled && request.prompt && this.branchNameGenerator) ? this.branchNameGenerator.generateBranchName(fakeContext, token) : Promise.resolve(undefined); const [model, agent] = await Promise.all([
this.getModelId(request, token),
src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts
Outdated
Show resolved
Hide resolved
b879fa6 to
78213db
Compare
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.
For https://github.com/github/copilot-agent-runtime/issues/5660