fix(pull-requests): protect provider API budgets - #6466
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces new rate-limiting infrastructure and GraphQL budget tracking that gates API access based on quota state. It also changes polling intervals (1min → 5min) and thread comment loading behavior. These are significant runtime behavioral changes that warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate d0bec12
There was a problem hiding this comment.
Two Effect service convention issues in the new GraphQL budget path. Details inline.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Two Effect service convention issues in the new GraphQL budget path. Details inline.
Posted via Macroscope — Effect Service Conventions
Reject thread IDs from another pull request without adding a second GraphQL request.
Track quota inside the injected Effect layer and report local pauses as structured errors instead of synthetic CLI failures.
Concurrent reads can finish out of order. Keep the lower remaining quota within one reset window and ignore responses from older windows.
There was a problem hiding this comment.
One finding in the review-thread card's new paging state. Everything else in the changed web files (the Button size="xs" variant="ghost" load-more control, the merge helper, and the refresh cadence constants) is consistent with the existing patterns in these files.
Posted via Macroscope — UI Consistency
There was a problem hiding this comment.
One finding on error construction in the new rate-limit wrapper. Everything else in the new SourceControlRateLimit and GitHubGraphQlBudget services follows the service conventions (namespace subpath imports, Context.Service with an inline interface, real make, exported layer, dependencies acquired with yield*, structured Schema.TaggedErrorClass failures with messages derived from attributes).
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
One layout finding in PullRequestReviewAnnotation.tsx: the new "Load more comments" control and the existing "Reply" trigger are both inline-level siblings of a block card, so they render on the same line with no gap when a thread is unfinished and replying is allowed.
Posted via Macroscope — UI Consistency
## What's Changed * fix(pull-requests): protect provider API budgets by @Bil0000 in pingdotgg/t3code#6466 * feat(web): configurable browser defaults in Settings → Integrations by @juliusmarminge in pingdotgg/t3code#7082 **Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260816.1112...v0.0.34-nightly.20260817.1113 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260817.1113
Problem
Pull request browsing could drain source-control API quotas. One GitHub detail load spent 104 GraphQL points because T3 Code requested up to 100 replies per review thread, followed every reply cursor, and refreshed activity every minute.
GitLab, Bitbucket, and Azure DevOps used different APIs, but none had a shared host cooldown after a provider returned a rate limit. Concurrent clients could keep sending requests during the same throttle window.
Fix
Retry-Afterwhen available. Otherwise, back off from 30 seconds up to 15 minutes.updatedAtchanges.Result
A measured 44-thread pull request now costs 14 GraphQL points on its initial read instead of 104, an 86.5% reduction. Extra reply pages cost points only when requested.
When any supported provider throttles T3 Code, automatic reads stop locally instead of causing a retry storm. GitHub also protects quota for user actions before the hard limit is reached.
Verification
Built with Codex (GPT-5.6-sol) in T3 Code.
Note
Protect provider API budgets with rate-limit gating and paginated review thread comments
SourceControlRateLimit, a process-local coordinator that enforces per-provider/host backoff with exponential fallback; read-like PR operations are blocked when paused, while interactive operations (replies, reactions, reviews) bypass the gate.GitHubGraphQlBudget, a client-side budget tracker that injectsrateLimitfields into GitHub GraphQL queries and blocks reads when remaining quota falls below 10%, with per-host isolation and out-of-order response resilience.rate-limitedfailure reason, propagatingretryAtparsed fromRetry-Afterheaders where available.listReviewThreadCommentsno longer auto-fetches all pages; clients use a newthreadCommentsRPC (pullRequests.threadComments) and a "Load more comments" button inReviewThreadCard.Macroscope summarized db693e5.