Repository navigation
Conversation
|
Would POSIX pipe backpressure/disconnect tests belong in this PR, or should they remain a #3674 follow-up? This scenario goes beyond the stated assumption that the client continues reading stdout. At head Could you clarify the intended disconnect semantics and whether transport-write shutdown shares the handler-drain bound? A separate POSIX candidate uses a one-second writer drain, but that policy has not been agreed with maintainers. The shared Windows hangs remain unresolved. I am not assigned to #3674 and have not submitted these tests. AI assistance was used for the review, diagnostics, and this question. |
Fixes #2678.
When stdin hits EOF (e.g. python server.py < payload.jsonl > response.jsonl), the client is done sending requests but is still reading stdout for results. On main, BaseSession._receive_loop() closes the write stream as soon as the read stream ends, and Server.run() cancels the handler task group on transport close. That combination can cancel in-flight tool handlers before they respond, dropping the last ools/call responses.
This change lets ServerSession keep the write stream open when the read side closes, so Server.run() can drain already-started handlers and flush their responses before shutdown.
Tests: