UN-3232 [FEAT] Implement back-off retry mechanism with deadline-aware timeout budgeting#29
Merged
jaseemjaskp merged 1 commit intomainfrom Feb 16, 2026
Conversation
… timeout budgeting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
johnyrahul
approved these changes
Feb 13, 2026
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.
What
deadlineparameter to_send_request()to cap total retry time within a caller-specified budgetwhisper()to usewait_timeoutas the total time budget (POST + polling)Why
wait_timeoutwas misused as the raw HTTP timeout, so worst-case total time could reach ~900s when the user expected 180sHow
max_retries,retry_min_wait,retry_max_waitconstructor parameters toLLMWhispererClientV2_RetryableHTTPErrorwrapper,_is_retryable(),_log_retry(),_retry_wait()(with Retry-After header support for 429s)_send_request()uses tenacity with exponential jitter backoff,stop_after_attempt, and optionalstop_after_delayvia thedeadlineparameterwhisper()now setsstart_timebefore the POST, computesdeadline = start_time + wait_timeout, and passespost_timeout = min(api_timeout, wait_timeout)so POST + polling stays within the user's budgetpytest-mockdev dependency and comprehensive unit tests (15 retry tests + 4 deadline/timeout tests)CONTRIBUTING.mdwith development setup, testing, and contribution guidelinesconftest.pyCan this PR break any existing features. If yes, please list possible items. If no, please explain why.
max_retries=3). Thedeadlineparameter defaults toNone, preserving existing_send_request()behavior for all callers exceptwhisper(). Thewhisper()public API signature is unchanged — only internal timeout logic was corrected. All existing tests continue to pass.Database Migrations
Env Config
Relevant Docs
client_v2.py)Related Issues or PRs
Dependencies Versions
pytest-mock ~=3.14as dev dependencyNotes on Testing
uv run pytest tests/unit/client_v2_test.py -v— all 19 tests passtest_whisper_post_uses_min_of_api_timeout_and_wait_timeout,test_whisper_post_uses_wait_timeout_when_smaller,test_send_request_deadline_caps_timeout,test_send_request_deadline_stops_retriesScreenshots
Checklist
I have read and understood the Contribution Guidelines.