AI Agents SDE Task Viewer
      • Pr description
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-479
  5. changes
  6. pr_description.md
pr_description.md(1.4 KB)· Apr 13, 2026· 1 min read
  • Title
  • Problem
  • Task / Link
  • Changes
  • Notes
  • Testing

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 baseBranch parameter (default 'master') to WorktreeService.getOrCreateWorktree() — replaces the hardcoded origin/master in the fresh-create path
  • PhaseRouterService.executePhase() now fetches the active release config before worktree creation and passes rcBranch as baseBranch when a release is active
  • Pre-fetched release config is threaded through to buildEnv(), eliminating a redundant findActiveForTask call
  • Unit tests added for baseBranch in worktree.service.spec.ts and release-aware worktree creation in phase-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 add fails naturally — correct behavior for a misconfigured release; the existing BLOCKED:TRANSIENT handler catches this

Testing#

  • npm run lint — passed, zero warnings
  • npm run test — 815 tests passed across 50 suites
PrdAi-done