fix(gateway): PR base/target is the parent task's branch, not derived

submit_up opened the cell->root PR with a base computed by
merge_chain.parent_branch_for, which drops the last --segment but
REUSES the child's team prefix. Across a team boundary (cell
feature/backend/ROOT--CELL -> root feature/main_pm/ROOT) that yields a
ref that does not exist on the remote, so GitHub rejects the PR with
422 base: invalid and the cell parent wedges.

Resolve the base/target from the parent task's authoritative
branch_name (what branch creation already cuts each child from), via a
shared VerbRunner._parent_branch_for helper used by _do_create_pr and
_do_pr_merge. Falls back to parent_branch_for only when there is no
parent (root->master -> master) or it has no branch yet. The leaf->cell
path is unchanged (same team). Latent since the merge chain landed;
first run to reach cell-PM bubble-up exposed it after #180.
This commit is contained in:
Renn F
2026-05-23 04:14:12 +02:00
parent c78395f9fc
commit 32b6b31dd6
4 changed files with 82 additions and 5 deletions
@@ -890,6 +890,7 @@ async def test_submit_up_opens_pr_and_reassigns_to_main_pm() -> None:
id=task_id,
status="in_progress",
assigned_to=pm_id,
parent_task_id=None,
branch_name="feature/backend/abc123",
team="backend",
)
@@ -897,6 +898,7 @@ async def test_submit_up_opens_pr_and_reassigns_to_main_pm() -> None:
id=task_id,
status="awaiting_pm_review",
assigned_to=pm_id,
parent_task_id=None,
branch_name="feature/backend/abc123",
team="backend",
)