Skip to content

[Bug]: PR detail/activity is re-fetched for every displayed PR on each focus, visibility change and 5-minute tick (merged PRs included), exhausting the GitHub GraphQL quota #13496

Description

@eowca

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web pull request views + apps/server PullRequestService / GitHub CLI integration

Steps to reproduce

  1. Use T3 Code with several threads whose PRs appear in the UI (linked PRs, PR tabs or panels opened at some point). Keep a second client connected if possible, e.g. the web UI served over Tailscale.
  2. Leave the app open and switch focus to and from the window every few minutes, as you normally would while working.
  3. Watch the GitHub GraphQL budget: gh api graphql -f query='{rateLimit{remaining resetAt}}'.
  4. Count GitHubCli.execute spans in ~/.t3/userdata/logs/server.trace.ndjson*, grouped by their ws.rpc.* ancestor.

Expected behavior

PR detail and activity reads are cached and shared across clients. A merged or closed PR is not re-fetched on every focus change. Refreshing should back off before the user's GitHub quota runs out, not only after (github requests to github.com are paused until the rate limit resets).

Actual behavior

Each client re-requests pullRequests.detail and pullRequests.activity for every PR it shows. This happens on window focus (after 10 s), on visibilitychange, and every 5 minutes while the user is active (the refresh hook with ya=3e5/1e4 in PanelLayoutControls). Merged PRs are included.

Measured on one machine (trace data plus rateLimit sampling):

  • Bursts of ~120 gh calls every 3–4 minutes. In one 7-minute window, 822 of 881 T3 gh calls came from ws.rpc.pullRequests.detail (264 RPCs) and ws.rpc.pullRequests.activity (192 RPCs). gh pr view --json author,comments,reviews,commits paginates, so this averaged ~3 GraphQL points per call.
  • GraphQL went from 4,974 to 2,206 remaining in 6.5 minutes. The 5,000/h budget ran out three times in one afternoon. Every other consumer combined made 66 GraphQL calls in 40 minutes.
  • Two connected clients (desktop window and a Tailscale-served web tab) each refreshed the same PRs independently.
  • Unlinking 70 merged PRs from active threads did not shrink the bursts. Of the 39 PRs in one burst, 18 were not linked to any thread; several of those match t3.pullRequests.detail:* entries in the client's localStorage.

This is a different path from #3581/#5673, which fixed per-branch gh pr list polling.

Impact

Major degradation or frequent failure

Version or commit

t3code 0.0.42-workspace-guard.1 (desktop AppImage), gh 2.101.0

Environment

Linux 7.0 (Ubuntu), desktop app plus a second web client via tailscale serve

Logs or stack traces

ws.rpc.pullRequests.activity -> PullRequestOperationError: Pull request operation activity failed: github requests to github.com are paused until the rate limit resets.

Workaround in use: a gh wrapper earlier on the server's PATH. For calls whose parent is the T3 server, it caches pr view --json and aliased pullRequest(number:) GraphQL reads for 10 minutes, or 24 hours once a PR is merged or closed. With it, later bursts of ~125 calls cost ~9 points instead of ~350.

Activity

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

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions