Fix GitHub Primary Rate Limit Errors Not Retried
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- github, typescript
調査の方向性
Start in packages/provider-github/src/http.ts, especially withRetry and assertResponseOk, then read the GitHubError definition and nearby tests. Add coverage for primary rate limit 403 responses, reset-header backoff, and Retry-After handling. Done means these errors retry using the provided timing headers where present, and the issue’s listed typecheck, test, and lint commands pass.
索引モデルが issue の本文から書いたものです。
説明
Summary
Codra's GitHub API client retries secondary rate limit errors (HTTP 403 with body "secondary rate limit") and HTTP 429/5xx errors, but does not retry primary rate limit errors. GitHub returns HTTP 403 (not 429) for primary rate limits, so these requests fail immediately and permanently, aborting in-progress reviews.
Affected File
packages/provider-github/src/http.ts - withRetry (lines 45-85):
const isSecondaryRateLimit =
error instanceof GitHubError &&
error.status === 403 &&
error.body?.toLowerCase().includes("secondary rate limit");
const isRetryable =
isSecondaryRateLimit ||
(error instanceof GitHubError && (error.status === 429 || error.status >= 500)) ||
error.name === "TimeoutError" ||
error.message.includes("timeout");
Why GitHub Uses 403 for Primary Rate Limits
GitHub's REST API returns HTTP 403 Forbidden with the error body "API rate limit exceeded for installation ID ..." and includes these response headers:
x-ratelimit-remaining: 0- confirms the quota is exhaustedx-ratelimit-reset: <epoch>- UTC epoch second when the quota resets
Since the check only recognizes "secondary rate limit" text, primary rate limit 403s fall through to the non-retryable path and immediately throw, causing the review to fail.
Proposed Fix
- Detect primary rate limit 403s:
const isPrimaryRateLimit =
error instanceof GitHubError &&
error.status === 403 &&
(error.body?.toLowerCase().includes("rate limit exceeded") ||
error.body?.toLowerCase().includes("api rate limit"));
- Capture
x-ratelimit-resetfrom response headers and use it to calculate precise sleep duration:
// In assertResponseOk - capture headers
throw new GitHubError(response.status, errText, path, `...`, response.headers);
// In withRetry - respect x-ratelimit-reset
const rateLimitReset = error.headers?.get("x-ratelimit-reset");
const delay = rateLimitReset
? Math.max(0, parseInt(rateLimitReset, 10) * 1000 - Date.now()) + 1000
: Math.pow(2, attempt) * 30000;
Done When
- HTTP 403 responses with primary rate limit body text are retried with appropriate backoff
-
x-ratelimit-resetheader is used to calculate wait time where present -
Retry-Afterheader on 429 responses is also respected -
GitHubErrorcarries response headers for use in retry logic - Tests cover primary rate limit 403 retry and
x-ratelimit-resetbackoff calculation -
npm run typecheck,npm test, andnpm run lintall pass
- 主要言語
- TypeScript
- スター
- 125
- フォーク
- 23
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
devarshishimpi/codra のほかの issue
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
devarshishimpi/codra#178 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
devarshishimpi/codra#176 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
devarshishimpi/codra#186 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
devarshishimpi/codra#185 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
devarshishimpi/codra#184 ·
メンテナーはふだん 1 日以内に返信
devarshishimpi/codra の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 83/100
gofish-graphics/gofish-graphics#1384 ·
メンテナーはふだん 1 日以内に返信
-
adapter bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Olanetsoft/agent-lookout#353 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
vicharanashala/vibe#1542 ·
メンテナーはふだん 1 日以内に返信
-
bug chore P2 size:XS
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
josephfung/curia#2666 ·
メンテナーはふだん 1 日以内に返信
-
area: batch
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
inabagumi/shinju-date#7294 ·
メンテナーはふだん 1 日以内に返信