Skip to content

AgentHost - add 'chat.agentHost.git.branchPrefix' setting#324750

Open
lszomoru wants to merge 4 commits into
mainfrom
lszomoru/yodelling-caribou
Open

AgentHost - add 'chat.agentHost.git.branchPrefix' setting#324750
lszomoru wants to merge 4 commits into
mainfrom
lszomoru/yodelling-caribou

Conversation

@lszomoru

@lszomoru lszomoru commented Jul 7, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 7, 2026 13:08
@lszomoru lszomoru enabled auto-merge (squash) July 7, 2026 13:08
@lszomoru lszomoru self-assigned this Jul 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a new configurable chat.agentHost.git.branchPrefix setting so users can customize (or remove) the prefix the agent host applies to branches it creates for new worktree sessions. Previously the prefix was hardcoded as agents/. The setting is forwarded from the workbench to the agent host process via a new VSCODE_AGENT_HOST_GIT_BRANCH_PREFIX environment variable, which the branch-name generator and worktree-name derivation now read at runtime.

Changes:

  • Introduces the AgentHostGitBranchPrefixSettingId setting (default agents/) and the AgentHostGitBranchPrefixEnvVar, forwarded through buildAgentSdkEnv (with special handling so an explicit empty string is honored) and both the Node and Electron starters.
  • Replaces the hardcoded COPILOT_BRANCH_PREFIX export with a private constant plus a new getAgentHostGitBranchPrefix() resolver, and rewires CopilotBranchNameGenerator and getCopilotWorktreeName to use the resolved prefix.
  • Adds a unit test verifying branch-prefix forwarding (including empty string and developer override).
Show a summary per file
File Description
src/vs/platform/agentHost/common/agentService.ts Adds the setting id, env var, IAgentSdkStarterSettings.gitBranchPrefix, and forwarding logic in buildAgentSdkEnv.
src/vs/platform/agentHost/common/agentHostStarter.config.contribution.ts Registers the new chat.agentHost.git.branchPrefix string setting (missing tags).
src/vs/platform/agentHost/node/nodeAgentHostStarter.ts Reads the setting and passes it into buildAgentSdkEnv.
src/vs/platform/agentHost/electron-main/electronAgentHostStarter.ts Same forwarding wiring for the Electron starter.
src/vs/platform/agentHost/node/copilot/copilotBranchNameGenerator.ts Adds getAgentHostGitBranchPrefix(), demotes COPILOT_BRANCH_PREFIX to a private constant; JSDoc describes behavior not implemented.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Updates the import and getCopilotWorktreeName to strip the resolved prefix.
src/vs/platform/agentHost/test/common/agentService.test.ts Adds a test suite for branch-prefix env forwarding.

Review details

  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment thread src/vs/platform/agentHost/node/copilot/copilotBranchNameGenerator.ts Outdated
Comment thread src/vs/platform/agentHost/node/copilot/copilotBranchNameGenerator.ts Outdated
lszomoru and others added 2 commits July 7, 2026 15:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
benibenj
benibenj previously approved these changes Jul 7, 2026
@lszomoru

lszomoru commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@microsoft-github-policy-service rerun

roblourens
roblourens previously approved these changes Jul 7, 2026
default: true,
tags: ['experimental', 'advanced'],
},
[AgentHostGitBranchPrefixSettingId]: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need a new setting for this? I'm not sure about all of these ".agentHost" settings because this should be sort of invisible to the user

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@roblourens, are you questioning the functionality (ex: branch prefix) or how the setting is defined? I think that the functionality is needed if a user wants to be able to identify their own branches that were created by the agent host. I would like to set the setting to USERNAME/agents. Should I define the setting in a different place? Should this be a "client-side" user setting?

sandy081
sandy081 previously approved these changes Jul 7, 2026
Comment thread src/vs/platform/agentHost/common/agentHostStarter.config.contribution.ts Outdated
@lszomoru lszomoru disabled auto-merge July 7, 2026 15:11
@lszomoru lszomoru dismissed stale reviews from sandy081, roblourens, and benibenj via dee5c85 July 7, 2026 15:13
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.

5 participants