Commit 0c77367
OpenSourceMaintenance-Luccc-grok-4.5
fix(server): terminate streamable HTTP sessions on manager shutdown
Why: On CTRL+C / lifespan exit with live SSE clients, StreamableHTTPSessionManager
cancelled the task group without terminating transports, and terminate() left
_sse_stream_writers open — uvicorn then logs "ASGI callable returned without
completing response" (#2150).
- Manager run() finally: await terminate() on active transports before cancel
- terminate(): close all SSE writers first (incl. GET + provisional replay keys)
- Register GET standalone writer immediately; provisional key during replay
- Regression tests for writer close + manager shutdown path
Rebased onto current main after #3125 was closed unmerged during v2 backlog
cleanup (maintainers pointed at #2253 on v1.x; this targets main with tests).
Signed-off-by: Atlas/luccc-grok-4.5 <atlas@agent-studio.local>1 parent a4f4ccd commit 0c77367
3 files changed
Lines changed: 129 additions & 2 deletions
File tree
- src/mcp/server
- tests/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
| 737 | + | |
| 738 | + | |
737 | 739 | | |
738 | 740 | | |
739 | 741 | | |
| |||
757 | 759 | | |
758 | 760 | | |
759 | 761 | | |
| 762 | + | |
760 | 763 | | |
761 | 764 | | |
762 | 765 | | |
763 | 766 | | |
764 | 767 | | |
| 768 | + | |
765 | 769 | | |
766 | 770 | | |
767 | 771 | | |
| |||
778 | 782 | | |
779 | 783 | | |
780 | 784 | | |
| 785 | + | |
781 | 786 | | |
782 | 787 | | |
783 | 788 | | |
| |||
808 | 813 | | |
809 | 814 | | |
810 | 815 | | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
811 | 819 | | |
812 | 820 | | |
813 | 821 | | |
814 | 822 | | |
815 | 823 | | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
816 | 829 | | |
817 | 830 | | |
818 | 831 | | |
| |||
910 | 923 | | |
911 | 924 | | |
912 | 925 | | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
913 | 930 | | |
914 | 931 | | |
| 932 | + | |
915 | 933 | | |
916 | 934 | | |
917 | 935 | | |
| |||
925 | 943 | | |
926 | 944 | | |
927 | 945 | | |
928 | | - | |
| 946 | + | |
| 947 | + | |
929 | 948 | | |
| 949 | + | |
930 | 950 | | |
931 | 951 | | |
932 | 952 | | |
| |||
948 | 968 | | |
949 | 969 | | |
950 | 970 | | |
951 | | - | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
952 | 975 | | |
953 | 976 | | |
954 | 977 | | |
955 | 978 | | |
956 | 979 | | |
957 | 980 | | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
958 | 985 | | |
959 | 986 | | |
960 | 987 | | |
| |||
968 | 995 | | |
969 | 996 | | |
970 | 997 | | |
| 998 | + | |
971 | 999 | | |
972 | 1000 | | |
973 | 1001 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
156 | 168 | | |
157 | 169 | | |
158 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
0 commit comments