#ai-generated
Bug Report
When creating a worktree, the library branches off the local main branch rather than fetching the latest state from origin first. If the local main is behind origin/main (e.g. because the user has not manually pulled), the new worktree starts from an outdated commit.
Root Cause
In manager.py the worktree is created with:
git worktree add -b fix/<nr>-<slug> <path> main
The base main resolves to the local ref refs/heads/main. There is no git fetch origin call anywhere in the creation path — neither in manager.py, worktrees.py, nor in the callers (workboard backend / lib consumers).
Steps to Reproduce
- Clone a repository where
origin/main is ahead of local main (or simply don't pull for a while).
- Create a worktree via the workboard or directly via the lib.
- Check the base commit of the new branch: it is behind
origin/main.
Expected Behavior
The new worktree/branch should always start from the latest origin/main so agents work on an up-to-date codebase. Concretely:
git fetch origin main
git worktree add -b fix/<nr>-<slug> <path> origin/main
Using origin/main as the base directly avoids having to update the local main branch, which could have uncommitted state or be checked out elsewhere.
Proposed Fix
In manager.py, before the git worktree add call, run:
subprocess.run(["git", "fetch", "origin", base_branch], cwd=repo_path, check=True)
Then change the base ref passed to git worktree add from main (local) to origin/main (remote tracking ref). The fetch can be skipped with a flag (e.g. fetch: bool = True) to support offline/air-gapped scenarios.
#ai-generated
Bug Report
When creating a worktree, the library branches off the local
mainbranch rather than fetching the latest state fromoriginfirst. If the localmainis behindorigin/main(e.g. because the user has not manually pulled), the new worktree starts from an outdated commit.Root Cause
In
manager.pythe worktree is created with:The base
mainresolves to the local refrefs/heads/main. There is nogit fetch origincall anywhere in the creation path — neither inmanager.py,worktrees.py, nor in the callers (workboard backend / lib consumers).Steps to Reproduce
origin/mainis ahead of localmain(or simply don't pull for a while).origin/main.Expected Behavior
The new worktree/branch should always start from the latest
origin/mainso agents work on an up-to-date codebase. Concretely:Using
origin/mainas the base directly avoids having to update the localmainbranch, which could have uncommitted state or be checked out elsewhere.Proposed Fix
In
manager.py, before thegit worktree addcall, run:Then change the base ref passed to
git worktree addfrommain(local) toorigin/main(remote tracking ref). The fetch can be skipped with a flag (e.g.fetch: bool = True) to support offline/air-gapped scenarios.