Skip to content

Commit c1af36b

Browse files
authored
Merge pull request #1 from tottenjordan/fix-5064-long-running-resume-ci-fixes
fix: resolve pyink, mypy, and test failures in has_unresolved_long_running_tool_calls
2 parents a7b2b73 + 4598c3d commit c1af36b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/google/adk/agents/invocation_context.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,7 @@ def should_pause_invocation(self, event: Event) -> bool:
396396

397397
return False
398398

399-
def has_unresolved_long_running_tool_calls(
400-
self, events: list[Event]
401-
) -> bool:
399+
def has_unresolved_long_running_tool_calls(self, events: list[Event]) -> bool:
402400
"""Returns whether any long-running tool call in events is unresolved."""
403401
if not self.is_resumable or not events:
404402
return False
@@ -407,7 +405,7 @@ def has_unresolved_long_running_tool_calls(
407405
function_response.id
408406
for event in events
409407
for function_response in event.get_function_responses()
410-
if function_response.id
408+
if function_response.id and event.author == 'user'
411409
}
412410

413411
for event in reversed(events):
@@ -417,7 +415,7 @@ def has_unresolved_long_running_tool_calls(
417415
paused_function_call_ids = {
418416
function_call.id
419417
for function_call in event.get_function_calls()
420-
if function_call.id in event.long_running_tool_ids
418+
if event.long_running_tool_ids and function_call.id in event.long_running_tool_ids
421419
}
422420
if paused_function_call_ids - function_response_ids:
423421
return True

0 commit comments

Comments
 (0)