Repository navigation
Labels
githubBuilt-in plugin: githubhostHost daemon, process lifecycle, memory, event looppartial-reproBug partially reproduced; some claims unverified; see linked reportperf
Description
What happens
On one host, the BB host daemon spends most of the GitHub GraphQL hourly allowance (5,000 points) by re-reading pull request status. When the allowance runs out, every other gh user on the host (agents opening or merging PRs, plugins) fails with GraphQL: API rate limit already exceeded.
Evidence (BB 0.45.0, Linux host, about 60 active threads across 19 GitHub repositories)
- A 30-second process sample showed the host daemon (
host-daemon/dist/daemon-bundle.mjs) running this command 22 times:
gh pr view --json number,title,state,url,isDraft,autoMergeRequest,baseRefName,headRefName,updatedAt,statusCheckRollup,reviewDecision,reviewRequests,mergeStateStatus,mergeable
plus severalgh api graphqlqueries per PR forisInMergeQueue. - That rate is about 2,600 PR reads per hour from the daemon alone; each read costs at least 1 GraphQL point, and
statusCheckRollupcan cost more. - The GraphQL rate-limit headers on real responses fell from 4,116 to 3,709 remaining in 223 seconds (about 6,500 points per hour for the host).
gh api rate_limitreported a different, higher remaining value at the same moment, so tools that rely on it underestimate usage.- Turning a third-party plugin off did not lower the daemon's read rate.
Expected
PR status reads should stay well under the shared hourly allowance, whatever the number of threads. For example:
- Read only PRs of threads that are open and visible (or that changed recently).
- Use the REST pulls list with ETags (conditional
304responses do not count) to detect changes, and read details only for PRs that changed. - Back off when the
x-ratelimit-remainingheader of a GraphQL response is low, and leave a reserve for user actions (create, merge). - Coalesce duplicate reads of the same PR.
Impact
Agents fail to open, check or merge PRs for the rest of the hour, and plugins that also need GitHub stop working.
Metadata
Metadata
Assignees
Labels
githubBuilt-in plugin: githubhostHost daemon, process lifecycle, memory, event looppartial-reproBug partially reproduced; some claims unverified; see linked reportperf
Activity
bb-slop-cop commentedon Oct 17, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilothost,perf,github.partial-repro.cameronm123 commentedon Nov 24, 2026
Reproduced in production on BB
0.50.1(macOS host + 4 connected remote hosts,cameronm123). This fills in the two gaps noted in the triage report: the exact GraphQL point consumption and the request initiator.Measured GraphQL cost (
rateLimit(dryRun: true))In
builtin-plugins/github-pr-status/dist/host.js,kind: "branch"queriespullRequests(headRefName: ..., first: 100)with nestedreviewRequests(first: 100)andcommits(last: 1) { statusCheckRollup { contexts(first: 100) } }:nodeCountcostfirst: 100/100/100)first: 100/100/100)first: 100/100/100)first: 5/10/50)Every absent or settled environment costs 3 GraphQL points, even on
mainwith 0 PRs.Root cause & request initiator on BB
0.50.110snon-viewer TTL (server.js→createPullRequestStore().read):viewer: true) usestaleAfterMs:30s(open PR),5m(absent),1h(merged/closed).viewer: false, e.g. plugins callingpullRequests/environments.pullRequestlikebb-sidebar's*/5 * * * *auto-settlecron) hit a hardcoded10s(1e4) TTL.bb-sidebar),bb--github-pr-statuslogged +1,100 handler calls and burned 1,193+ GraphQL points in ~2.5 minutes (~13,000–16,000+ pts/hr demand against the 5,000 pts/hr limit; 1.24M total calls over 95h uptime).server.js→prepareLoad):isSettled(envId)is true (mergedorclosed),prepareLoadsetsknown: null, forcing a3 pt(20,200-node)kind: "branch"query instead of a cheap URL check or skipping.host.js→flushBatch):data: null,flushBatchonly backs off for60s(Date.now() + 6e4) instead of waiting untilresetAt.rateLimit.remaining < 500) to protect interactive agent/userghoperations.(Also confirms the reporter's
/rate_limitobservation: GitHub's GraphQL rate-limiter can diverge across shards — RESTgh api rate_limitreported 3,268 remaining on one shard while livePOST /graphqlcalls hitremaining: 0/used: 5002on another.)Concrete fixes for
builtin:github-pr-statusstaleAfterMsfor non-client callers (or givepullRequestsan explicitfreshoption instead of defaulting allviewer: falsecalls to a10sTTL).host.js:pullRequests(headRefName: ..., first: 5)withreviewRequests(first: 10)andcontexts(first: 50)(paginating only whenhasNextPageis true) cuts GraphQL point cost 18× (72 pts → 4 pts per 24-env batch).known: nullon every poll of settled PRs unless git refs actually changed (git-refs-changed/ branch change).rateLimit.remaining < 500) and honorresetAt(or exponential backoff) on rate-limit errors.Read GitHub PR branch lookups with a light scan plus the newest PR's …