anthropics / anthropics/claude-code-action

Continuously getting rate limited when using Claude Code Action in Github (PR Review)

Abierto
#137 1 comentario 1 reacción 0 asignados Ver en GitHub
bug p2
Lenguaje dominante
TypeScript
Estrellas
8.9k
Forks
2.1k
Merge medio
3 d 9 h
PR fusionados (30 d)
10

Descripción

Whenever I run this action through Github I get continuously rate limited, this seems to be happening only for larger PRs (>1000 LOCs)

Here is the latest error from the Github Action Logs

```
{
"type": "result",
"subtype": "success",
"cost_usd": 0.2461181,
"is_error": true,
"duration_ms": 76225,
"duration_api_ms": 23934,
"num_turns": 7,
"result": "API Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed the rate limit for your organization (xxxxx) of 80,000 input tokens per minute. For details, refer to: https://docs.anthropic.com/en/api/rate-limits. You can see the response headers for current usage. Please reduce the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase.\"}}",
"total_cost": 0.2461181,
"session_id": "xxx"
}
```

Here is the Github action YAML configuration (nothing special, more or less the one that comes by default)
```
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "15"
model: "claude-3-5-sonnet-20241022"
```

I'm looking through the Github Readme and Anthropic Github Action docs but I don't happen to see a way to overcome this.

Any thoughts or ideas on how to improve this situation? Other models like Amazon Q do not seem to have a problem with this (not sure what they do differently though).

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.