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
hitl_tool: _poll_for_decision ignores interval parameter and always sleeps for POLL_INTERVAL_S #191
Describe the bug hitl_tool accepts a poll_interval: float = POLL_INTERVAL_S argument and forwards it as interval to _poll_for_decision(api_base, request_id, poll_interval, timeout) in src/google/adk_community/tools/hitl/gateway.py. However, inside _poll_for_decision, the sleep call on each poll cycle ignores the interval parameter and hardcodes the module-level POLL_INTERVAL_S constant:
As a result, passing a custom poll_interval to @hitl_tool(agent_name="...", poll_interval=0.25) (or calling _poll_for_decision(..., interval=0.25)) has no effect and always sleeps for POLL_INTERVAL_S (2.0s) plus jitter.
To Reproduce
Decorate a tool with a custom poll_interval, e.g., @hitl_tool(agent_name="credit_agent", poll_interval=0.25).
Have GET /approvals/{id} return {"status": "pending"} on the first poll before transitioning to {"status": "approved"}.
Observe that _poll_for_decision sleeps for POLL_INTERVAL_S + random.uniform(0, POLL_JITTER_S) instead of interval + random.uniform(0, POLL_JITTER_S).
Expected behavior _poll_for_decision should use its interval parameter (await asyncio.sleep(interval + random.uniform(0, POLL_JITTER_S))), while still defaulting to POLL_INTERVAL_S when poll_interval is not explicitly passed to hitl_tool.
Proposed fix
Update _poll_for_decision in src/google/adk_community/tools/hitl/gateway.py to sleep for interval + random.uniform(0, POLL_JITTER_S) and add unit tests in tests/unittests/tools/test_hitl_gateway.py covering custom poll_interval sleep behavior across pending polls and timeout handling.
Activity