Skip to content

Rate limit #201

Open
Open

Description

@kapcod

On many changed files, PR, the action gets into a loop of rate limit errors.

Warning: [@octokit/plugin-throttling] `onAbuseLimit()` is deprecated and will be removed in a future release of `@octokit/plugin-throttling`, please use the `onSecondaryRateLimit` handler instead
{ name: 'octokit' }
Warning: Abuse limit hit with "POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews", retrying in 5 seconds.

It appears that 5-second retries are not sufficient for GitHub to release the rate limit.

My suggestion is to add a comment as soon as every file scan is finished, this way the delay between POSTs will be long enough not to cause this loop.

Activity

  1. anc95 commented on Jan 4, 2026

    @anc95
    Owner

    it does the way add a comment as soon as every file scan is finished now. how many file changes in your commit?

  2. kapcod commented on Jan 4, 2026

    @kapcod
    Author
  3. anc95 commented on Jan 11, 2026

    @anc95
    Owner

    hi @kapcod
    I was thinking about this for a while. there are two types of rate limit of Github (for your reference https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits), the current implement may hit the secondary rate limit.

    first, I need admitted that I said wrong in the first reply, I checked the code, the review only sent once after all files reviewed by GPT (using API https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request). the api body already contains all comments, so only sent one time, so, in theory, would not hit the primary rate limit.

    but as for the secondary limit, there has limit on the content generation, it says

    Create too much content on GitHub in a short amount of time. In general, no more than 80 content-generating requests per minute and no more than 500 content-generating requests per hour are allowed. Some endpoints have lower content creation limits. Content creation limits include actions taken on the GitHub web interface as well as via the REST API and GraphQL API.

    These secondary rate limits are subject to change without notice. You may also encounter a secondary rate limit for undisclosed reasons.

    in our case there has 130 files changed, the comment amount may more than 130 (if averagely there are two change chunks per file, then will have 260 comments need to be submitted), I think this might be tagged as abuse use by GitHub side.

  4. Br1an67 commented on Mar 1, 2026

    @Br1an67
    Contributor

    I'd like to work on this. The fix batches review comments into smaller groups (default 40 per batch with 5s delay) to stay under GitHub's secondary rate limit for content-generating requests.

    PR: #206

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions