Skip to content

[pre-push] Clean up GraphQL backoff code#289

Merged
joshlf merged 1 commit intomainfrom
Gb586e728a212776be323db7d30e4a55851fa1208
Feb 9, 2026
Merged

[pre-push] Clean up GraphQL backoff code#289
joshlf merged 1 commit intomainfrom
Gb586e728a212776be323db7d30e4a55851fa1208

Conversation

@joshlf
Copy link
Owner

@joshlf joshlf commented Feb 9, 2026


⬇️ Download this PR

Branch

git fetch origin refs/heads/Gb586e728a212776be323db7d30e4a55851fa1208 && git checkout -b pr-Gb586e728a212776be323db7d30e4a55851fa1208 FETCH_HEAD

Checkout

git fetch origin refs/heads/Gb586e728a212776be323db7d30e4a55851fa1208 && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/Gb586e728a212776be323db7d30e4a55851fa1208 && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/Gb586e728a212776be323db7d30e4a55851fa1208

Stacked PRs enabled by GHerrit.

gherrit-pr-id: Gb586e728a212776be323db7d30e4a55851fa1208
@joshlf joshlf enabled auto-merge (squash) February 9, 2026 17:48
@gemini-code-assist
Copy link

Summary of Changes

Hello @joshlf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the GraphQL batch processing mechanism by refining how it handles GitHub API rate limits and query size constraints. The changes streamline the backoff strategy, making the code more resilient to transient API issues and improving its ability to adapt to varying data volumes without encountering errors due to overly large requests.

Highlights

  • Refactored GraphQL Query Execution: The logic for executing GraphQL queries has been refactored into an asynchronous block, centralizing the handling of successful responses, backoff conditions (due to API limits or query size heuristics), and fatal errors.
  • Improved Batch Size Initialization: The initial batch size for GraphQL queries is now dynamically set to the minimum of 64 and the actual number of items, preventing an oversized initial batch when dealing with fewer items.
  • Consolidated Backoff Logic: The decision-making for backing off the batch size, whether due to exceeding a heuristic query size limit or hitting GitHub's resource limits, is now unified and handled after the query attempt, leading to cleaner control flow.
Changelog
  • src/pre_push.rs
    • Added cmp to std imports for min function.
    • Modified GraphQL batch size initialization to cmp::min(64, items.len()).
    • Encapsulated GraphQL query execution within an async block, returning Ok(Some(response)), Ok(None) for backoff, or Err(e) for fatal errors.
    • Moved query size heuristic check (MAX_QUERY_SIZE) inside the new async block, triggering backoff (Ok(None)) if exceeded.
    • Updated resource limit error handling to also trigger backoff (Ok(None)).
    • Refactored batch size reduction logic to occur after the async block, based on whether a response was received or backoff was indicated.
    • Improved logging messages for GraphQL query size warnings and batch size adjustments.
    • Clarified the error message when a single PR update exceeds GitHub resource limits.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the GraphQL backoff logic for better clarity and structure. The changes are a good improvement, centralizing the backoff mechanism and making the code easier to follow. I have one suggestion to further improve the user-facing error messages during backoff scenarios.

@joshlf joshlf merged commit 3e5db9f into main Feb 9, 2026
1 check passed
@joshlf joshlf deleted the Gb586e728a212776be323db7d30e4a55851fa1208 branch February 9, 2026 17:53
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