Skip to content

[Bug]: GitHub GraphQL quota exhausted by issue sidebar getIssue (no server cache, 2 queries per call) #42968

Done

Description

@Xuanwo

Before submitting

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

Area

apps/server

Steps to reproduce

  1. Run T3 0.1.12 on several hosts that all use the same personal GitHub login (gh), with backgroundActivity.profile=battery-saver on every host.
  2. Keep a few threads visible in the sidebar on each host, with or without issues linked to them.
  3. Use the app normally for a few hours and watch gh api rate_limit.

Expected behavior

Sidebar and background refreshes stay well inside the 5,000 points/hour GraphQL limit, and interactive actions such as merging a PR, submitting a review or resolving a review thread keep working.

Actual behavior

On five hosts sharing one account, the GraphQL limit runs out about three times every eight hours, even with battery-saver on all hosts and no issues linked to threads. While it is exhausted, PR merges, reviews and review-thread resolution fail until the window resets.

What we found in 0.1.12:

  1. The sidebar fetches full issue detail (ws.rpc.issues.detail) for every linked issue on every visible thread just to draw the open/closed icon. The client cache is a 30 s staleTimeMs.
  2. IssueService.detail / GitHubIssueTracker.getIssue have no server-side cache, so every connected client and every host repeats the same requests.
  3. On github.com each getIssue sends two GraphQL queries (IssueDetail and IssueStatuses) and is marked Interactive=true, so it bypasses the 10% reserve and can drain the quota to zero.
  4. GitHub App sign-in doesn't help: it yields a user-to-server token (ghu_), which shares the same per-user 5,000/hour limit.

Suggested fixes:

  • Cache issue and PR status on the server, keyed by repository and number, with ETag/conditional requests or a TTL measured in minutes, shared across clients.
  • Let the sidebar use a lightweight status query (state only, batched across issues) instead of full detail.
  • Count sidebar and background refreshes as non-interactive so they respect the reserve.
  • Optionally, surface GraphQL usage per feature in diagnostics so users can see which feature is spending the quota.

Impact

Major degradation or frequent failure

Version or commit

0.1.12

Environment

Linux servers, five hosts using the same personal GitHub login

Activity

  1. juliusmarminge commented on Nov 25, 2026

    @juliusmarminge
    Member

    A fix for this was proposed in #42977, but when the reported steps were run in the real app the slowness could not be measured: the commit before this change was as fast.

    What was run on b1360538c1, the commit before this change:

    For each commit, install dependencies, start the dev app, and add its GitHub checkout as a project. Run seven alternating batches per commit: read GitHub issue 42968 once on one WebSocket connection, reconnect, then issue five serial detail reads on the second connection. Measure RPC send-to-success latency, excluding authentication and handshake. Compare 35 repeated-read timings per commit and all 84 response digests. Collect completed server traces. Inspect and upload rendered measurement output, raw timing data, sanitized traces, and scripts. Stop servers and remove temporary files and worktrees.

    How: Manual real-server comparison on the same Linux x86_64 machine, Node 26.13.1. Two independent dev app instances started with T3CODE_DEV_SEED=0 and fresh databases. Projects added through the app CLI. A Node driver authenticated using CLI-issued sessions and drove the actual /ws issues.detail RPC against real GitHub. No mocks or direct service imports. Scenarios were excluded because their documentation explicitly excludes timing/performance regressions.

    Could you share the exact steps, what you see, and the version and platform you are on? The pull request is closed for now; the fix is picked up again once the problem can be shown.

  2. added
    needs more info
    on Nov 25, 2026
  3. Xuanwo commented on Nov 26, 2026

    @Xuanwo
    Author

    This issue is about GitHub GraphQL quota consumption (request count), not RPC latency.

    The verification run for #42977 measured issues.detail send-to-success latency. Because GitHubIssueTracker.getIssue currently fires IssueDetail and IssueStatuses concurrently (concurrency: 2), merging them into one query barely changes latency—it halves the number of GraphQL calls spent per read.

    In fact, #42977's own reproduction on b1360538c1 already demonstrated the exact bug:

    • 6 ws.rpc.issues.detail calls (1 on the first connection + 5 repeated reads on a second connection) produced 12 GitHubGraphQlAuth.execute spans in server.trace.ndjson (2 GraphQL queries per call, with no server-side cache reuse across calls or connections).

    Expected metric to verify

    Instead of RPC latency, compare the number of GitHubGraphQlAuth.execute spans in server.trace.ndjson (or resources.graphql.used from gh api rate_limit) for the same sequence of issues.detail calls:

    1. Current (0.1.12 / b1360538c1): 6 issues.detail calls for the same issue → 12 GraphQL queries.
    2. With fix(server): reading a GitHub issue costs one GraphQL query, not two #42977 only (single combined query): 6 issues.detail calls → 6 GraphQL queries (2× reduction, still uncached).
    3. With server-side TTL caching on IssueService.detail (plus lightweight/batched sidebar status reads, cf. [Bug] Sidebar fetches details for every linked issue at startup, triggering slow-request warnings #40893): 6 issues.detail calls for the same issue within the TTL window → 1 GraphQL query.

    Environment & reproduction details

    • Version: T3 Code 0.1.12
    • Platform: Linux (5 servers sharing one personal gh login)
    • Observed behavior: Opening or reconnecting a client to hosts with threads that have many linked GitHub issues triggers bursts of ws.rpc.issues.detail from useSidebarLinkedIssueState (client staleTimeMs: 30_000), and each call sends 2 uncached GraphQL queries. Across multiple clients/hosts this burns through the 5,000 points/hour personal GraphQL quota and triggers SourceControlRateLimitPausedError.

    One correction to the original report: #42977 accurately noted that IssueService.detail is not wrapped in interactive(...), so getIssue itself respects the 10% reserve—it drains up to the reserve threshold quickly, leaving little headroom before normal interactive operations exhaust the rest.

    Reopening #42977 would cut the per-call multiplier from 2× to 1× immediately, and adding a server-side TTL cache for IssueService.detail (and/or a batched status query for the sidebar) would fix the underlying amplification.

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

    needs more info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions