Skip to content

429 retry-after capped at 10s — quota exhaustion retried instead of surfaced #13572

@SirBrenton

Description

@SirBrenton

📱 Client Type

Other

💻 Operating System

Other

📦 Deployment Platform

Other

📌 Version

latest (static analysis — not version-specific)

🌐 Browser

Chrome, Other

🐛 What happened?

executeWithRetry in packages/model-runtime/src/providers/githubCopilot/index.ts reads retry-after correctly but caps it at 10 seconds:

Math.min(retryAfter, 10_000)

A retry-after of 3 hours (quota exhaustion) gets truncated to 10 seconds and retried 3 times instead of surfacing
immediately as unrecoverable.

📷 How to reproduce it?

Static analysis finding in src/providers/githubCopilot/index.ts

Trigger a quota exhaustion 429 with retry-after > 300s.

Observe that executeWithRetry caps the delay at 10s and retries MAX_RATE_LIMIT_RETRIES times instead of surfacing.

🚦 What it should be?

retry-after above a threshold should surface immediately as quota exhaustion, not consume retry attempts.

Suggested fix:
const STOP_THRESHOLD_MS = 5 * 60 * 1000
if (retryAfter && retryAfter > STOP_THRESHOLD_MS) {
throw this.mapError(error)
}

📝 Additional Information

Documented across production systems:
github.com/SirBrenton/pitstop-truth

🛠️ Willing to Submit a PR?

Yes, I am willing to submit a PR

✅ Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a LobeChat issue and not a third-party library or provider issue.
  • Check that this is a concrete bug. For Q&A, please use GitHub Discussions or join our Discord Server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions