Commit ef0321a
fix(ci): drain the merge queue oldest-first, not newest-first (#275)
`gh pr list` returns newest-first, and the sweep merges the first eligible PR
then stops. So the newest green PR wins every sweep, and an older one can wait
indefinitely.
Observed in maonakamoto/fleetcrown on 2026-08-06: two consecutive sweeps merged
the two newest PRs while three older green ones sat untouched and were never
even evaluated. With several agent sessions opening PRs continuously that is
starvation — and it starves the worst candidate, since the longest-waiting PR
is the one whose checks were proven against the most now-stale base.
PR numbers increase monotonically with creation, so sorting ascending is FIFO.
The ordering was never a decision, just whatever gh happened to return.
Fixed upstream first (fleetcrown #182) and verified in production there: the
sweep immediately after it landed correctly took the oldest open PR rather than
the newest. This is that one-line change, applied to the fleet.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 3e0b81b commit ef0321a
1 file changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
102 | 111 | | |
103 | 112 | | |
104 | 113 | | |
| |||
0 commit comments