aiohttp timeout and wrapped google-auth transport exceptions are not retried despite HttpRetryOptions being configured
Maintainer antworten meist innerhalb von 1 Tag
@Venkaiahbabuneelam arbeitet bereits daran.
Seit 11.11.2026.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 72/100
Rechercherichtung
Start in google/genai/_api_client.py at retry_args() and _AIOHTTP_TRANSIENT_EXC, then trace _async_request_once() to understand how authenticated transport exceptions are handled. Reproduce the listed predicates and add coverage for the timeout and wrapped transport cases, while checking that payload and refresh errors remain non-retryable and the no-retry_options path is unchanged.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
When HttpRetryOptions is configured and aiohttp is used as the async HTTP transport (google-genai[aiohttp]), request timeouts and wrapped google.auth.aio transport exceptions bypass retry_args() and fail on the first attempt without retrying.
Specifically:
asyncio.TimeoutError(andaiohttp.ServerTimeoutError/aiohttp.ConnectionTimeoutError):
While_HTTPX_TRANSIENT_EXCincludeshttpx.TimeoutExceptionandhttpx2.TimeoutException(added in #2345 for #2337),_AIOHTTP_TRANSIENT_EXConly lists(aiohttp.ClientConnectorError, aiohttp.ClientOSError, aiohttp.ServerDisconnectedError). Inaiohttp,ClientTimeout(total=...)(TimerContext.__exit__) raisesasyncio.TimeoutErrordirectly, andaiohttp.ServerTimeoutError/ConnectionTimeoutErrorinherit from(aiohttp.ClientConnectionError, asyncio.TimeoutError), notClientConnectorError,ClientOSError, orServerDisconnectedError.google.auth.exceptions.TimeoutError(auth_exceptions.TimeoutError):
When Vertex AI mTLS is used (_use_google_auth_async() == True),_get_aiohttp_session()returnsgoogle.auth.aio.transport.sessions.AsyncAuthorizedSession. Bothgoogle.auth.aio.transport.aiohttp.Request.__call__andgoogle.auth.aio.transport.sessions.timeout_guardcatchasyncio.TimeoutErrorand raisegoogle.auth.exceptions.TimeoutError(which inherits fromGoogleAuthError, notbuiltins.TimeoutErrororaiohttp.ClientError).google.auth.exceptions.TransportErrorwrapping_AIOHTTP_TRANSIENT_EXC:
UnderAsyncAuthorizedSession,google.auth.aio.transport.aiohttp.Request.__call__catchesaiohttp.ClientErrorand raisesgoogle.auth.exceptions.TransportError(...) from caught_exc. In_async_request_once(), theexcept (..., auth_exceptions.TransportError)block re-raises whenretry_optionsis configured (raise # HttpRetryOptions owns retries; tenacity decides.), butretry_args()does not matchauth_exceptions.TransportErrorwrapping_AIOHTTP_TRANSIENT_EXC.
Steps to reproduce
import asyncio
from google.auth import exceptions as auth_exceptions
from google.genai import _api_client as api_client
from google.genai import types
import aiohttp
retry = api_client.retry_args(types.HttpRetryOptions())['retry']
print("asyncio.TimeoutError retried:", retry.predicate(asyncio.TimeoutError()))
print("aiohttp.ServerTimeoutError retried:", retry.predicate(aiohttp.ServerTimeoutError()))
print("google.auth.exceptions.TimeoutError retried:", retry.predicate(auth_exceptions.TimeoutError("Request timed out")))
Output on main:
asyncio.TimeoutError retried: False
aiohttp.ServerTimeoutError retried: False
google.auth.exceptions.TimeoutError retried: False
Expected behavior
When HttpRetryOptions is configured, retry_args() should retry asyncio.TimeoutError (including aiohttp.ServerTimeoutError and aiohttp.ConnectionTimeoutError), google.auth.exceptions.TimeoutError, and google.auth.exceptions.TransportError whose __cause__ is in _AIOHTTP_TRANSIENT_EXC, matching the httpx.TimeoutException behavior from #2337 / #2345 while keeping non-transient errors (such as aiohttp.ClientPayloadError and google.auth.exceptions.RefreshError) and the no-retry_options path unchanged.
- Vorherrschende Sprache
- Python
- Sterne
- 4.1k
- Forks
- 1.1k
- Ø Merge
- 1 T. 20 Std.
- Gemergte PRs (30 T.)
- 90
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/python-genai
-
Interactions retries ignore the documented `initial_delay` and `max_delay` defaultsEvtl. vergeben @Venkaiahbabuneelam hat das vor 5 Tagen übernommen. Offenpriority: p2 status:awaiting user response type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
googleapis/python-genai#3317 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Test import module that doesn't existEvtl. vergeben @Venkaiahbabuneelam hat das vor 31 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
googleapis/python-genai#3122 · 6 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Curated history keeps half a user turn when the model turn is invalidEvtl. vergeben @Venkaiahbabuneelam hat das vor 39 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
googleapis/python-genai#3051 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug]: Unsubscripted typing.List and typing.Dict crash convert_if_exist_pydantic_model in AFCEvtl. vergeben @Venkaiahbabuneelam hat das vor 39 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
googleapis/python-genai#3044 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Structured-output continuation merge raises AttributeError: __pydantic_generic_metadata__ when a hop has parsed JSONEvtl. vergeben @Venkaiahbabuneelam hat das vor 3 Tagen übernommen. Offenpriority: p2 type: bug
googleapis/python-genai#3350 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in googleapis/python-genai
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
OCA/account-invoicing#2529 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area/ci
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textOffenbug imagen skills
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Email validation accepts a trailing newlineEvtl. vergeben @marcello-pichini hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag