Repository navigation
fix(hitl): respect poll_interval parameter in _poll_for_decision - #192
Open
RobinaMirbahar wants to merge 1 commit into
Open
RobinaMirbahar wants to merge 1 commit into
RobinaMirbahar wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
_poll_for_decisionignoresintervalparameter and always sleeps forPOLL_INTERVAL_S#191Problem:
hitl_toolaccepts apoll_interval: float = POLL_INTERVAL_Sparameter and passes it asintervalto_poll_for_decision(api_base, request_id, poll_interval, timeout)insrc/google/adk_community/tools/hitl/gateway.py. However, inside_poll_for_decision, the sleep call hardcoded the module-levelPOLL_INTERVAL_Sconstant (await asyncio.sleep(POLL_INTERVAL_S + random.uniform(0, POLL_JITTER_S))) instead of using theintervalparameter. Consequently, passing a custompoll_intervalto@hitl_tool(agent_name="...", poll_interval=...)had no effect on polling delay.Solution:
_poll_for_decisioninsrc/google/adk_community/tools/hitl/gateway.pyto useinterval + random.uniform(0, POLL_JITTER_S)when sleeping between pending poll cycles. Callers omittingpoll_intervalcontinue to default toPOLL_INTERVAL_S(ADK_HITL_POLL_INTERVAL_S).tests/unittests/tools/test_hitl_gateway.pyverifying that a custompoll_intervalis passed toasyncio.sleepwhile polling a"pending"request and thatTimeoutErroris raised when polling exceedstimeout.Testing Plan
1. Unit Tests (Command & Logs)
uv sync --extra test pytest tests/unittests/tools/test_hitl_gateway.py -v pytest tests/unittestsVerifiable Test Execution Log Output:
Checklist