Skip to content

GitHub plugin syncs every 5 minutes with 4 gh list calls per tracked repo #3406

Description

@trieloff

1. Summary

The builtin GitHub plugin's background sync service wakes every 5 minutes and, for each tracked repository, runs four gh list commands in parallel (issue open+closed, pr open+closed). Those commands are GraphQL. With many BB projects that have GitHub origin remotes, this burns a large fraction of the shared personal GitHub token every hour and starves interactive gh from agents on the same machine.

I expected the refresh interval to scale with how many repositories are tracked, or to be configurable. It is a hardcoded 5 minutes.

2. Versions and environment

  • bb 0.42.1, desktop app (/Applications/bb.app), macOS 26.5.2 (25F84), arm64
  • Builtin plugin [email protected] (builtin:github)
  • GitHub CLI on PATH (gh authenticated to github.com via keyring)
  • 34 BB projects whose checkouts have a GitHub origin (so 34 tracked repos; extraRepos empty)
  • bb Connect paired; this report is from thread thr_zvpghw28aq (child thr_ns8jmyv7ee drafted a patch)
  • Code cited below is main at 1bc80e1d57991fe60a3896e60e0159427194c7bb (still the 5-minute constant). I later overlaid a local patch on this machine; the measurements below are from before that overlay, on stock 0.42.1.

3. Steps to reproduce

Minimal path (no need for 34 projects). Uses extraRepos so a stranger can reproduce with one BB project.

  1. On bb 0.42.1 (or main at 1bc80e1d), with gh auth status succeeding for github.com:
bb plugin install builtin:github
bb plugin config github set extraRepos "cli/cli, cli/go-gh, cli/gh-extension-precompile"
bb plugin reload github
  1. Confirm the plugin is running and the catalog includes those three repos:
bb plugin list | rg github
bb github repos
  1. Wait ~12 minutes (two full cycles). Capture logs and a live gh sample during a sync:
bb plugin logs github -n 30
ps -ax -o pid,command | rg 'gh (issue|pr) list'

Did not reproduce with: a machine that has zero GitHub project remotes and empty extraRepos (the service still loops, but fetchRepoItems is not called). This is not agent gh usage and not the gtd-sidebar poller (that one is gh api graphql / gh api repos/…/pulls).

4. Expected vs actual

Actual on 0.42.1 with 34 project remotes, bb plugin logs github (UTC):

{"ts":1789040440250,"level":"info","message":"synced 1941 item(s) across 34 repo(s)"}
{"ts":1789040792797,"level":"info","message":"synced 1941 item(s) across 34 repo(s)"}
{"ts":1789041820270,"level":"info","message":"synced 1943 item(s) across 34 repo(s)"}
{"ts":1789042164639,"level":"info","message":"synced 1944 item(s) across 34 repo(s)"}

Deltas: 352.5 s and 344.4 s between completed syncs (≈5 minutes of park plus ~45–60 s of gh work).

During a tick, ps showed four gh processes per repo, of the form:

gh issue list -R <owner>/<repo> --state open --limit 100 --json number,title,state,author,labels,assignees,url,body,updatedAt
gh issue list -R <owner>/<repo> --state closed --limit 50 --json number,title,state,author,labels,assignees,url,body,updatedAt
gh pr list -R <owner>/<repo> --state open --limit 50 --json number,title,state,author,labels,assignees,url,body,updatedAt
gh pr list -R <owner>/<repo> --state closed --limit 30 --json number,title,state,author,labels,assignees,url,body,updatedAt

Arithmetic: 34 repos × 4 commands × 12 cycles/hour = 1632 gh invocations/hour from this plugin alone. gh pr list / gh issue list are GraphQL; GET /rate_limit under-reports that budget (a real gh pr list response showed X-RateLimit-Resource: graphql).

Expected: either a longer default interval, an interval that grows with tracked-repo count, or a setting. Interactive agent gh on the same token should not compete with a 5-minute full-catalog scrape.

5. Evidence

Hardcoded interval and the four-call fetch, main @ 1bc80e1d:

Limits used: ISSUE_PAGE = 100, CLOSED_ISSUE_PAGE = 50, PR_PAGE = 50, CLOSED_PR_PAGE = 30 (L7–L10).

Investigation: bb thread thr_zvpghw28aq. Prototype (not for merge until contributor allow-list): closed PR #3404 — auto-scale the park from repo count (~400 list-calls/hour target, clamp 5–60 min; 34 repos → 21 min).

6. What you ruled out

7. Suggested priority and effort

High for anyone with tens of GitHub-backed BB projects (shared 5000/hour token; no setting to slow it down). Effort looks small: change the constant and/or scale by repos.length. Workaround: none besides fewer projects or disabling the plugin.

AGENT GENERATED

Activity

  1. added
    plugins
    github
    on Sep 10, 2026
  2. bb-slop-cop commented on Sep 10, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied Type: Feature, Priority: Medium, Effort: Low, and labels plugins, github, perf. No existing classifications needed preserving; all values verified after writing.

    Source review confirms the fixed polling policy. Adaptive or configurable refresh adds scheduling behavior; shared-token contention makes this a meaningful improvement for larger catalogs. Classified as a feature request rather than a demonstrated failure of the existing scheduler. Per this rule, reproduction reporting and an automatic PR were skipped for the final Feature type.

  3. added a commit that references this issue on Sep 10, 2026
    171ebaf
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

    githubperfplugins

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions