Skip to content

fix: retry transient transport errors on a fresh async connection - #77

Merged
acrogenesis merged 2 commits into
mainfrom
acrogenesis/ops-async-transient-transport-retry
Jun 25, 2026
Merged

fix: retry transient transport errors on a fresh async connection#77
acrogenesis merged 2 commits into
mainfrom
acrogenesis/ops-async-transient-transport-retry

review: tighten retry test (distinct stale/fresh clients), trim comme…

60793f2
Select commit
Loading
Failed to load commit list.
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_connection is extracted as a static method with a clear docstring, and the TRANSIENT_TRANSPORT_ERRORS tuple is documented at the module level.
  • ReadTimeout is correctly excluded from the retry set (it is caught by except httpx.RequestError but _should_retry... returns False, causing a re-raise); ConnectTimeout/PoolTimeout are 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 execute retries on a bare Exception; the async change narrows this to a well-defined set while preserving the one-shot retry pattern.