Skip to content

Make HTTP retry behavior configurable - #1227

Open
asonnenschein wants to merge 6 commits into
mainfrom
adrians/retry-config
Open

Make HTTP retry behavior configurable#1227
asonnenschein wants to merge 6 commits into
mainfrom
adrians/retry-config

Conversation

@asonnenschein

Copy link
Copy Markdown
Contributor

Adds configurable options for HTTP retry attempts, backoff seconds, and jitter seconds. Keeps original constant values as default if not explicitly configured.

Changes

  • Session accepts optional max_retries, max_retry_backoff, and max_retry_jitter, each falling back to the module default.
    • max_retries=0 disables retry
    • max_retry_jitter=0 makes waits deterministic.
  • Jitter is now applied to thresholded waits. Base wait is now capped at max_retry_backoff - jitter and jitter added afterward, so every wait is jittered and the cap still holds.
  • New top-level CLI options --max-retries, --max-retry-backoff, --max-retry-jitter, passed through to the session via CliSession.
  • Unit tests for the new arguments, retry disabling, context passthrough, and _calculate_wait edge cases; an integration test asserting --max-retries 0 prevents a retry.

asonnenschein and others added 6 commits September 10, 2026 12:09
Accept max_retries and max_retry_backoff as constructor keyword
arguments, defaulting to the existing module-level constants so behavior
is unchanged. A max_retries of zero disables retry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add --max-retries and --max-retry-backoff to the root command group and
pass them through CliSession.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Threshold the base wait before adding jitter so thresholded waits are
jittered instead of collapsing to one value.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add max_retry_jitter to Session and --max-retry-jitter to the CLI.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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