Repository navigation
[AUT-4128] mergequeue: dequeue PRs when trigger condition is no longer met - #44
Merged
Merged
Conversation
GitHub webhook events that remove a pull request from the merge queue (auto_merge_disabled, unlabeled, closed) can be missed. Previously,ReadyForMerge only queried review and CI status, so a pull request whose auto_merge_disabled or unlabeled event was dropped remained in the queue and was repeatedly moved back to the active queue on base-branch pushes. Extend ReadyForMergeStatus to include Closed, AutoMergeEnabled, and Labels from the existing GraphQL query, and verify queue eligibility in both evalPRAction and resumeIfPRMergeStatusPositive before updating branches, adding the head label, triggering CI, or resuming suspended PRs.
FranciscoKurpiel
marked this pull request as ready for review
November 9, 2026 10:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GitHub webhook events that remove a pull request from the merge queue (
auto_merge_disabled,unlabeled,closed) can occasionally fail to be emitted or delivered by GitHub. Previously,ReadyForMergeonly queriedreviewDecisionandstatusCheckRollup, so a pull request whoseauto_merge_disabledorunlabeledwebhook was missed stayed in the queue (and was moved back from the suspend queue into the active queue on every push to the base branch).Changes
internal/githubclt: ExtendReadyForMergeStatusandreviewAndCIStatusto queryclosed,autoMergeRequest { enabledAt }, andlabels(first: 100)in the existing GraphQL query.internal/mergequeue:TriggerOnAutomerge,TriggerLabels) and an empty-queue callback when creating aqueue.q.dequeueRequired(status)at the start ofevalPRAction(before approval checks, branch updates, head label updates, or CI triggers) and inresumeIfPRMergeStatusPositive(before resuming a suspended PR).pending, and dequeue PRs that no longer satisfy the enqueue trigger while resetting commit status topending.q.suspendedlookup inresumeIfPRMergeStatusPositivewithq.lock.AUT-4128