You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] google-genai: warn when heartbeats are delayed #573
Is your feature request related to a problem? Please describe.
A slow Vertex AI credential refresh can block the worker’s event loop and delay heartbeats for other running Gemini calls. Those calls can then fail with a heartbeat timeout, without a warning explaining the delay.
Describe the solution you'd like
Log a warning when the heartbeat timer resumes after a delay that could cause a timeout. Include the delay and configured heartbeat timeout, and mention that other calls sharing the loop may be affected.
Additional context
Follow-up to #551. We left the warning out to keep that PR focused on timer heartbeats and the default timeout.
Hi @campoy, I'd like to work on this. Plan: in _heartbeating in python/google_genai/src/temporalio/google_genai/_gemini_activity.py, record the scheduled time with loop.time() and in beat() compare it to when the timer actually fires; if the lateness is large enough to risk a timeout (e.g. over half the interval), log a warning with the delay, the configured heartbeat timeout, and a note that other calls sharing the event loop may be affected. Testing: a test in python/google_genai/tests/ that blocks the loop with a time.sleep longer than the interval inside a heartbeated call and asserts the warning via caplog, plus one with no delay asserting nothing is logged, run with uv run pytest python/google_genai/tests. What threshold would you like for "could cause a timeout": half the interval, or the full remaining timeout? Could you assign it to me?
Activity
rahulsjha commentedon Nov 17, 2026
Hi @campoy, I'd like to work on this. Plan: in
_heartbeatinginpython/google_genai/src/temporalio/google_genai/_gemini_activity.py, record the scheduled time withloop.time()and inbeat()compare it to when the timer actually fires; if the lateness is large enough to risk a timeout (e.g. over half the interval), log a warning with the delay, the configured heartbeat timeout, and a note that other calls sharing the event loop may be affected. Testing: a test inpython/google_genai/tests/that blocks the loop with atime.sleeplonger than the interval inside a heartbeated call and asserts the warning viacaplog, plus one with no delay asserting nothing is logged, run withuv run pytest python/google_genai/tests. What threshold would you like for "could cause a timeout": half the interval, or the full remaining timeout? Could you assign it to me?