ADR-3610: Admit fork pull requests to the merge queue at the reviewed head¶
- Status: Accepted; supersedes in part ADR-3556 (Decision bullet 1, queue admission)
- Date: 2026-11-22
- Deciders: Project maintainer
- Tags: ci, fork-local
Context¶
ADR-3556 wired Required Checks Aggregator and its feeding workflows onto merge_group for the master merge queue while restricting queue admission to pull requests whose head branch lives in vidiko/vmafx. Under that interim rule, Train.guard in scripts/dev/merge_train_guard.py refused every cross-repository pull request (cross-repository PRs require an explicit owner), so a fork contribution could enter the queue only if a maintainer re-pushed it onto an in-repository branch or held it outside the queue.
Direct queue admission for a fork pull request is safe only when the enqueue is pinned to the exact head SHA a listed maintainer reviewed and approved, with CLEAN merge state, passing required checks, and a valid squash commit message, and when no pending auto-merge request can enqueue a later unreviewed push on that pull request.
Decision¶
Admit fork pull requests directly to the master merge queue only at the exact head a listed maintainer approved, keeping same-repository merge-train rules unchanged:
- Fork pull requests enter the queue only after
python3 scripts/dev/merge_train_guard.py admit-fork <n> --reviewed-head <sha> --state-dir <dir>returns0, and only throughgh pr merge <n> --match-head-commit <sha>(orexpectedHeadOidon the GraphQLenqueuePullRequestmutation) pinned to that same head. - Do not arm GitHub auto-merge (
--auto) on fork pull requests: a pending enqueue could land a later head pushed after the admission verdict without a fresh review and verdict. - Keep
PAUSED,hold.txt, and the release pull request (#1213) holds in force onadmit-fork. - Keep
Train.guardand every merge-train action (inspect,cycle,promote,rebase,arm,merge) refusing cross-repository pull requests (cross-repository PRs require an explicit owner);admit-forkis read-only, refuses--apply, never callsgh pr merge, never pushes, and never writes state. - Declare eligible maintainer GitHub logins in
policy.jsonunderfork_reviewers. Among decisive reviews (APPROVED,CHANGES_REQUESTED,DISMISSED;COMMENTEDandPENDINGare ignored), take the latest review bysubmittedAtfor each login infork_reviewers: at least one must beAPPROVEDwithcommit.oid == <sha>, and none may beCHANGES_REQUESTED. Dismissed approvals and approvals from logins outsidefork_reviewersnever count. - Run
python3 scripts/dev/merge_train_guard.py queue-audit --state-dir <dir>after enqueueing to re-check every cross-repository entry inmergeQueue(branch: "master")against its liveheadRefOidand thefork_reviewersapproval rule (the entryheadCommitis the squash commit GitHub builds, never the pull request head, so it is not requested); the operator removes any failing entry from the queue at once.
Alternatives considered¶
| Option | Pros | Cons | Why not chosen |
|---|---|---|---|
Option a: admit fork pull requests at the reviewed head after merge_train_guard.py admit-fork returns 0, enqueue with --match-head-commit and no auto-merge, and re-check with queue-audit | Preserves contributor pull requests, attribution, and review threads; binds admission to a maintainer-approved commit SHA, CLEAN merge state, green required checks, and squash message validation | Requires explicit operator enqueue without --auto plus post-enqueue queue-audit | Chosen; admits fork pull requests directly while keeping exact-head review binding and existing merge_group barriers |
| Option b: maintainers re-push fork changes to an in-repository branch or open replacement pull requests | Keeps every merge_group ref restricted to in-repository branches | Closes or supersedes contributor work, splits review history, and adds manual branch duplication | Rejected: closes or supersedes contributor work |
| Option c: hold every fork pull request outside the merge queue | Needs no guard, policy or documentation change | Blocks external contributors indefinitely once master requires the merge queue | Rejected as a standing rule; it was the interim until this change landed |
Consequences¶
- Positive: External fork pull requests can enter the
mastermerge queue directly without replacement branches, gated by exact-head maintainer approval infork_reviewers,CLEANmerge state, passing required checks, and squash commit message validation (scripts/dev/tests/test_merge_train_guard.py). - Security boundary: A merge group can now carry a fork diff. The provenance guard in
.github/actions/runner-probe/action.yml(scripts/ci/merge_group_provenance.py) writessame_repo=falsefor such a group and hardware probes do not run, so the second barrier of ADR-3556 stays in place unchanged; while a hardware lane switch (SYCL_ARC_RUNNER_ENABLED,GPU_COVERAGE_ENABLED) is enabled (a repository variable, or an organisation variable shared with the repository that no repository variable overrides), a fork group cannot report that context and the aggregator blocks it, soadmit-forkrefuses fork admission with that reason until the switch is off (fail closed; the aggregator gains no provenance exemption). GitHub documents removal from the queue on failing checks, timeout, user removal and unresolvable branch protection failure (docs page "Merging a pull request with a merge queue", section "Understanding why your pull request was removed from the merge queue"); removal on a head push is not stated there, which is whyqueue-auditexists as a second check. - Negative: Fork pull requests cannot use
--autoarming; any new push to the fork branch invalidates the reviewed head and requires a fresh maintainer approval on the new commit beforeadmit-forkcan succeed again. - Neutral / follow-ups: In-repository pull requests continue to use
Train.guardand the existing merge-train actions unchanged (ADR-1244).
References¶
- ADR-3556: Trigger required checks and aggregator on merge-queue merge_group events.
- ADR-1244: Guard merge-train ownership and exact-head validation.
- Local merge-train control.
- CI overview: Merge queue.
- Source: maintainer decision (paraphrased; vmafx-queue-fork-pr-admission, 2026-11-22, fork queue admission): admit a fork pull request only pinned to the exact reviewed head with a recorded review on that head and all required checks green; keep the provenance guard and every hold.