Skip to content

Use auto merge unless ready to be enqueued in the merge queue#2450

Merged
Urgau merged 1 commit into
rust-lang:masterfrom
Urgau:merge-auto-merge
Jul 3, 2026
Merged

Use auto merge unless ready to be enqueued in the merge queue#2450
Urgau merged 1 commit into
rust-lang:masterfrom
Urgau:merge-auto-merge

Conversation

@Urgau

@Urgau Urgau commented Jul 2, 2026

Copy link
Copy Markdown
Member

As discussed in #2449 (comment), let's use the auto merge functionality when the PR is not yet ready to be enqueued in the merge queue (PR CI still running, ...).

That way PRs that are not yet ready can still be @rustbot merge-ed.

I tested the logic in my fork and it seems to work as expected.

Details image

cc @samueltardieu

@Urgau Urgau requested a review from Kobzol July 2, 2026 20:46
@Urgau Urgau force-pushed the merge-auto-merge branch 2 times, most recently from 4433d43 to 20982ec Compare July 2, 2026 21:22

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mergeable statuses always confuse me :) Not sure if HasHooks is also something that would work for directly enqueuing? We'll see in practice, I guess.

I wonder what happens if you enable auto-merge when the PR is already mergeable? Does it also work? I'd hope it would.. :)

View changes since this review

Comment thread src/handlers/merge.rs Outdated
@Urgau

Urgau commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

I wonder what happens if you enable auto-merge when the PR is already mergeable?

Depends on what you mean by mergeable, if you mean no conflicts, it works, but if you mean CI is green, then no, it gets rejected by GitHub as being already ready (the "clean" state"), and as such we need to enqueue it in the merge queue instead.

@Kobzol

Kobzol commented Jul 3, 2026

Copy link
Copy Markdown
Member

If we could reliably detect that, then we could always try to auto merge, and if that fails, then enqueue. But the current solution of this PR should also work, so fine by me.

@Urgau

Urgau commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

That was my first instinct as well, but GitHub doesn't give us nice error code, only an error message: "Pull request Pull request is in clean status" (yes, there really is a double "Pull request" at the start of the message, not a typo from me).

If you're fine doing some error message matching, we can switch to auto-merge first and if rejected for "clean" then enqueue.

@Urgau Urgau force-pushed the merge-auto-merge branch from 20982ec to 65b8dd9 Compare July 3, 2026 05:38
@Urgau

Urgau commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

Let's go with the mergeable_state check (feels cleaner to me).

@Urgau Urgau added this pull request to the merge queue Jul 3, 2026
Merged via the queue into rust-lang:master with commit 8fe35ac Jul 3, 2026
3 checks passed
@Urgau Urgau deleted the merge-auto-merge branch July 3, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants