Skip to content

fix(coding-agent): cap agent-level retry backoff - #11

Merged
junhoyeo merged 1 commit into
developfrom
fix/retry-backoff-cap
Aug 18, 2026
Merged

fix(coding-agent): cap agent-level retry backoff#11
junhoyeo merged 1 commit into
developfrom
fix/retry-backoff-cap

Conversation

@junhoyeo

Copy link
Copy Markdown
Owner

The agent-level retry delay was baseDelayMs * 2 ** (attempt - 1) with no ceiling, so raising retry.maxRetries stopped being a retry policy and became an unbounded sleep. retry.provider.maxRetryDelayMs only bounds provider-requested delays, not this loop.

With maxRetries: 30 and a 1s base the schedule was:

attempt wait cumulative
6 32s 1.1m
10 8.5m 17m
14 2.3h 4.6h
20 6.1d 12d
30 6213d 12427d

Change

  • Added retry.maxBackoffMs (default 60000, 0 disables the cap) and clamped the agent-level delay to it in _handleRetryableError.
  • With the defaults plus maxRetries: 30 the delays are 2s, 4s, 8s, 16s, 32s, then 60s for each remaining attempt, about 26 minutes of retrying instead of 12427 days.
  • Existing behavior is unchanged for the default maxRetries: 3 (2s, 4s, 8s all sit under the cap).

Tests

  • test/suite/agent-session-retry-events.test.ts: asserts the emitted auto_retry_start delays 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, explicit 0 survives, and the legacy retry.maxDelayMs migration still lands on retry.provider.maxRetryDelayMs rather than the new key.
test/settings-manager.test.ts                     39 passed
test/suite/agent-session-retry-events.test.ts     30 passed
test/suite/regressions/4491-provider-stale-after-401.test.ts,
test/suite/regressions/3317-network-connection-lost-retry.test.ts,
test/suite/agent-session-compaction.test.ts       42 passed
npm run check                                     rc=0

…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.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@junhoyeo
junhoyeo merged commit 954e4da into develop Aug 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant