fix(git): serialize concurrent merges to the same parent branch

Two PMs completing different subtasks of the same parent could race
on gh API merge calls. GitHub returns 409 to one but local DB write
ordering wasn't guaranteed. Take row-level lock on parent task before
merge; retry once on 409.
This commit is contained in:
Renn F
2026-05-03 09:38:03 +02:00
parent 3a2498a609
commit 5c742e6aec
3 changed files with 333 additions and 0 deletions
+3
View File
@@ -224,6 +224,9 @@ async def test_pr_merge_returns_merge_commit_dict() -> None:
project_id = uuid4()
fake_task = MagicMock(
project_id=project_id,
# Root task — no parent to lock; concurrency tests cover the
# parent-lock + retry-on-409 paths separately.
parent_task_id=None,
assigned_to=uuid4(),
work_session_id=None,
)