Repository navigation
fix: never supersede a concluded backport approval check from the opened event - #424
Merged
Merged
Conversation
…ned event The opened-event handler decided whether to re-queue the backport approval check from the check-run snapshot it took at the top of the handler. For a manual backport that snapshot is minutes old by the time the verdict is evaluated, because the handler runs the manual-backport bookkeeping (labels, comment, reviewer requests) first. In that window the labeled deliveries for the same PR concluded the run 'Not Required', so the stale 'not completed' snapshot let queueBackportApprovalCheck supersede the concluded run with a fresh queued one that no follow-up event ever completed (electron/electron#53332). - queueBackportApprovalCheck takes a supersedeCompleted option; callers that only need a pending run to exist pass false, and a run that concluded in the meantime is left alone. The decision is made against the live run right before the write, not against the caller's snapshot. - The stay-pending path on opened is limited to trop-authored PRs, whose labels arrive from backportImpl in a separate delivery. A manually opened backport is labeled by updateManualBackport in the same handler before the live labels are read, so its verdict is already settled and it concludes immediately.
VerteDinde
approved these changes
Aug 31, 2026
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.
Fixes the stuck "Backport Approval Enforcement" check on electron/electron#53332.
That PR ended up with five approval check runs on the head SHA. The four from the labeled/unlabeled deliveries all concluded "Not Required" within a minute of the PR opening. The fifth was created at 15:59:41Z by the
openedhandler and never completed, because theopenedhandler is always the slow one for a manual backport (it runsupdateManualBackportfirst, which is what writes the labels in the first place). By the time it got to the approval verdict, its check-run snapshot from the top of the handler was two minutes stale, still saidqueued, and so the #423 guard letqueueBackportApprovalChecksupersede the already-concluded run with a fresh queued one. Nothing fires after that, so it sits there forever. This isn't the reordering edge case #423 was defending against, it's the normal ordering for a manual backport.Two changes:
queueBackportApprovalChecktakes{ supersedeCompleted }. Callers that just need a pending run to exist passfalse, and if the live run concluded in the meantime it's left alone. The decision is made against the re-fetch right before the write instead of the caller's snapshot. Both the "ensure a run exists" call at the top of the handler and theopenedstay-pending path use it; thebackport/requestedpaths keep superseding, which is the #53035 fix.openedis now only for trop-authored PRs, where the labels really do arrive from a different delivery (backportImpl). A manually opened backport gets labeled byupdateManualBackportin the same handler before the live labels are read, so the verdict is already settled and it concludes right there, no labeled event needed.Tests: reworked the #423
openedspecs for the trop-authored case, added the manual-backport case from #53332, and coveredsupersedeCompleted: falseinchecks-util.spec.ts.