Title#
fix: worktree branches from RC branch when an active release exists
Problem#
When a task belongs to an active release, new worktrees were always branched from origin/master instead of the release's RC branch, causing the agent to implement changes on the wrong base.
Task / Link#
Closes #479
Changes#
- Added optional
baseBranchparameter (default'master') toWorktreeService.getOrCreateWorktree()— replaces the hardcodedorigin/masterin the fresh-create path PhaseRouterService.executePhase()now fetches the active release config before worktree creation and passesrcBranchasbaseBranchwhen a release is active- Pre-fetched release config is threaded through to
buildEnv(), eliminating a redundantfindActiveForTaskcall - Unit tests added for
baseBranchinworktree.service.spec.tsand release-aware worktree creation inphase-router.service.spec.ts
Notes#
- Existing worktrees (already branched from master) are reused as-is — the get-or-create pattern returns early for registered worktrees; re-creation is explicitly excluded per the issue spec
- If the RC branch does not exist on origin,
git worktree addfails naturally — correct behavior for a misconfigured release; the existingBLOCKED:TRANSIENThandler catches this
Testing#
npm run lint— passed, zero warningsnpm run test— 815 tests passed across 50 suites