Problem
AgentFlow currently detects the base branch from the repository’s default branch, usually via origin/HEAD.
This causes problems when a repository’s default branch is not the branch that automation should target.
For example, a repo may use:
main as a protected/default branch
develop as the integration branch for automated PRs
In that case, AgentFlow may create worktrees, sync changes, check CI, or prepare PR/merge logic against the wrong branch. This can cause PRs to target main when they should target develop.
Proposed Improvements
Add an optional environment variable:
GITHUB_BASE_BRANCH=develop
When set, AgentFlow should use GITHUB_BASE_BRANCH as the base branch.
When unset or empty, AgentFlow should keep the existing behavior and detect the repository default branch normally.
The override should apply to:
- Worktree/default branch detection
- VESSEL merge and CI handling
- LORE documentation PR handling
.env.example documentation
Acceptance Criteria
GITHUB_BASE_BRANCH can be set to a branch name such as develop.
- When
GITHUB_BASE_BRANCH is set, AgentFlow uses it as the base branch.
- When
GITHUB_BASE_BRANCH is unset or empty, existing default-branch detection remains unchanged.
- Worktree creation and updates use the configured base branch.
- VESSEL merge and CI flows use the configured base branch.
- LORE documentation PR flows use the configured base branch.
.env.example documents the optional variable.
- Branch names are treated as case-sensitive.
Problem
AgentFlow currently detects the base branch from the repository’s default branch, usually via
origin/HEAD.This causes problems when a repository’s default branch is not the branch that automation should target.
For example, a repo may use:
mainas a protected/default branchdevelopas the integration branch for automated PRsIn that case, AgentFlow may create worktrees, sync changes, check CI, or prepare PR/merge logic against the wrong branch. This can cause PRs to target
mainwhen they should targetdevelop.Proposed Improvements
Add an optional environment variable:
When set, AgentFlow should use
GITHUB_BASE_BRANCHas the base branch.When unset or empty, AgentFlow should keep the existing behavior and detect the repository default branch normally.
The override should apply to:
.env.exampledocumentationAcceptance Criteria
GITHUB_BASE_BRANCHcan be set to a branch name such asdevelop.GITHUB_BASE_BRANCHis set, AgentFlow uses it as the base branch.GITHUB_BASE_BRANCHis unset or empty, existing default-branch detection remains unchanged..env.exampledocuments the optional variable.