feat: raise default per-step LLM retry budget to 10 attempts - #1740
Conversation
The default of 3 attempts only produced ~1.5s of backoff (0.5s/1s), so sustained provider overload (429) surfaced to the user almost immediately. With 10 attempts the exponential ramp (500ms base, x2, 32s cap, 25% jitter) waits out multi-minute overload windows before failing the turn. Applies to both agent-core (chatWithRetry) and agent-core-v2 (stepRetry service); loop_control.max_retries_per_step still overrides.
🦋 Changeset detectedLatest commit: 4bf9dea The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c087503f24
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Default retry budget per step: 10 attempts (9 retries). Kept in sync with | ||
| // v1 (`agent-core/loop/retry.ts`): the exponential ramp below climbs 0.5s, | ||
| // 1s, 2s … up to the 32s cap, giving roughly 2–3 minutes of total wait to | ||
| // ride out a typical provider overload window (sustained 429s). |
There was a problem hiding this comment.
Move retry-budget note into the file header
For files under packages/agent-core-v2, packages/agent-core-v2/AGENTS.md requires comments to live only in the top-of-file /** */ block and never beside functions, methods, or statements. This newly added standalone comment sits next to the exported constant, so please either fold this rationale into the existing module header or remove it from the v2 file.
Useful? React with 👍 / 👎.
- error-paths: the warn-log attempt field now reads 1/10 with the default 10-attempt budget - goal-session pause tests: every LLM call throws a retryable error, so the default 10-attempt backoff (~2min) blew the 5s test timeout; pin maxRetriesPerStep=1 since the pause behavior does not depend on the retry count
Related Issue
No linked issue — the problem is explained below.
Problem
When the provider is rate-limited or overloaded (HTTP 429 "The engine is currently overloaded"), the agent does retry, but the default budget of 3 attempts only spans ~1.5s of backoff (0.5s, 1s). Sustained overload windows last far longer, so the turn fails and surfaces
[provider.rate_limit] 429to the user almost immediately — looking as if no retry happened at all. Session logs confirm this: three attempts within ~20s, all 429, then turn failure.What changed
chatWithRetry) and agent-core-v2 (stepRetryservice), keeping them aligned.Retry-Afterhonoring), 10 attempts yield roughly 2–3 minutes of total wait — enough to ride out typical multi-minute overload windows instead of failing after ~1.5s.loop_control.max_retries_per_stepin config.toml still overrides the default (docs updated, en + zh).step.retryingevents) before the turn fails.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.