AgentHost - add 'chat.agentHost.git.branchPrefix' setting#324750
AgentHost - add 'chat.agentHost.git.branchPrefix' setting#324750lszomoru wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
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
AgentHostGitBranchPrefixSettingIdsetting (defaultagents/) and theAgentHostGitBranchPrefixEnvVar, forwarded throughbuildAgentSdkEnv(with special handling so an explicit empty string is honored) and both the Node and Electron starters. - Replaces the hardcoded
COPILOT_BRANCH_PREFIXexport with a private constant plus a newgetAgentHostGitBranchPrefix()resolver, and rewiresCopilotBranchNameGeneratorandgetCopilotWorktreeNameto 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
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>
|
@microsoft-github-policy-service rerun |
| default: true, | ||
| tags: ['experimental', 'advanced'], | ||
| }, | ||
| [AgentHostGitBranchPrefixSettingId]: { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@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?
dee5c85
No description provided.