What happened
A run's working tree is checked out at the origin's HEAD, not at repo.baseBranch.
allocateWorkspace (src/lib/workspace.ts) runs git clone <mirror> <dir>, which checks out the
mirror's HEAD, the remote's default branch. baseBranch is used only by write-back, as the PR's
base.
Found during #62's live legs (#72, #67). A local bare origin created with git init --bare
may have HEAD → master, and its runs did not start from main until HEAD was pointed at
main.
Real-world effect: for a project whose PRs target a branch other than the remote's default (for
example baseBranch: "develop" on a repository whose default is main), the agent works on
main, and write-back opens a PR against develop with main's history in the diff.
Fix
Pass baseBranch into WorkspaceAllocationInput and clone with git clone --branch <baseBranch> <mirror> <dir>, or check it out after the clone. If the branch is missing, the allocation
should fail with a message that names it. Add a workspace.test.ts case with a bare origin whose
HEAD differs from baseBranch.
What happened
A run's working tree is checked out at the origin's
HEAD, not atrepo.baseBranch.allocateWorkspace(src/lib/workspace.ts) runsgit clone <mirror> <dir>, which checks out themirror's
HEAD, the remote's default branch.baseBranchis used only by write-back, as the PR'sbase.
Found during #62's live legs (#72, #67). A local bare origin created with
git init --baremay have
HEAD → master, and its runs did not start frommainuntilHEADwas pointed atmain.Real-world effect: for a project whose PRs target a branch other than the remote's default (for
example
baseBranch: "develop"on a repository whose default ismain), the agent works onmain, and write-back opens a PR againstdevelopwithmain's history in the diff.Fix
Pass
baseBranchintoWorkspaceAllocationInputand clone withgit clone --branch <baseBranch> <mirror> <dir>, or check it out after the clone. If the branch is missing, the allocationshould fail with a message that names it. Add a
workspace.test.tscase with a bare origin whoseHEADdiffers frombaseBranch.