Skip to content

[Vibecoded] Add RPC retry with exponential backoff and shared cooldown#1059

Open
rappie wants to merge 1 commit intoargotorg:mainfrom
rappie:rappie/rpc-throttle
Open

[Vibecoded] Add RPC retry with exponential backoff and shared cooldown#1059
rappie wants to merge 1 commit intoargotorg:mainfrom
rappie:rappie/rpc-throttle

Conversation

@rappie
Copy link
Copy Markdown

@rappie rappie commented Apr 14, 2026

WARNING: this is 100% vibecoded.

I've been using this without issue for several days.

Description

When multiple workers hit RPC rate limits concurrently, requests now
retry with exponential backoff (500ms–8s) and jitter. A shared
cooldown IORef on Session coordinates workers so that once any
worker trips a rate limit, the others back off together instead of
hammering the endpoint independently.

Changes:

  • Add rpcThrottle :: IORef (Maybe UTCTime) to Session
  • Add withRetry / fetchWithRetry wrapping fetchWithSession
  • Route all four internal call sites through fetchWithRetry
  • Re-throw async exceptions (Timeout, ThreadKilled); only retry
    synchronous ones (network errors, HTTP 429, etc.)
  • RPC-level Left errors pass through without retry
  • Debug logging gated behind conf.debug, matching existing style

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

When multiple workers hit RPC rate limits, requests now retry with
exponential backoff (500ms-8s) and jitter. A shared cooldown IORef in
Session coordinates workers so they back off together.

- Add rpcThrottle field to Session
- Add withRetry/fetchWithRetry wrapping fetchWithSession
- Update all 4 internal call sites to use fetchWithRetry
- Re-throw async exceptions (Timeout, ThreadKilled) correctly
- RPC-level errors (Left) pass through without retry
- Debug logging gated behind conf.debug, matching existing style

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@msooseth msooseth left a comment

Choose a reason for hiding this comment

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

LGTM

@msooseth
Copy link
Copy Markdown
Collaborator

@blishko maybe you could also have a look and if you find it good, merge?

@blishko
Copy link
Copy Markdown
Collaborator

blishko commented Apr 20, 2026

Maybe @gustavo-grieco or @elopez could take a look?
This would affect Echidna as well, I think, no?

@rappie
Copy link
Copy Markdown
Author

rappie commented Apr 20, 2026

This would affect Echidna as well, I think, no?

Yes. I have tested this by using Echidna.

@gustavo-grieco
Copy link
Copy Markdown
Collaborator

I will take a look to this soon

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.

4 participants