fix: Retry on all impit.HTTPError exceptions, not just specific subclasses#624
Merged
fix: Retry on all impit.HTTPError exceptions, not just specific subclasses#624
Conversation
…classes Previously, `is_retryable_error` only retried `impit.NetworkError`, `impit.TimeoutException`, and `impit.RemoteProtocolError`. However, some transient errors (e.g. body decode failures like "unexpected EOF during chunk size line") are raised as bare `impit.HTTPError` instances that don't match any of those subclasses. This caused flaky failures in downstream projects where `wait_for_finish` calls would fail without retrying on transient network issues. Broaden the check to `impit.HTTPError` which is the base class of all impit transport-level exceptions. HTTP status code errors are already handled separately in `_make_request` based on response status codes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #624 +/- ##
==========================================
+ Coverage 76.02% 76.18% +0.16%
==========================================
Files 42 42
Lines 2482 2482
==========================================
+ Hits 1887 1891 +4
+ Misses 595 591 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@barjin Could you please confirm that all |
barjin
approved these changes
Feb 18, 2026
Member
barjin
left a comment
There was a problem hiding this comment.
impit is an HTTP client, all of its errors are HTTPError subclasses 😅 But yes, given the error typing might have some rough edges, this change is sound.
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.
Summary
is_retryable_error()to catchimpit.HTTPError(base class) instead of onlyimpit.NetworkError,impit.TimeoutException, andimpit.RemoteProtocolErrorimpitas bareHTTPErrorinstances that don't match any of the specific subclasses, causing requests to fail without retrying_make_requestbased on response status codes, so this change only affects transport-level failuresTriggered by: flaky e2e test failure in apify-sdk-python where
wait_for_finishfailed with:Test plan
is_retryable_errorcovering allimpitexception types (retryable) and generic exceptions (non-retryable)test_retry_on_http_error_async_clientthat verifies bareHTTPErroris actually retried by the HTTP client🤖 Generated with Claude Code