Skip to content

🐛 [v6] contributor-lane auto-promotion runs hive-wide searches per PR (bots included, no per-author memo) and trips GitHub's search secondary limit #15088

Closed

Description

@Danathar

Target: v6.

Summary

On a 19-repo hive, the contributor-lane auto-promotion check runs hive-wide Search API queries for every non-admitted PR author on every automerge sweep: bots included, nothing cached between PRs by the same author. It trips GitHub's search secondary rate limit, and the hive then sheds all low-priority REST work (automerge sweeps included) for the caution window. On hosted-projectbluefin-knuckle-gjvq this happened four times on 2026-10-28 (17:22, 18:56, 19:43, 20:00 UTC). Before #15050 each trip cost ~70 minutes with zero merges; with #15050 it is ~11 minutes, but it still recurs.

Evidence

The first failing call in every trip is this one (hive log, warn, 2026-10-28):

contributor-lane auto-promotion repo search failed; counting the PR's repository only
repo=projectbluefin/utah-packages author=github-actions[bot]
GET .../search/issues?q=is:pr is:merged author:github-actions[bot] repo:projectbluefin/website ... 403 You have exceeded a secondary rate limit

followed within ~2 s by 403 API secondary rate limit exceeded until … on unrelated REST calls (pulls/761, collaborators/…/permission, labels, commits/…/status) and github pacing: low-priority work shed … caller=automerge:self-authored-sweep.

The author is github-actions[bot] (utah-packages#763, a workflow-opened bump PR). A [bot] login can never hold a registry tier, so the search can never promote it.

Code (at 079541810)

  • src/pkg/github/automerge/automerge_contributor_lane.go:629-630: admitContributor calls contributorCleanMergedHistory for every author the claim path did not admit, with no [bot] exclusion.
  • :728 contributorCleanMergedHistory: lists the PR's own repo, then, when hiveWide and short, calls contributorMergedRepos (:756).
  • :808 contributorMergedRepos: chunks repo: qualifiers into the 256-char q limit, so a 19-repo hive costs 3–4 Search.Issues calls (:837) per PR evaluated. The result is not memoized, so N open PRs by the same author cost N × 3–4 searches per sweep.

The Search API's secondary limit is far lower than the core quota (core sat at 87% remaining during the 17:22 trip).

Proposed fix

  1. Skip auto-promotion evaluation entirely for [bot] logins (and the hive App). They cannot be promoted, and automerge_review_gate.go:335 / automerge_human_changes_requested.go:60 already treat [bot] as non-human the same way.
  2. Memoize contributorMergedRepos (or the whole contributorMergedHistory) per (author, sweep), so each author costs at most one set of searches per sweep, not one per PR.
  3. Optional: cache the hive-wide merged-repos result per author for a short TTL (for example 30 minutes), since merged history only grows.

Acceptance criteria

Test plan

  • Unit tests in automerge_contributor_lane_test.go with a fake transport counting Search.Issues calls: (a) bot author → 0 calls; (b) three PRs, same human author, one sweep → one search set; (c) two different authors → two sets.
  • Existing contributor-lane auto-promotion tests stay green.

Out of scope

  • Changing AutoPromoteAfterMergedPR thresholds or the hive-wide counting rule.
  • The forgestate outcome-count reconcile. It already paces itself (forgestate/counts.go:388: per-pass budget, pace, early stop on a rate-limit refusal) and is not the first failure in any of the four trips.

Activity

  1. Danathar commented on Oct 28, 2026

    @Danathar
    ContributorAuthor

    Two more trips since filing, same first failing call (auto-promotion search, author github-actions[bot], repo projectbluefin/utah-packages): 20:17:22Z (and 20:00:57Z before it), so five on 2026-10-28, now every ~20–60 minutes. Each caution window also sheds the dashboard's low-priority refreshes: during the 20:17Z window the Overview snapshot stayed at 19:59:45Z and the PR/issue counts were marked stale: GitHub rate-limited (partial: 13 of 19 repos counted), so the owner-facing cards stop updating as well as merges.

  2. hivecommons-hive commented on Oct 28, 2026

    @hivecommons-hive
    Contributor

    🔒 Claimed by @Karibhou (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply /unclaim to release, or /claim to take it over if you outrank the holder.

  3. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Oct 28, 2026
  4. hivecommons-hive commented on Oct 28, 2026

    @hivecommons-hive
    Contributor

    🔓 Claim by @Karibhou released (lease revoked).

  5. hivecommons-hive commented on Oct 28, 2026

    @hivecommons-hive
    Contributor

    Fixed by #15125 (merged 215ded4). Closing. Reply /reopen if the problem persists.

  6. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    @Danathar this issue was closed by @hivecommons-hive[bot] as completed.

    If this was closed by a merged PR, the fix only takes effect once it ships in a tagged release and your deployment updates to it — check your running version against the fix before concluding the fix failed.

    If you are still seeing the problem, comment /reopen and it will be reopened for you — you do not need write access. Please add what you are still observing (running version, logs, steps) so it is not closed the same way again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions