Interactions retries ignore the documented `initial_delay` and `max_delay` defaults
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- backend-api-design
Research direction
Read types.py around the HttpRetryOptions defaults and _gaos/google_genai.py around _DEFAULT_INITIAL_INTERVAL_MS, then compare those with the retry defaults in _api_client. The issue reports different retry delays and jitter for client.interactions and client.models; decide whether Interactions should use the shared defaults, and verify the retry schedules with the provided no-network repro.
Written by the indexing model from the issue text.
Description
client.interactions backs off half as long as client.models when initial_delay and max_delay are left unset, so the same HttpRetryOptions give two different retry schedules in one client.
Repro at afb10e8 (3.0.0), with no network and no real key:
import time, httpx2
from google import genai
from google.genai import types
stamps = []
def handler(request):
stamps.append(time.monotonic())
return httpx2.Response(503, json={"error": {"code": 503, "message": "unavailable", "status": "UNAVAILABLE"}})
def gaps():
return [round(b - a, 1) for a, b in zip(stamps, stamps[1:])]
retry = types.HttpRetryOptions(attempts=4, jitter=0) # jitter=0 keeps the gaps exact; delays left unset
client = genai.Client(
api_key="test",
http_options=types.HttpOptions(
retry_options=retry, httpx_client=httpx2.Client(transport=httpx2.MockTransport(handler))
),
)
for name, call in [
("models.generate_content", lambda: client.models.generate_content(model="gemini-3.8-flash", contents="hi")),
("interactions.create", lambda: client.interactions.create(model="gemini-3.8-flash", input="hi")),
]:
stamps.clear()
try:
call()
except Exception as e:
print(f"{name}: {len(stamps)} requests, gaps {gaps()} s, {type(e).__name__}")
$ python repro.py
models.generate_content: 4 requests, gaps [1.0, 2.0, 4.0] s, ServerError
interactions.create: 4 requests, gaps [0.5, 1.0, 2.0] s, InternalServerError
HttpRetryOptions documents initial_delay as "If not specified, default to 1.0 second" and max_delay as "default to 60.0 seconds" (types.py:2671-2678). The comment above _DEFAULT_INITIAL_INTERVAL_MS in _gaos/google_genai.py calls 0.5 s and 8 s the default, so one of the two contracts is wrong. An unset jitter differs too: Interactions takes up to 25% off each delay, while client.models adds up to 1 s. #3263 already moved the unset attempts onto _api_client._RETRY_ATTEMPTS. I checked the sync client only.
I'd take all three from _api_client (_RETRY_INITIAL_DELAY, _RETRY_MAX_DELAY, _RETRY_JITTER) in the same way. Or are 0.5 s and 8 s meant to stay specific to Interactions?
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 90
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/python-genai
-
Test import module that doesn't existPossibly taken @Venkaiahbabuneelam claimed this 30 days ago. Openpriority: p2 type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
googleapis/python-genai#3122 · 6 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Curated history keeps half a user turn when the model turn is invalidPossibly taken @Venkaiahbabuneelam claimed this 39 days ago. Openpriority: p2 type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
googleapis/python-genai#3051 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug]: Unsubscripted typing.List and typing.Dict crash convert_if_exist_pydantic_model in AFCPossibly taken @Venkaiahbabuneelam claimed this 39 days ago. Openpriority: p2 type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
googleapis/python-genai#3044 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Structured-output continuation merge raises AttributeError: __pydantic_generic_metadata__ when a hop has parsed JSONPossibly taken @Venkaiahbabuneelam claimed this 3 days ago. Openpriority: p2 type: bug
googleapis/python-genai#3350 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Automatic function calling rejects `datetime` and `UUID` argumentsPossibly taken @Venkaiahbabuneelam claimed this 3 days ago. Openpriority: p2 type: bug
Difficulty 3/5 1-2 days Newbie friendliness 75/100
googleapis/python-genai#3331 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in googleapis/python-genai
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dbt-labs/spark-utils#51 ·
-
bug pydanty:is-working
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pydantic/pydantic-ai#13444 ·
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
changelog investigate
Difficulty 1/5 Under an hour Newbie friendliness 68/100
ramnes/notion-sdk-py#502 ·