Repository navigation
Derive worktree branch name from first message on agent host - #315065
Merged
Merged
Conversation
In remote agent host worktree mode, the generated branch was just a GUID because the eager-create path never sent a branchNameHint. Rather than plumb a hint from the client, derive it on the agent host from the first message itself. - Add getCopilotBranchNameHintFromMessage in copilotAgent.ts - Plumb prompt through sendMessage -> _materializeProvisional -> _resolveSessionWorkingDirectory - Remove SessionConfigKey.BranchNameHint and the client-side getAgentHostBranchNameHint plumbing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the remote agent host “worktree isolation” flow by deriving a deterministic branch-name hint from the first user message on the agent host, avoiding GUID-only branch names without requiring the client to compute or send a hint.
Changes:
- Add
getCopilotBranchNameHintFromMessageon the agent host and use it during provisional-session materialization to name worktree branches based on the first prompt. - Remove client-side
branchNameHintplumbing (SessionConfigKey.BranchNameHint+ handler helper/export) and adjust session config forwarding behavior/tests. - Update UI/config picker and tests to reflect the removed config key and new eager-create config propagation.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Updates tests to stop expecting branchNameHint in createSession config and adds coverage for eager-create SessionConfigChanged forwarding. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Removes client-side branch hint derivation and stops injecting BranchNameHint into session creation config. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Removes re-export of the deleted getAgentHostBranchNameHint. |
| src/vs/sessions/contrib/chat/browser/agentHost/agentHostSessionConfigPicker.ts | Stops filtering out the removed branchNameHint config key when rendering pickers. |
| src/vs/platform/agentHost/test/node/copilotAgent.test.ts | Updates tests to reflect prompt-based branch hinting and the removal of branchNameHint in config. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Introduces prompt-to-slug branch hint derivation and plumbs prompt into provisional materialization/worktree creation. |
| src/vs/platform/agentHost/common/sessionConfigKeys.ts | Removes SessionConfigKey.BranchNameHint. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
marked this pull request as ready for review
May 7, 2026 22:48
roblourens
enabled auto-merge (squash)
May 7, 2026 22:48
TylerLeonhardt
approved these changes
May 8, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
In remote agent host worktree mode, the generated branch was just a GUID because the eager-create path never sent a
branchNameHint. Rather than plumb a hint from the client, this PR derives it on the agent host from the first message itself.Changes
getCopilotBranchNameHintFromMessageincopilotAgent.tspromptthroughsendMessage→_materializeProvisional→_resolveSessionWorkingDirectoryso the branch is created lazily on first message with a meaningful nameSessionConfigKey.BranchNameHintand the client-sidegetAgentHostBranchNameHintplumbing — the client no longer needs to compute or send a hint