Parent Epic
Part of #52 — Sequential stacked PR chains
Summary
Add base_branch support so PRs can target a parent task's branch instead of the repo's default branch. This enables true stacked PRs where PR #2 targets PR #1's branch.
Context
Today, all PRs implicitly target main (or whatever the default branch is). Prompts tell the agent gh pr create --draft without specifying --base. For stacked workstreams, PR #2 needs to target PR #1's branch so it only contains its own diff.
Changes
persistence.py
prompts.py
- All prompts that mention
gh pr create add --base <base_branch> when base_branch is set
- Self-review diffs against base_branch:
git diff <base_branch> instead of hardcoded main
- Fix prompt to diff against base_branch too
github_api.py
- Add
get_default_branch() — gh repo view --json defaultBranchRef --jq .defaultBranchRef.name, cached
- Update
find_pr_for_branch() to optionally verify the base branch matches
orchestrator.py
Orchestrator reads base_branch from task record
- Passes base_branch to prompt generators
- Falls back to
get_default_branch() when base_branch is NULL
- Fix
_do_update_description() to use base_branch instead of hardcoded main for git diff
cli.py
cmd_start accepts --base flag for manual stacked PR support
- Stores base_branch in task record
Depends On
Testing
- PR created with
--base <parent_branch> when base_branch is set
- PR created without
--base when base_branch is NULL (targets default branch)
get_default_branch() caches correctly
- Prompts include correct diff target
_do_update_description() uses base_branch for git diff
Parent Epic
Part of #52 — Sequential stacked PR chains
Summary
Add
base_branchsupport so PRs can target a parent task's branch instead of the repo's default branch. This enables true stacked PRs where PR #2 targets PR #1's branch.Context
Today, all PRs implicitly target
main(or whatever the default branch is). Prompts tell the agentgh pr create --draftwithout specifying--base. For stacked workstreams, PR #2 needs to target PR #1's branch so it only contains its own diff.Changes
persistence.pybase_branchcolumn added as part of schema v9 (done in Schema: parent_task_id, epic_id, base_branch, upstream_sha columns #55)_TASK_COLUMNSfrozenset (done in Schema: parent_task_id, epic_id, base_branch, upstream_sha columns #55)prompts.pygh pr createadd--base <base_branch>when base_branch is setgit diff <base_branch>instead of hardcodedmaingithub_api.pyget_default_branch()—gh repo view --json defaultBranchRef --jq .defaultBranchRef.name, cachedfind_pr_for_branch()to optionally verify the base branch matchesorchestrator.pyOrchestratorreadsbase_branchfrom task recordget_default_branch()when base_branch is NULL_do_update_description()to use base_branch instead of hardcodedmainforgit diffcli.pycmd_startaccepts--baseflag for manual stacked PR supportDepends On
base_branchcolumn)Testing
--base <parent_branch>when base_branch is set--basewhen base_branch is NULL (targets default branch)get_default_branch()caches correctly_do_update_description()uses base_branch for git diff