tui: drop statusCheckRollup from batch PR fetch to cut GraphQL cost#542
Open
bborn wants to merge 1 commit into
Open
tui: drop statusCheckRollup from batch PR fetch to cut GraphQL cost#542bborn wants to merge 1 commit into
bborn wants to merge 1 commit into
Conversation
The 4-minute prRefreshTick calls FetchAllPRsForRepo per repo, and the batch query was including statusCheckRollup — which forces GraphQL to expand every check run on every PR. With ~30 PRs and ~10 checks each, one refresh cost 30–80 points, easily burning the 5000/hr window in under 90 minutes. The per-task on-demand fetch in GetPRForBranch still pulls statusCheckRollup via 'gh pr view' for the detail view, so the badge on the selected task stays correct. List-view check badges fall back to the neutral 'Open PR' state until a task is selected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prRefreshTickcallsFetchAllPRsForRepoper active repo, and the batch query asked forstatusCheckRollup. That field forces GraphQL to expand every check run on every PR — at ~30 PRs × ~10 checks, one refresh = 30–80 points and we exhausted the 5000/hr GraphQL window in under 90 minutes today.statusCheckRollupfrom the batchgh pr list --jsonfield list and fromghPRListResponse; stop populatingCheckStatefrom the batch path. Expected per-refresh delta drops to ~5–10 points.GetPRForBranch/fetchPRInfois unchanged — it still pullsstatusCheckRollupviagh pr viewfor the selected task. List-view check badges fall back to the neutral "Open PR" state (the default branch instyles.goalready handlesCheckStateNone).Test plan
go build ./...go test ./internal/github/...go test ./internal/ui/...tylocally for a few minutes; confirm PR badges still show number/draft/mergeable in the list view, and the check-status badge fills in for the selected task only.gh api rate_limit --jq .resources.graphql.usedbefore and after a refresh cycle; expect per-refresh delta to drop from ~30–80 to ~5–10.🤖 Generated with Claude Code