-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: cap API retry exponential backoff at 10 minutes #5171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prevents excessive retry delays when auto-retry is enabled. Previously, the exponential backoff could grow to hours (e.g., 7168s after 11 retries with 7s base delay), causing "all night prompts" to get stuck waiting. Now capped at 600 seconds (10 minutes) maximum. Fixes RooCodeInc#2724
6 tasks
- Replaced magic number 600 with named constant for better maintainability - Constant clearly indicates the 10-minute cap for exponential backoff - Addresses review feedback from PR RooCodeInc#5171
daniel-lxs
approved these changes
Jun 27, 2025
Member
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @MuriloFP!
LGTM
mrubens
approved these changes
Jun 30, 2025
hannesrudolph
pushed a commit
that referenced
this pull request
Jul 3, 2025
Co-authored-by: Daniel Riccio <[email protected]>
utarn
pushed a commit
to modelharbor/ModelHarbor-Agent
that referenced
this pull request
Jul 4, 2025
Co-authored-by: Daniel Riccio <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
lgtm
This PR has been approved by a maintainer
PR - Needs Review
size:XS
This PR changes 0-9 lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #2724
Description
fix: cap API retry exponential backoff at 10 minutes maximum
Files affected:
Issue:
Auto-retry feature with exponential backoff was causing excessive delays
that could reach multiple hours (e.g., 7168 seconds ≈ 2 hours) when API
requests repeatedly failed. This particularly affected users working with
frequently overloaded models like Gemini 2.0 Thinking that return 503
"model overloaded" errors.
Root cause:
The retry logic used unbounded exponential backoff with formula:
baseDelay * 2^retryAttempt. With a 7-second base delay, this resultedin delays growing as: 7s → 14s → 28s → 56s → ... → 7168s after 11 failures.
Solution:
Added Math.min() cap of 600 seconds (10 minutes) to the exponential delay
calculation. This preserves the benefits of exponential backoff for
transient errors while preventing excessive delays that could abandon
long-running tasks.
Impact:
Test Procedure
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Additional Notes
Should I set a configuration for the max delay time? Or change the limit for something other than 10 minutes?
Get in Touch
Important
Caps API retry exponential backoff at 10 minutes in
Task.tsto prevent excessive delays.Task.ts.alwaysApproveResubmitenabled.Math.min()to limit delay calculation inattemptApiRequest().This description was created by
for 3c1a46f. You can customize this summary. It will automatically update as commits are pushed.