Repository navigation
The merge gate brings the base in itself and names the approval it waits on - #783
Merged
Merged
Conversation
…its on A person's PR armed the gate, conflicted with main, and the gate stopped: the base merge only ran for CoderHelm's own PRs. After a person pushed the resolution, the gate counted only approvals of the head and waited on a review event that never came, saying nothing. - A PR behind or conflicting with its base gets the base merged in by the gate as soon as it is armed, on anyone's PR, once per head, through the runs' conflict resolution; the own-change comparison the reviewer uses decides whether the approval carries. The gate queues CoderHelm's review of the new head itself, labelled PR or not (a push's review, so the earlier approval carries with its review), and arms on the new head. Only an unresolvable conflict or a fork is reported, once, with the files. - The person key follows GitHub's reviewDecision; with no rule, an earlier approval counts when the PR's own change is unchanged since. - A wait on a person names what is missing (a dismissed approval and the commit that dismissed it, the required count, who was asked) on the run page, the status comment and once in the team's channel. - Waiting on people re-reads every 15 minutes for a day.
nambok
force-pushed
the
fm/coderhelm-merge-gate-keeps-current
branch
from
November 18, 2026 23:00
70d3150 to
53dbdde
Compare
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
A person approved someone's PR and the auto-merge gate armed. Three seconds later it found the PR conflicting with main and stopped (
updating:false): the gate only brought the base in on CoderHelm's own PRs with a run. After a person pushed the conflict resolution and CoderHelm approved the new head, the gate stopped again "waiting on approvals": it counted only approvals of the head commit, though GitHub still counted the person's approval of the earlier one. It waited on a review event that never came and told nobody. The person had to dismiss their approval and approve again.Root causes (on main):
services/worker/src/passes/await_merge.rs:1540:let updating = msg.self_authored && .... A person's PR never got the base merge; the gate stopped.services/worker/src/passes/await_merge.rs:313:v.approvals.human_key_at_head(). Only approvals of the exact head counted, ignoring GitHub's own required-review rule.services/worker/src/passes/await_merge.rs:1301-1310:WaitForPeoplereturnedNext::Stop. Only a webhook could wake it, and the status comment was posted only on labelled PRs.Changes
needs_base,keep_current,bring_base_in). When GitHub reports the PRdirtyorbehind, the gate merges the base in as soon as it is armed. This happens before approvals are read, so where the rules dismiss approvals on push, the update lands before a person approves. It also runs when GitHub declines the merge for that reason. It runs once per head (claim_base_update) and uses the runs' conflict resolution (pr::resolve_conflicts). It compares the PR's own change before and after with the reviewer's comparison (review_scope::same_own_change), records the base merge, and queues CoderHelm's review of the new head itself, whether or not the PR carries the review label (review_pr::review_after_base_merge). That is a push's review keyedhead#<sha>like the gateway's, so a labelled PR is reviewed once, and it takes the carry-forward path from A carried approval carries the review it rests on, and that review stays in sight #781: when the PR's own change is the one approved, the earlier approval is carried with the review it rests on. The gate never waits on a review it caused. It then arms itself on the new head. There the review carries the approval or reviews what moved, CI runs, and the keys are read again. On CoderHelm's own PR with a run, the run's conflict round still does it. Only a conflict it can't resolve, or a fork it can't push to, is reported, once, with the files, on the PR and in the team's channel.person_key). It reads the PR'sreviewDecision:APPROVEDkeeps a person's approval of an earlier commit, andREVIEW_REQUIREDorCHANGES_REQUESTEDis never outvoted. When the branch has no required-review rule, an approval of an earlier commit counts when the PR's own change is unchanged since it.missing_person_line). It names a dismissed approval and the commit that dismissed it (including CoderHelm's own base merge). It also names the branch's required count, read from classic protection and rulesets (review_rules), with a note that CoderHelm's approval doesn't count toward it, plus an approval of an earlier commit and who was asked. That line is the record's detail on the run page, goes in the PR's one status comment (edited in place, now also on unlabelled PRs when a person's approval is involved), and goes once per commit to the team's channel (tell_team).recheck_people): every 15 minutes for a day, bound to the chain. A missed webhook can't strand the PR, and the CI window restarts when the keys are in.GitHubClient::branch_protectionandpr_review_decision(a GraphQL read).Approvalsgainsapproved_onanddismissed.mx_gate_keeps_the_branch_current(doc and replay test).Verification
cargo fmt --all -- --checkclean,cargo clippy -p worker --all-targets -- -D warningsclean.cargo test -p worker: 2301 passed, 0 failed (rebased on main after Code map kept current, criteria traced to proof, non-functional checks in plans #780, A carried approval carries the review it rests on, and that review stays in sight #781, Every team AWS read is made as the team's role #782).incidents::mx_gate_keeps_the_branch_currentreplays the timeline. The conflict on a person's PR is brought in, not stopped on. Reviews that land together (a person's approval and CoderHelm's approval of a later head) with GitHub'sAPPROVEDnow read CI and merge, where main waited. A dismissed approval is named with the commit. The required count is named. Waiting on people re-reads on a timer. After the gate's own base merge on an unlabelled PR, the review of the new head is queued as a push review, takes the carry-forward path, carries the approval, and the gate merges. On main the case doesn't compile: none of the gate's base merge,person_key, the named wait or the timer exist there.