Repository navigation
Conversation
…udget The hive-wide merged-history search behind contributor-lane auto-promotion (hivecommons#14517) ran for every open PR by an author on every sweep, and also for `[bot]` authors, which can never be promoted. On a 19-repository hive that is 3–4 search/issues calls per PR, and it tripped GitHub's search secondary rate limit five times in one evening on a production hive, sending the whole hive into its rate-limit caution window each time. - Exempt `[bot]` logins from auto-promotion: a bot is trusted only through the trusted bot authors setting, never by counting its merges. - Cache each (repository, author) answer for ten minutes, mirroring the maintainerPerm cache; a failed search is not cached. Fixes hivecommons#15088 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SnzFs53Qcer1xDySyxv1Vj Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Superseded by #15090 (Karibhou), which fixes the same two causes and fits how the hive runs better: production calls the one-shot |
Fixes #15088
Summary
On the projectbluefin hive (19 repositories), GitHub's search secondary rate limit tripped five times on 2026-10-28 (17:22, 18:56, 19:43, 20:00 and 20:17 UTC), and two of those were nowhere near a restart. Every trip started with the same call, from the hive's log:
Each trip put the hive into its rate-limit caution window, which shed the automerge sweeps and the dashboard refreshes. The Overview snapshot stayed at 19:59:45Z through the 20:17Z window.
The call comes from the hive-wide merged-history check that #14517 added to contributor-lane auto-promotion:
admitContributor(automerge_contributor_lane.go:629) runscontributorCleanMergedHistoryfor every author the claim path does not admit, bots included. A[bot]login can never hold a registry tier.contributorMergedRepos(:808) chunks the hive's repositories into the 256-characterqlimit: 3–4Search.Issuescalls per PR on a 19-repository hive, repeated for every open PR by the author on every sweep. Nothing was cached.Changes
contributorAutoPromotionExempt:[bot]logins (which includes the hive's own App) are exempt from auto-promotion. A bot is trusted only through the trusted bot authors setting. Without this, a workflow bot such asgithub-actions[bot]could in principle be promoted totrustedby merge count alone once the search succeeded, which bypasses that explicit setting. That is from reading the code; it was not observed in production.contributorMergedReposcaches the search answer forcontributorMergedReposTTL(10 minutes), modelled on the existingmaintainerPermcache (automerge_contributor_adopt.go): the lock covers map access only, expired entries are pruned on write, and a failed search is not cached (it degrades to the PR's own repository exactly as before). The query itself is unchanged; the search is split out intosearchContributorMergedRepos.changelog.d/fixed-15088-autopromo-search-budget.md.Merged history only grows, so a cached answer can at most delay a promotion by one window.
Tests
TestContributorAutoPromotionSearchBudget(fake GitHub counting search calls):github-actions[bot]PR with nine merges elsewhere makes 0 searches and is not promoted;TestContributorAutoPromotionExemptcovers the login check.Against the unpatched v6 code, the bot and cache cases fail (
searches = 1, want 0andsearches = 3 … want 1). With the change,go test ./pkg/github/automerge/passes, and the existingTestTrySweepContributorLanePRAutoPromotion*cases are unchanged and green.gofmtandgo vetare clean.Out of scope
forgestate/counts.go:388) and was not the first failing call in any of the five trips.🤖 Generated with Claude Code
https://claude.ai/code/session_01SnzFs53Qcer1xDySyxv1Vj