Skip to content

Commit 3c1a46f

Browse files
committed
fix: cap API retry exponential backoff at 10 minutes
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 #2724
1 parent 9bf31d3 commit 3c1a46f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/task/Task.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,7 @@ export class Task extends EventEmitter<ClineEvents> {
17921792
}
17931793

17941794
const baseDelay = requestDelaySeconds || 5
1795-
let exponentialDelay = Math.ceil(baseDelay * Math.pow(2, retryAttempt))
1795+
let exponentialDelay = Math.min(Math.ceil(baseDelay * Math.pow(2, retryAttempt)), 600) // Cap at 10 minutes
17961796

17971797
// If the error is a 429, and the error details contain a retry delay, use that delay instead of exponential backoff
17981798
if (error.status === 429) {

0 commit comments

Comments
 (0)