Skip to content

Honor Retry-After for provider rate limits#5687

Open
RitwijParmar wants to merge 1 commit into
Helicone:mainfrom
RitwijParmar:codex/retry-after-provider-rate-limits
Open

Honor Retry-After for provider rate limits#5687
RitwijParmar wants to merge 1 commit into
Helicone:mainfrom
RitwijParmar:codex/retry-after-provider-rate-limits

Conversation

@RitwijParmar

Copy link
Copy Markdown

Summary

  • parse numeric and HTTP-date Retry-After headers from provider 429 responses
  • use provider Retry-After as the minimum retry delay while keeping exponential backoff as the fallback
  • split retry classification/delay helpers and add focused Jest coverage

Why

Provider 429s are different from 5xx failures: when a provider sends Retry-After, retrying inside that cooldown window just burns attempts and can amplify rate-limit pressure. This makes the gateway observe and respect the provider's rate-limit signal instead of treating 429 exactly like transient 5xx responses.

Fixes #5672.

Tests

  • yarn workspace helicone-api test:jawn --runTestsByPath src/lib/proxy/__tests__/ProviderClient.test.ts
  • yarn workspace helicone-api build

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

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.

ProviderClient.ts — 429 and 5xx use same exponential backoff, Retry-After never consulted

1 participant