Commit 4d165ef
fix: exit connection cleanly on expected GoAway signal in bidi streaming
Receive the GoAway signal from the Gemini Live API, set a flag on the InvocationContext indicating reconnection is requested, and exit the receive generator cleanly instead of raising a ConnectionClosed exception. This avoids throwing expected session-recycling exceptions into custom client wrappers, which helps prevent false alarms in custom client log monitors.
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 9375866041 parent 0b79f8d commit 4d165ef
2 files changed
Lines changed: 26 additions & 5 deletions
File tree
- src/google/adk/flows/llm_flows
- tests/unittests/flows/llm_flows
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| |||
623 | 628 | | |
624 | 629 | | |
625 | 630 | | |
| 631 | + | |
626 | 632 | | |
627 | 633 | | |
628 | 634 | | |
| |||
633 | 639 | | |
634 | 640 | | |
635 | 641 | | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
636 | 645 | | |
637 | 646 | | |
638 | 647 | | |
| |||
713 | 722 | | |
714 | 723 | | |
715 | 724 | | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
716 | 728 | | |
717 | 729 | | |
718 | 730 | | |
| |||
852 | 864 | | |
853 | 865 | | |
854 | 866 | | |
855 | | - | |
856 | | - | |
857 | | - | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
858 | 870 | | |
859 | 871 | | |
860 | 872 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
939 | 940 | | |
940 | 941 | | |
941 | 942 | | |
| 943 | + | |
942 | 944 | | |
943 | | - | |
944 | | - | |
| 945 | + | |
| 946 | + | |
945 | 947 | | |
946 | 948 | | |
947 | 949 | | |
948 | 950 | | |
949 | 951 | | |
950 | 952 | | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
951 | 960 | | |
952 | 961 | | |
953 | 962 | | |
| |||
0 commit comments