Skip to content

Commit f258440

Browse files
committed
fix(opencode): clamp published retry next and clarify RETRY_MAX_WAIT
1 parent d20be3a commit f258440

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/opencode/src/session/retry.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const RETRY_JITTER_FACTOR = 0.25
2929
export const RETRY_MAX_DELAY_NO_HEADERS = 30_000 // 30 seconds
3030
export const RETRY_MAX_DELAY = 2_147_483_647 // max 32-bit signed integer for setTimeout
3131
export const RETRY_MAX_RETRIES = 5
32-
export const RETRY_MAX_WAIT = 300_000 // longest provider-requested wait worth sleeping through
32+
export const RETRY_MAX_WAIT = 300_000 // longest provider-requested wait worth sleeping through - waits above this stop the retry loop instead of sleeping, see policy(). Distinct from RETRY_MAX_DELAY (backoff cap).
3333

3434
const RETRYABLE_MESSAGE_PATTERNS = [
3535
/429|500|502|503|504|524/i,
@@ -199,7 +199,7 @@ export function policy(opts: {
199199
attempt: meta.attempt,
200200
message: retry.message,
201201
action: retry.action,
202-
next: now + wait,
202+
next: wait > RETRY_MAX_WAIT ? now : now + wait,
203203
})
204204
// Status is published first so the limit dialog still fires, then we stop: a wait
205205
// this long is an exhausted quota window, and sleeping through it leaves the

0 commit comments

Comments
 (0)