Skip to content

Commit 294e0e4

Browse files
cursoragentZsanz3
andcommitted
fix(flows): collect every sibling answer when checking resume coverage
Name coverage looked only at the last matching response event, so a fully answered parallel pair was treated as incomplete and replayed. Walk every response after the call before testing issubset. Co-authored-by: Zsanz3 <Zsanz3@users.noreply.github.com>
1 parent 34c5427 commit 294e0e4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/google/adk/flows/llm_flows/core/_resume.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ def _needs_call_replay(
198198
Coverage is all-or-nothing: an answer to one parallel call is not
199199
evidence the others ran. Names and ids both have to be covered --
200200
two calls can share a name, so names alone cannot see a missing twin.
201+
`answers` is every function response after the call, not only the last
202+
matching event: parallel answers often arrive separately.
201203
"""
202204
if not call_names:
203205
return False
@@ -262,6 +264,13 @@ def decide_resume(
262264
# short-circuits both unanswered tests rather than being repeated in each.
263265
from_sub_branch = _is_sub_branch_answer(answer_event, call_event)
264266
answers = answer_event.get_function_responses()
267+
# Coverage looks at every response after the call, not only the last
268+
# matching event: parallel answers often arrive as separate events.
269+
all_answers = [
270+
fr
271+
for ev in events[call_idx + 1 :]
272+
for fr in ev.get_function_responses()
273+
]
265274
concrete_call_ids = {i for i in call_ids if i is not None}
266275
# `issubset`, not `&`: one answered id does not cover a sibling that
267276
# never ran. Pause only when nothing matched (no id and no name);
@@ -276,7 +285,7 @@ def decide_resume(
276285
pause = True
277286
elif _needs_call_replay(
278287
call_names,
279-
answers,
288+
all_answers,
280289
from_sub_branch,
281290
call_ids=concrete_call_ids,
282291
answered_ids=answered_ids,

0 commit comments

Comments
 (0)