Skip to content

core: smarter retry backoff for Cerebras rate limits#42

Merged
kevint-cerebras merged 1 commit intokevint-cerebras:devfrom
adolago:smart-retry-backoff
Jan 29, 2026
Merged

core: smarter retry backoff for Cerebras rate limits#42
kevint-cerebras merged 1 commit intokevint-cerebras:devfrom
adolago:smart-retry-backoff

Conversation

@adolago
Copy link
Contributor

@adolago adolago commented Jan 28, 2026

Replace fixed retry schedule with exponential backoff + jitter that retries until the next hour boundary when rate limits reset.

The current retry uses a flat [10s, 10s, 10s, 15s, 15s] schedule and gives up after 5 tries — so you're back to staring at an error in the middle of being rate limited.

This replaces that with exponential backoff + jitter that keeps retrying until the next hour rolls over (when limits actually reset). First retry is fast (2s), then it backs off naturally. If the server sends a retry-after header, we respect it instead of ignoring it.

Also catches transient network errors (connection resets, timeouts, socket hangups) and 500/502/503s that the old code just gave up on.

Two files, no new dependencies.

Replace fixed retry schedule with exponential backoff + jitter that
retries until the next hour boundary when rate limits reset.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kevint-cerebras kevint-cerebras merged commit 5132681 into kevint-cerebras:dev Jan 29, 2026
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.

2 participants