Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Cloud Agent Branch DelegationNew to Visual Studio Code? Get it now.
Cloud Agent Branch Delegation

Cloud Agent Branch Delegation

hikousagi

|
3 installs
| (0) | Free
Restore functionality to use current branch for cloud chat agent Pull Requests instead of defaulting to main
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Cloud Agent Branch Delegation

A VS Code extension that restores the functionality to use the current git branch for cloud chat agent Pull Requests instead of defaulting to "main".

The Problem

After VS Code update v1.107 (release notes), cloud chat agents started defaulting to the "main" branch when creating Pull Requests, regardless of which branch you're currently working on. This makes it difficult to use VS Code for cloud task delegation when working on feature branches.

The Solution

This extension automatically detects your current git branch and configures the environment so that cloud agents use the correct branch when creating Pull Requests.

Features

  • Automatic Branch Detection: Detects your current git branch and sets it as the target for cloud agent operations
  • Status Bar Indicator: Shows the current branch being used for cloud agents in the status bar
  • Environment Variable Configuration: Sets appropriate environment variables (GIT_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME) for cloud agent tools
  • Real-time Updates: Monitors branch changes and updates the configuration automatically
  • Configurable: Allows you to enable/disable the extension or set a default branch

Installation

From Source

  1. Clone this repository: https://github.com/hikousagi/vscode-cloud-agent-branch-delegation.git
  2. Run npm install to install dependencies
  3. Run npm run compile to build the extension
  4. Press F5 in VS Code to launch the Extension Development Host
  5. Test the extension in the new window

From VSIX (if published)

  1. Download the .vsix file
  2. In VS Code, go to Extensions view
  3. Click "..." menu and select "Install from VSIX..."
  4. Select the downloaded file

Usage

  1. Open a workspace with a git repository
  2. The extension will automatically activate and detect your current branch
  3. Look for the branch indicator in the status bar (shows a git branch icon with your current branch name)
  4. Click on the status bar item to confirm which branch is being used
  5. When you use cloud chat agents to create PRs, they will now use your current branch instead of "main"

Configuration

Access settings via File > Preferences > Settings, then search for "Cloud Agent Branch Delegation":

  • cloudAgentBranchDelegation.enabled: Enable/disable automatic branch detection (default: true)
  • cloudAgentBranchDelegation.defaultBranch: Specify a default branch to use when current branch cannot be detected (default: empty)

Commands

  • Cloud Agent: Use Current Branch for PRs: Manually trigger branch detection and show the current branch being used

Requirements

  • VS Code version 1.107.0 or higher
  • A workspace with a git repository
  • Git installed on your system

How It Works

The extension:

  1. Detects your current git branch using git commands
  2. Sets environment variables that cloud agents may use (GIT_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME)
  3. Monitors for branch changes using the VS Code Git API
  4. Updates the configuration in real-time as you switch branches

Known Limitations

  • Requires a git repository in the workspace
  • Only monitors the first workspace folder if multiple folders are open
  • Depends on cloud agents respecting the environment variables set by this extension

Contributing

Issues and pull requests are welcome! Please submit them to the repository.

License

See LICENSE file for details.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft