{
"meta": {
"agent": "planner",
"task_id": "479",
"title": "Bug: worktree branches from master instead of RC branch during release",
"created_at": "2026-04-13T12:50:00Z"
},
"inputs": [
{
"name": "GitHub Issue #479",
"type": "context",
"ref": "https://github.com/AgentSDE/agent-core/issues/479",
"notes": "Bug report: worktree hardcodes origin/master as base"
},
{
"name": "worktree.service.ts",
"type": "file",
"ref": "src/worktree/worktree.service.ts",
"notes": "Line 130 hardcodes origin/master"
},
{
"name": "phase-router.service.ts",
"type": "file",
"ref": "src/phase-router/phase-router.service.ts",
"notes": "executePhase() creates worktree without baseBranch"
},
{
"name": "release.service.ts",
"type": "file",
"ref": "src/release/release.service.ts",
"notes": "findActiveForTask() returns rcBranch for active releases"
}
],
"outputs": [
{
"name": "plan.md",
"type": "plan",
"format": "md",
"content": "Implementation plan for RC-aware worktree creation"
}
],
"files": [
{
"path": "src/worktree/worktree.service.ts",
"action": "modify",
"reason": "Add baseBranch parameter to getOrCreateWorktree()"
},
{
"path": "src/phase-router/phase-router.service.ts",
"action": "modify",
"reason": "Pass rcBranch from release config to worktree creation"
},
{
"path": "src/worktree/worktree.service.spec.ts",
"action": "modify",
"reason": "Add tests for baseBranch parameter"
},
{
"path": "src/phase-router/phase-router.service.spec.ts",
"action": "modify",
"reason": "Add tests for release-aware worktree creation"
}
],
"steps": [
{
"id": "S1",
"summary": "Add baseBranch parameter to WorktreeService.getOrCreateWorktree() and replace hardcoded origin/master",
"acceptance": [
"getOrCreateWorktree() accepts optional baseBranch parameter defaulting to 'master'",
"Fresh worktree creation uses origin/{baseBranch} instead of origin/master",
"Existing behavior unchanged when baseBranch is omitted"
],
"depends_on": []
},
{
"id": "S2",
"summary": "Pass RC branch from release config to worktree creation in PhaseRouterService.executePhase()",
"acceptance": [
"executePhase() calls releaseService.findActiveForTask() before worktree creation",
"When release is active, rcBranch is passed as baseBranch to getOrCreateWorktree()",
"When no release is active, getOrCreateWorktree() is called without baseBranch (defaults to master)"
],
"depends_on": [
"S1"
]
},
{
"id": "S3",
"summary": "Add unit tests for baseBranch in worktree.service.spec.ts and phase-router.service.spec.ts",
"acceptance": [
"Test: custom baseBranch produces git worktree add with origin/{baseBranch}",
"Test: release-active task passes rcBranch to getOrCreateWorktree()",
"Test: no-release task uses default master base",
"npm run test passes",
"npm run lint passes"
],
"depends_on": [
"S1",
"S2"
]
}
],
"risks": [
{
"risk": "Existing worktrees branched from master are reused as-is",
"mitigation": "By design — get-or-create pattern returns early for registered worktrees; issue spec explicitly excludes re-creation"
},
{
"risk": "RC branch missing on origin causes git worktree add failure",
"mitigation": "Correct behavior per issue spec — indicates misconfigured release; existing BLOCKED:TRANSIENT handler catches the error"
}
],
"assumptions": [
"ReleaseService is already injected into PhaseRouterService (confirmed in production code)",
"findActiveForTask() is the correct API to determine if a task belongs to an active release with an RC branch"
]
}