Skip to content

[Feature Request] google-genai: warn when heartbeats are delayed #573

Open

Description

@campoy

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.

Activity

  1. added
    enhancement
    on Nov 16, 2026
  2. rahulsjha commented on Nov 17, 2026

    @rahulsjha

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions