fix(gateway): root PR base resolves the project's env ladder, not literal master

A parentless root's PR base / merge target now resolves through
resolve_parent_branch to the project's panel-configured head rung —
submit_root passed a hardcoded 'master', which on a main-default repo made
_ensure_base_on_remote silently create a spurious master branch and land
the assembled root PR there. Literal master survives only as the
no-project string-derivation fallback.
This commit is contained in:
Renn F
2026-07-18 16:41:17 +02:00
parent 99224e65cd
commit 6a30cca4af
4 changed files with 38 additions and 9 deletions
+4
View File
@@ -363,6 +363,7 @@ async def test_runner_forwards_actor_agent_id_to_create_root_pr() -> None:
task_svc.submit_for_review = AsyncMock(
return_value=MagicMock(status="awaiting_pr_review")
)
task_svc.project_default_branch_for_task = AsyncMock(return_value="main")
git_svc = AsyncMock()
git_svc.create_pr = AsyncMock(return_value={"pr_number": 7})
runner = VerbRunner(task_service=task_svc, git_service=git_svc)
@@ -381,6 +382,9 @@ async def test_runner_forwards_actor_agent_id_to_create_root_pr() -> None:
assert git_svc.create_pr.call_args.kwargs.get("is_root_pr") is True
assert git_svc.create_pr.call_args.kwargs.get("actor_agent_id") == agent.id
assert git_svc.create_pr.call_args.kwargs.get("parent") == "main", (
"root PR base must be the project's head rung, not a literal master"
)
@pytest.mark.asyncio