Skip to content

The Merge Gate Does Not Notice a Target Branch That Moved Since the Checks Ran #4455

Backlog

Description

@ptr727

A finding about the hub's merge gate, filed from a session in a downstream repository.

The Gap

pr-review-conduct's Merge Gate and scripts/pr_review.py status judge a pull request at its own head: checks green, threads resolved, a review covering the head, and a clean merge state. None of them asks whether the target branch has moved since those checks ran. On a squash-only develop with no rule requiring a branch to be up to date, two pull requests that are each at the gate can merge back to back and leave develop failing, with no file conflict to warn of it.

A Constructed Case

  • Pull request A renames a label a block prints, and updates the tests that read it.
  • Pull request B, opened before A merged, adds a new test that finds that block's line by the old label.
  • Each passes its checks against the develop it was opened on. They touch different files, so GitHub reports both as clean.
  • A merges. B's checks are not run again, its merge state stays clean, and status still reads it as at the gate. B merges, and develop now fails B's new test.

An orchestrating session that batches merge go-aheads meets this more often than a single driver does, since it holds several pull requests at the gate at once.

What Could Close It

  • pr_review.py status could compare the pull request's base commit with the target branch's head and say so where the target has moved since the checks ran, as an advisory line or a distinct exit.
  • The Merge Gate text could say that a pull request sharing a module with one merged since its checks ran is rechecked against the new target first, by a merge of the target and a fresh check run.
  • backlog-burndown and drive-pr could say that a batch of merges into one branch is taken one at a time, with the next pull request's state read again after each.

Requiring branches to be up to date in the ruleset would close it mechanically, at the cost of a rebase and a fresh review round per merge, which the fleet may not want.

Activity

  1. ptr727 commented on Nov 25, 2026

    @ptr727
    OwnerAuthor

    Question for the maintainer (backlog-burndown planner, away mode, 2026-11-25, round 1). This issue lists several ways to close the gap without choosing one, and the committed rules do not choose for it. One option is also a ruleset change. So the away run labels it decision and holds it.

    Question: how should the fleet stop two pull requests that are each at the Merge Gate from merging back to back into one branch and leaving it failing, when the target moved after the second one's checks ran?

    Options, recommended first:

    1. An advisory in pr_review.py status, plus one-at-a-time batch merges (recommended). status compares the pull request's base commit with the target branch's head and prints a line when the target has moved since the checks ran. backlog-burndown and drive-pr say a batch of merges into one branch is taken one at a time, with the next pull request's state read again after each merge. This covers the batching case the issue names, where it happens most, without a rebase and a fresh review round on every merge. The advisory does not block a merge by itself.
    2. Option 1, plus a Merge Gate recheck. The pr-review-conduct Merge Gate also says a pull request whose target moved since its checks ran is rechecked first, by merging the target in and running the checks again. It is stricter than option 1, at the cost of an extra check run, and sometimes a review round, whenever the target moved.
    3. Require branches to be up to date in the ruleset. This closes the gap mechanically on every repository it is applied to. Each merge then needs an update and a fresh check and review round. It is a ruleset change, so repo-config/ and every repository's applied ruleset change with it.
    4. Leave it as it is, and accept that a back-to-back merge can occasionally break the target until the next fix lands.

    Nothing in flight is parked on this, and no pull request is blocked by it. The files the fix touches include scripts/pr_review.py, .agents/skills/pr-review-conduct/SKILL.md, .agents/skills/drive-pr/SKILL.md, and .agents/skills/backlog-burndown/SKILL.md. The last is held by the parked group on burndown/burndown-owed-actions-holds (decision #4454) until that group merges.

  2. added
    decision
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions