feat(supersede): close + link the contributor PR on land

When a supersede umbrella reaches COMPLETED (our own PR merged), close-on-land
retires the contributor's PR with a linking thank-you comment:

- TaskService.supersede_umbrellas_pending_close() finds landed umbrellas not yet
  marked closed=1; mark_supersede_pr_closed() records the close (idempotent).
- orchestrator._close_superseded_prs runs in the external-PR poll tick: parses
  the contributor PR# from the umbrella's quick_context and calls
  GitService.close_pull_request(delete_branch=False) — we never touch the
  contributor's fork branch. _parse_supersede_pr is unit-tested.

Completes the supersede flow: CEO authorizes -> fork branch -> Main PM -> cell
-> our PR -> CEO merge -> contributor PR closed + linked. ruff + mypy clean
(279); foundation + gateway suites green (5208).
This commit is contained in:
Renn F
2026-06-16 17:09:38 +02:00
parent 25e6174c04
commit 5511cf6e79
3 changed files with 88 additions and 0 deletions
@@ -51,3 +51,18 @@ def test_pr_author_allowed(
pr: dict[str, object], allowlist: set[str], *, expected: bool
) -> None:
assert AgentOrchestrator._pr_author_allowed(pr, allowlist) is expected
@pytest.mark.parametrize(
("quick_context", "expected"),
[
("external_pr_supersede pr=42 review=abc", 42),
("external_pr_supersede pr=7 review=abc closed=1", 7),
("external_pr_supersede pr=50 review=abc", 50), # not confused by pr=5
("", None),
("no marker here", None),
("external_pr_supersede pr=notanint review=abc", None),
],
)
def test_parse_supersede_pr(quick_context: str, expected: int | None) -> None:
assert AgentOrchestrator._parse_supersede_pr(quick_context) == expected