fix(coding-agent): cap agent-level retry backoff - #11
Merged
Conversation
…ffMs The agent-level retry delay grew as baseDelayMs * 2 ** (attempt - 1) with no ceiling, so raising retry.maxRetries turned the retry loop into an unbounded sleep: 30 attempts at a 1s base reach a 6213-day wait, and retry.provider.maxRetryDelayMs only bounds provider-requested delays. Clamp the delay to the new retry.maxBackoffMs setting (default 60s, 0 disables the cap), so a large maxRetries polls on a bounded interval.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The agent-level retry delay was
baseDelayMs * 2 ** (attempt - 1)with no ceiling, so raisingretry.maxRetriesstopped being a retry policy and became an unbounded sleep.retry.provider.maxRetryDelayMsonly bounds provider-requested delays, not this loop.With
maxRetries: 30and a 1s base the schedule was:Change
retry.maxBackoffMs(default60000,0disables the cap) and clamped the agent-level delay to it in_handleRetryableError.maxRetries: 30the delays are 2s, 4s, 8s, 16s, 32s, then 60s for each remaining attempt, about 26 minutes of retrying instead of 12427 days.maxRetries: 3(2s, 4s, 8s all sit under the cap).Tests
test/suite/agent-session-retry-events.test.ts: asserts the emittedauto_retry_startdelays are[1, 2, 4, 4, 4]under a cap and[1, 2, 4, 8]when the cap is disabled. Mutation-checked: reverting the clamp fails the first with[1, 2, 4, 8, 16].test/settings-manager.test.ts: default is 60s, explicit0survives, and the legacyretry.maxDelayMsmigration still lands onretry.provider.maxRetryDelayMsrather than the new key.