AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-479
  5. plan
  6. plan.md
plan.md(2.5 KB)· Apr 13, 2026· 1 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: Worktree branches from RC branch during release#

Summary#

Add a baseBranch parameter to WorktreeService.getOrCreateWorktree() so worktrees are created from origin/{rcBranch} when a task belongs to an active release. In PhaseRouterService.executePhase(), look up the active release config and pass the RC branch to the worktree call.

Files#

FileActionDescription
src/worktree/worktree.service.tsmodifyAdd optional baseBranch parameter (default 'master'), use it in git worktree add
src/phase-router/phase-router.service.tsmodifyLook up release config before worktree creation, pass rcBranch as baseBranch
src/worktree/worktree.service.spec.tsmodifyAdd tests for baseBranch parameter in getOrCreateWorktree()
src/phase-router/phase-router.service.spec.tsmodifyAdd test: release-active task passes rcBranch to worktree; no-release task defaults to master

Steps#

  1. Add baseBranch = 'master' as 4th optional parameter to getOrCreateWorktree() in worktree.service.ts. Replace hardcoded 'origin/master' on line 130 with \origin/${baseBranch}``.
  2. In phase-router.service.ts executePhase(), before the getOrCreateWorktree() call (line 445), look up the release config via this.releaseService.findActiveForTask(task.id). If active, pass releaseConfig.rcBranch as the baseBranch parameter.
  3. Add unit tests in worktree.service.spec.ts: (a) new worktree with custom baseBranch uses origin/{baseBranch} instead of origin/master; (b) omitted baseBranch defaults to origin/master (existing tests cover this).
  4. Add unit tests in phase-router.service.spec.ts: (a) when releaseService.findActiveForTask returns a release, getOrCreateWorktree is called with rcBranch; (b) when it returns null, getOrCreateWorktree is called without baseBranch (defaults to master).

Verification#

  • npm run test passes with new and existing tests
  • npm run lint passes with zero warnings
  • Manual inspection: git worktree add command in the fresh-create path uses origin/{baseBranch} instead of hardcoded origin/master

Risks#

  • Existing worktrees already branched from master are reused as-is (get-or-create pattern, line 92–94). This is by design per the issue's edge case spec — no silent re-creation.
  • If the RC branch does not exist on origin, git worktree add fails naturally — this is correct behavior per the issue spec (misconfigured release).
ContextPrd