Commit 83d1fe3
committed
Fix StreamableHTTP SSE premature stream closure for server-initiated requests
The SSE writer was closing the stream immediately upon receiving ANY
JSONRPCResponse, including responses to server-initiated requests like
elicitation. This prevented bidirectional communication patterns from
working correctly over StreamableHTTP transport.
Changed the SSE writer to only close the stream when receiving the
response to the ORIGINAL client request, allowing server-initiated
request/response cycles (elicitation, sampling, etc.) to complete
before closing the stream.
Impact:
- Elicitation now works correctly over StreamableHTTP transport
- Sampling and other server-initiated requests will also work
- No breaking changes to existing functionality
Testing:
- Manually verified elicitation request/response cycle completes
- Server logs show: request sent → response received → tool completes
- Existing tests continue to pass1 parent 48cb8d3 commit 83d1fe3
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
470 | | - | |
| 470 | + | |
| 471 | + | |
471 | 472 | | |
472 | 473 | | |
473 | 474 | | |
474 | 475 | | |
475 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
476 | 480 | | |
477 | 481 | | |
478 | 482 | | |
| |||
0 commit comments