Skip to content

[RFC] Enable Merge Queues #3606

Open
Open

Description

@Swiddis

Problem Statement
Inspired over the past year by Tyler Cipriani's post and using them on other projects: we currently don't have any post-merge protection for our branch. This causes issues with merge skew: two colliding PRs can cause a failing main branch (while passing individually).

Merge queue example: without queues, branches A and B may pass but A+B fails. With queues, B will be tested as A+B instead.

Current State
Because we don't have this protection, we're pretty regularly susceptible to main breaking due to external factors or collisions. If we wanted to be safe, we would need to effectively manually do the same thing as a merge queue: rerun tests right before merging. When we do this, it causes a lot of time to be spent waiting synchronously on CI.

It also means that there's a natural incentive to "just merge," and ignore CI entirely. It's up to maintainer discipline whether the tests always pass or not.

Proposal
We can enable merge queues for our repos (sql and opensearch-spark). Doing this will:

  • Enable us to more confidently merge PRs while protecting the main branch.
  • Speed up merging: the queue can be run in parallel.
  • Guarantee that main is always passing tests.
  • Incentivize fixing flaky tests, as these will have a greater visible impact in the queue.
  • Prevent instances of accidentally merging PRs with failing tests.

The primary drawback is: the queue can get blocked if tests start failing for unrelated reasons (e.g. dependency change). It's up to the team whether we want to prioritize always passing tests, or avoiding the inconvenience of waiting on patches for upstream breakage. There's a permissions role that lets you override the merge queue in an emergency. (There are other shortcomings of GitHub's implementation, but I generally don't consider them significant enough to block implementing this.)

Implementation Discussion
We submit a request to the Org's .github. From there, all we need to do is add a merge_group: trigger to relevant CI actions (most obviously the tests, possibly other actions too). Then the queue will be active for all merged PRs.

Activity

  1. added
    RFC
    on May 6, 2025
  2. RyanL1997 commented on May 27, 2025

    @RyanL1997
    Collaborator

    Merge queue may be blocked by unrelated external test failures (e.g. Sonatype outage).

    To me I think this should not be a frequently happening scenerio, however, still curious: how often you think we’d need to override the queue due to external failures?

  3. Swiddis commented on May 27, 2025

    @Swiddis
    CollaboratorAuthor

    I don't expect it to be frequent at all, honestly... I can think of one Sonatype outage over the past 3 years and it was only a few hours.

  4. added
    infrastructure
    on May 29, 2025
  5. gaiksaya commented on Sep 18, 2025

    @gaiksaya
    Member

    I was going through the documentation for merge queues and came across this paragraph:

    Once a pull request has passed all required branch protection checks, a user with write access to the repository can add the pull request to the queue. The merge queue will ensure the pull request's changes pass all required status checks when applied to the latest version of the target branch and any pull requests already in the queue.

    As of now the only "required status check" we have is code owner approval unless #4205 is enabled workflow by workflow.

  6. Swiddis commented on Oct 7, 2025

    @Swiddis
    CollaboratorAuthor

    As of now the only "required status check" we have is code owner approval unless #4205 is enabled workflow by workflow.

    This is poor wording from the GH docs, the required checks for merge queues are defined by the merge_group trigger in the workflows. They aren't the same as the global "required checks" setting for the repository. (If it also checks those, that's in addition to the merge group checks.) This allows devs to own their own required checks.

    We have these enabled since a while ago.

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

    RFCinfrastructure

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions