Skip to content

tui: drop statusCheckRollup from batch PR fetch to cut GraphQL cost#542

Open
bborn wants to merge 1 commit into
mainfrom
task/3286-drop-statuscheckrollup-from-tui-pr-batch
Open

tui: drop statusCheckRollup from batch PR fetch to cut GraphQL cost#542
bborn wants to merge 1 commit into
mainfrom
task/3286-drop-statuscheckrollup-from-tui-pr-batch

Conversation

@bborn
Copy link
Copy Markdown
Owner

@bborn bborn commented May 15, 2026

Summary

  • The TUI's 4-minute prRefreshTick calls FetchAllPRsForRepo per active repo, and the batch query asked for statusCheckRollup. 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.
  • Drop statusCheckRollup from the batch gh pr list --json field list and from ghPRListResponse; stop populating CheckState from the batch path. Expected per-refresh delta drops to ~5–10 points.
  • The per-task detail fetch in GetPRForBranch / fetchPRInfo is unchanged — it still pulls statusCheckRollup via gh pr view for the selected task. List-view check badges fall back to the neutral "Open PR" state (the default branch in styles.go already handles CheckStateNone).

Test plan

  • go build ./...
  • go test ./internal/github/...
  • go test ./internal/ui/...
  • Run ty locally 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.
  • Sample gh api rate_limit --jq .resources.graphql.used before and after a refresh cycle; expect per-refresh delta to drop from ~30–80 to ~5–10.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant