Repository navigation
Conversation
With `spare` set, while a red candidate of several pull requests on the trunk has its first round running, the chain takes one slot fewer, so those the round clears are pushed in the tick it reads. The round's read ends the hold whatever it says, as does the red candidate going; a round that never reports reads as lost after the timeout. The same read ends the wait for probes beside a candidate stacked on the red one. Off unless set. Nothing that decides who is a suspect or who leaves changes: only fill's slot count and the stacked candidate's wait.
The shorter wait beside a candidate stacked on a red one changed who leaves: where #3 repairs what #2 breaks, it built #1 and #3 beside the candidate of all three, and #3 left on that build's own fair test where the stacked candidate would have landed all three. The chain waits for the probes as it did before, and spare is the slot hold alone. The hold is a limit: fill uses one slot fewer while the first round of a red candidate of several pull requests on the trunk runs. Gather may still hold a cleared pull request back, a landing or an ejection in the tick ends the plan before fill, and where the timeout is zero a round that never reports holds the slot while the red stands. Tests: the repairing pull request lands with the stacked candidate, with spare and without; a suspect a later arrival repairs leaves on the old trees without spare and lands on the new trunk with it; a cleared pull request alone waits under gather; the hold under a zero timeout; a flake of whole-build rounds lands the cleared first on as many builds, and one of probes builds the same with spare as without.
The hold needs two slots or more and a red candidate built on the trunk's tip, and ends when the trunk moves past that base as well as when the round reads or the red goes: the docs now say so. Blame says the chain waits for a pending stacked candidate after the first round has answered, which is what the planner does. In the repair sequence a candidate of #1 alone now builds slowly, so a planner that built #1 and #3 beside the stacked candidate would take #3 out at tick 9 before #1 could land and drop the evidence.
There was a problem hiding this comment.
🔵 Needs a closer look
The merge-gating 27 Nov simulator score is still pending, requiring human review of the scheduling change’s latency, throughput, and suspect-retesting trade-offs against the charter.
No open issues 🎉
What changed in this PR
Adds an opt-in spare setting to Banyan’s merge queue, leaving capacity for pull requests cleared by a failed candidate’s first diagnostic round. The setting is off by default.
Changes:
- Fills one fewer candidate slot during qualifying first rounds when at least two slots are configured.
- Adds regression tests for slot release, scheduling interactions, flakes, and repairing pull requests, plus invariant checks with
spareenabled. - Documents the setting’s limits and clarifies existing stacked-candidate behavior.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
| README.md | Introduces the spare setting and its purpose. |
| internal/run/run.go | Passes spare from runtime configuration to the planner. |
| internal/queue/world.go | Adds the queue’s Spare configuration field. |
| internal/queue/plan.go | Reduces slot filling during qualifying first rounds. |
| internal/queue/plan_test.go | Adds tick-by-tick scheduling and regression coverage. |
| eval/check_test.go | Checks planner invariants with spare enabled. |
| doc/design.md | Explains slot reservation, release conditions, and existing blame behavior. |
Review effort: Balanced
|
🤖 Held, not to merge: an outside read of this diff found that What the read found, each traced by hand from the code and not yet run:
With The first two are changes to what takes a pull request out, which this pull request said it did not make. #19 is stacked on this and waits with it; the read's four notes on the checker are on #19. |
|
🤖 The three worlds above are now run, as tests on a scratch branch off this head (not pushed; the planner untouched). Each asserts the whole trace for both settings and, at every take-out, whether the trunk at that tick plus the pull requests ahead plus the one taken out passes.
Two things the run adds to the reading:
So |
|
🤖 Closing this unmerged. The branch stays; nothing here is lost. Each option was argued at its strongest and then attacked, with one outside read of both diffs, and the benefit was measured at its most generous. What
A pull request cleared after a red candidate has already waited a build, so the saved slot wait never brings one under 30 minutes, and the one day p90 moves it stays seven times its target. What it costs. The three worlds in the comments above stand: it takes out a pull request the trunk would pass with (where probes are as slow as a build), and it makes reachable, on a schedule that drains today, a red trunk that never recovers. It also removes one wrong take-out today's planner makes. Those are changes to who is taken out, for a wait that does not move a charter figure. The strongest case for keeping it was a narrower hold: only once the round's bare-trunk probe has passed. That excludes both bad worlds and gives up every case where the last slot fills before that probe answers, so it saves less than the table above. What would reopen it: recorded days where that narrower hold takes 5% or more off the day's p90, or brings landings under 30 minutes. The checker work stacked on this (#19) does not need the setting: three of its tests name |
Context
When a candidate on the trunk fails, its first round of probes clears every pull request outside the suspects, and they are free to be built again. Meanwhile the chain goes on taking free slots for newer pull requests, so those the round clears often find every slot taken. In one queue's records, 16 to 24 Nov, pull requests cleared by a round and then waiting for a build spent 526 pull-request minutes so, 346 of them with every slot taken; in one episode on 25 Nov seven waited 25 minutes after the last slot went to two newer ones, two minutes before the round read.
Action
One setting,
spare, off unless set. With it, whereslotsis two or more, while a red candidate of several pull requests built on the trunk's tip has its first round running,filluses one slot fewer. It is a limit on the slots the chain fills, not a push:gathermay still hold a cleared pull request back, and a landing or an ejection in the tick ends the plan beforefill. The round's read ends the hold whatever it says, as does the red candidate going or the trunk moving past its base; a round that never reports reads as lost aftertimeout, and wheretimeoutis zero only those end it.read,judge,weigh,suspects,stackedOn, the rounds and their probes are as they were: against main the planner's diff isclearingand the slot count infill.Decision
Draft: it merges after the simulator's score of 27 Nov.
The first commit also ended the wait beside a candidate stacked on the red one once the first round had read. A review showed that changes who leaves: where #3 repairs what #2 breaks, the chain built #1 and #3 beside the candidate of all three, and #3 left on that build's own fair test where the stacked candidate would have landed all three. The second commit takes it out, and
TestTheChainWaitsForACandidateStackedOnARedOneWhereItMayLandAllOfThemholds the sequence withspareset and unset. The checker does not model one pull request repairing another, so that test is the only thing that does.A second review found no way of taking a pull request out wrongly that
spareadds. Like any setting that moves when a candidate is built, it can change who leaves where one pull request repairs another: the planner as it stands has that case with other arrival times.What the hold changes beyond the wait it saves, each held by a test:
TestASuspectWalksBackInWhenAPullRequestBelowItLandsBeforeItsFairTestEnds). With whole-build roundssparemakes that likelier: the suspect is built again on the new trunk and leaves a cycle later (TestSpareLetsTheClearedLandBeforeTheSuspectsFairTestEnds), or lands there if a later arrival repaired it (TestASuspectALaterArrivalRepairsLeavesOnTheOldTreesOrLandsOnTheNewTrunk). It lands only on a whole build that passed. With probes a whole build of the cleared pull requests rarely beats the rounds.spareas without (TestWithSpareAFlakeOfWholeBuildsLandsTheClearedFirstOnAsManyBuilds).Outcome
With
spareunset the planner's actions are main's: the existing tests are untouched, and the row for one recorded day is identical to main's but forcommit. The checker holds every invariant withspareset (TestCheckerCurrentPlannerWithSpare: 594,654 states, 0 broken). Replayed from its recording, the tick of 25 Nov 02:23:39Z pushes no candidate withspare, where the live queue pushed its third.