fix: retry transient transport errors on a fresh async connection - #77
Merged
acrogenesis merged 2 commits intoJun 25, 2026
Merged
Palantir - Valiot / Palantir PR Reviewer
succeeded
Jun 25, 2026 in 17s
Approved
Overall Assessment
This PR adds retry-on-fresh-connection logic to async_execute for transient transport errors (httpx.NetworkError, RemoteProtocolError, PoolTimeout, ConnectTimeout) plus the existing "Event loop is closed" case. The sync execute path already retried on any exception; the async path now does so selectively. Implementation and tests are sound; no blocking bugs found.
Findings
No actionable findings.
Notes
- The predicate
_should_retry_on_fresh_connectionis extracted as a static method with a clear docstring, and theTRANSIENT_TRANSPORT_ERRORStuple is documented at the module level. ReadTimeoutis correctly excluded from the retry set (it is caught byexcept httpx.RequestErrorbut_should_retry...returns False, causing a re-raise);ConnectTimeout/PoolTimeoutare included because they indicate connection establishment failure rather than request slowness.- The new test file provides parametrized coverage of the predicate plus an integration test that verifies the stale→fresh client swap and a negative test for
ReadTimeout. All tests are fast and hermetic (no real sockets). - The sync
executeretries on a bareException; the async change narrows this to a well-defined set while preserving the one-shot retry pattern.
Loading