Skip to content

Comments

UN-3235 [FEAT] Add retry with exponential backoff for transient failures#14

Merged
muhammad-ali-e merged 1 commit intomainfrom
feat/UN-3235-FEAT_add_retry_with_exponential_backoff
Feb 18, 2026
Merged

UN-3235 [FEAT] Add retry with exponential backoff for transient failures#14
muhammad-ali-e merged 1 commit intomainfrom
feat/UN-3235-FEAT_add_retry_with_exponential_backoff

Conversation

@muhammad-ali-e
Copy link
Contributor

What

  • Add automatic retry with configurable exponential backoff to both V1 and V2 clients
  • Add comprehensive retry unit tests and improve integration test robustness

Why

  • Transient server errors (5xx) and rate limits (429) cause unnecessary failures
  • Network interruptions (ECONNRESET, ETIMEDOUT) should be retried transparently
  • Highlight integration test was timing out at 20s; webhook test was hardcoded to a specific URL

How

  • Integrated axios-retry into both client constructors with configurable parameters (maxRetries, initialDelay, maxDelay, backoffFactor, jitter)
  • Each client creates its own axios.create() instance to isolate retry config
  • Synchronous whisper (timeout > 0) and registerWebhook disable retries to avoid duplicate processing
  • File streams are re-created via onRetry callback to handle consumed streams
  • Added 577-line test/retry.test.js with mocked adapter tests
  • Fixed integration test timeouts and conditional test skipping

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No breaking changes. The retry behaviour is additive with sensible defaults (4 retries). Existing callers that never hit 5xx/429/network errors see zero difference. Retries can be disabled by passing maxRetries: 0.

Database Migrations

  • None

Env Config

  • Added optional LLMWHISPERER_WEBHOOK_URL in test/sample.env (test-only, not required for production)

Relevant Docs

Related Issues or PRs

Dependencies Versions

  • Added axios-retry@^4.5.0

Notes on Testing

  • npm test passes with mocked retry tests (no API key needed)
  • Integration tests skip gracefully when LLMWHISPERER_API_KEY is unset
  • Webhook test skips when LLMWHISPERER_WEBHOOK_URL is unset

Screenshots

N/A

Checklist

I have read and understood the Contribution Guidelines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@muhammad-ali-e muhammad-ali-e merged commit c54cc69 into main Feb 18, 2026
2 checks passed
@muhammad-ali-e muhammad-ali-e deleted the feat/UN-3235-FEAT_add_retry_with_exponential_backoff branch February 18, 2026 04:10
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.

4 participants