Skip to content

merge-bot-task.yml does not reserve the no-auto-merge- marker, so a caller head-prefix rule can auto-merge a tracker PR that opted out #1128

Closed

Description

@ptr727

What

check-upstream-version-task.yml implements D8.3's auto-merge: false opt-out by prefixing the head branch, and states the guarantee in its own comment:

# .github/workflows/check-upstream-version-task.yml:85
# The head carries a no-auto-merge marker when the caller opted out, so a merge-bot rule can never match it by accident.
# .github/workflows/check-upstream-version-task.yml:135
head="no-auto-merge-${BUMP_BRANCH_PREFIX}-${BRANCH}"

merge-bot-task.yml does not reserve that marker. Its matcher applies startswith to caller-supplied head-prefix rules with no exclusion:

# .github/workflows/merge-bot-task.yml:112
| map(select(.base == $base)
      | select((.head // "") == $head or ((."head-prefix" // "") as $p | $p != "" and ($head | startswith($p)))))

Why the Guarantee Holds Today and Why That Is Not Enough

The four built-in rules are exact head matches (codegen-main, codegen-develop, upstream-version-main, upstream-version-develop), so none of them can match a no-auto-merge--prefixed head. Against the built-ins alone the comment is accurate.

The gap is caller-supplied rules only. merge-bot-task.yml:23 documents {"head-prefix": "<head ref prefix>"} as a supported caller rule shape, and any prefix that a no-auto-merge-… head happens to start with will match. A repo running two trackers, one auto-merging and one waiting for a human, is the case that walks into this: the caller adds a head-prefix rule for the first, and depending on the prefix chosen it can also match the second.

The result is the specific outcome the opt-out exists to prevent: gh pr merge --auto on a bump whose whole point was that a human decides it.

Two Statements Are Stronger Than the Code

  • check-upstream-version-task.yml:85 says "a merge-bot rule can never match it by accident". "Never" holds only for the built-ins.
  • WORKFLOW.md D8.3 says the opt-out "prefixes the head so no merge-bot rule matches it, whatever bump-branch-prefix names". The trailing clause correctly scopes out bump-branch-prefix, but "no merge-bot rule" is unqualified and reads as covering caller rules too.

Either the matcher gains the reservation, or both sentences narrow to say the guarantee covers the built-in rules and that a caller-supplied head-prefix must not be written to match the marker.

Suggested Direction

Not a proposed diff, since this is the hub's call. The two options that would settle it:

  1. Reserve the marker in the matcher. Exclude any head starting with no-auto-merge- before the caller-supplied rules are evaluated, so the opt-out cannot be defeated by a rule at all. This makes the existing prose true as written.
  2. Reject the conflict at validation time. merge-bot-task.yml:99 already validates the rules shape; it could also fail on a head-prefix that a no-auto-merge- head would match, turning a silent wrong-merge into a loud configuration error.

Option 1 is the one that matches what the two sentences already promise.

How This Surfaced

Raised by CodeRabbit against a downstream re-vendor of the D8.3 sentence in ptr727/PhotoCleaner#98, and verified against this repository at main f3b4cc9 (tag 2.0.526) rather than taken from the finding text. Declined downstream and routed here, since neither the matcher nor the tracker is carried into a fleet repo: ptr727/PhotoCleaner#98 (comment)

No fleet repo is currently exposed as far as this resync checked: PhotoCleaner runs no tracker and passes no rules input at all. This is a latent defect rather than an active incident.

Activity

  1. added a commit that references this issue on Sep 3, 2026
    136661d
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions