Add a kill switch, an auto-merge switch and an hourly cap to Bellwether (#3779)
- Add a kill switch, an auto-merge switch and an hourly cap to Bellwether
Three repository variables control it: BELLWETHER_ENABLED=false stops the
workflow entirely; merges after the grace period, with no maintainer's
go-ahead, happen only while BELLWETHER_AUTO_MERGE is "true"; and at most
BELLWETHER_AUTO_PER_HOUR of those (default 2) land in any hour, so a
backlog doesn't flood everyone's notifications at once. Merges a
maintainer asks for with /merge aren't capped.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
- Remove a stray bytecode file
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
- Keep Bellwether's hourly cap under concurrent runs
Merges after the grace period now happen only in a sweep. Sweeps share
one concurrency group, so they never overlap; comment runs for different
PRs can, and two of those could both see room under the cap and both
merge. A sweep counts the last hour's merges once, when the first merge
comes due, then counts each merge it asks for, so several PRs coming due
in one sweep can't exceed the cap either.
recent_merges pages through closed PRs until one was last updated before
the cutoff, instead of reading only the 30 most recently updated, so a
burst of activity on old PRs can't hide a recent merge.
A BELLWETHER_AUTO_PER_HOUR that isn't a whole number falls back to the
default with a message instead of crashing every run at import.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
- Keep sweeps from being displaced, and say when a due PR waits for one
CI completions get a concurrency group per commit instead of sharing the
sweep's, so a later one can't replace a pending sweep and cost an hour of
grace-period merges.
A due PR that a comment run leaves for the sweep, or that a sweep holds
back at the cap, now says it's ready and waiting for the hourly check,
rather than keeping whatever the comment said before (such as "On hold"
after an /unhold). A merge already under way is left alone. A dry-run
sweep counts the merges it would make.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
- Show the waiting line only for PRs that could merge now
A due PR now goes through the live checks (draft, CI, main drift,
conflicts) before it's told it's waiting for the hourly check, so one
with failing CI says so instead. The guard that leaves a Merging line
alone moves into set_next, which checks the comment it's about to
rewrite rather than an earlier read. A dry-run sweep adds merges it
simulated before counting the hour's merges. Drops a bytecode file the
merge from main brought back.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
- Say grace-period merging is paused when the hourly cap is 0
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com