Commit 2f489f4
committed
fix: avoid false-positive retries on sub-agent and no-tool-call responses
The empty response retry was too aggressive — it triggered on:
1. Sub-agents (AgentTool, ParallelAgent) that legitimately return no content
2. First LLM calls with no prior tool execution
Fixes:
- Add null guard for last_event in is_final_response check (NoneType crash)
- Only retry after at least one tool call in the invocation, since the
bug only manifests when models return empty after processing tool results
- Remove append_event for resume message (caused session state corruption
in pause/resume flows and leaked to UI)
- Silent retry instead (proven 100% recovery rate in production tests)
- Update scenario tests to include tool call before empty response1 parent 1ce76f7 commit 2f489f4
File tree
3 files changed
+146
-185
lines changed- src/google/adk/flows/llm_flows
- tests/unittests/flows/llm_flows
3 files changed
+146
-185
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | 72 | | |
80 | 73 | | |
81 | 74 | | |
| |||
782 | 775 | | |
783 | 776 | | |
784 | 777 | | |
| 778 | + | |
785 | 779 | | |
786 | 780 | | |
787 | 781 | | |
788 | 782 | | |
789 | 783 | | |
790 | 784 | | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
791 | 790 | | |
792 | 791 | | |
793 | 792 | | |
794 | | - | |
795 | | - | |
| 793 | + | |
796 | 794 | | |
797 | | - | |
| 795 | + | |
798 | 796 | | |
799 | 797 | | |
800 | | - | |
801 | | - | |
802 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
803 | 803 | | |
804 | 804 | | |
805 | | - | |
| 805 | + | |
| 806 | + | |
806 | 807 | | |
807 | 808 | | |
808 | 809 | | |
| |||
815 | 816 | | |
816 | 817 | | |
817 | 818 | | |
| 819 | + | |
818 | 820 | | |
819 | 821 | | |
820 | 822 | | |
821 | 823 | | |
822 | | - | |
823 | | - | |
| 824 | + | |
824 | 825 | | |
825 | 826 | | |
826 | 827 | | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | 828 | | |
848 | 829 | | |
849 | 830 | | |
| |||
Lines changed: 9 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
99 | 100 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 101 | + | |
106 | 102 | | |
107 | 103 | | |
108 | 104 | | |
| |||
116 | 112 | | |
117 | 113 | | |
118 | 114 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 115 | + | |
| 116 | + | |
125 | 117 | | |
126 | 118 | | |
127 | 119 | | |
| |||
0 commit comments