Repository navigation
Commit 89772bf
committed
Drop a buffered notification that cannot be generated
## Motivation and Context
On the 2026-07-28 path the Streamable HTTP transport buffers the notifications a handler emits during a request
and writes them as SSE frames ahead of the response once the handler returns. A notification holding a string
that is not valid UTF-8, such as log data a tool passed to `notify_log_message`, raised `JSON::GeneratorError`
while the frames were written, and the whole exchange was answered with 500, losing the response the handler
had produced.
The transport now generates each notification when it is buffered. One that cannot be generated is reported to
the exception reporter and dropped as non-delivery (`false`), as the buffer already does past its cap, and
the other notifications and the response are written as before.
## How Has This Been Tested?
`test/mcp/server/transports/streamable_http_transport_test.rb`. Against the previous library the new test
answers 500.
## Breaking Changes
None.1 parent 37270d6 commit 89772bf
2 files changed
Lines changed: 52 additions & 3 deletions
File tree
- lib/mcp/server/transports
- test/mcp/server/transports
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
524 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
525 | 527 | | |
526 | 528 | | |
527 | 529 | | |
528 | 530 | | |
529 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
530 | 537 | | |
531 | 538 | | |
532 | 539 | | |
| |||
949 | 956 | | |
950 | 957 | | |
951 | 958 | | |
952 | | - | |
| 959 | + | |
953 | 960 | | |
954 | 961 | | |
955 | 962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6561 | 6561 | | |
6562 | 6562 | | |
6563 | 6563 | | |
| 6564 | + | |
| 6565 | + | |
| 6566 | + | |
| 6567 | + | |
| 6568 | + | |
| 6569 | + | |
| 6570 | + | |
| 6571 | + | |
| 6572 | + | |
| 6573 | + | |
| 6574 | + | |
| 6575 | + | |
| 6576 | + | |
| 6577 | + | |
| 6578 | + | |
| 6579 | + | |
| 6580 | + | |
| 6581 | + | |
| 6582 | + | |
| 6583 | + | |
| 6584 | + | |
| 6585 | + | |
| 6586 | + | |
| 6587 | + | |
| 6588 | + | |
| 6589 | + | |
| 6590 | + | |
| 6591 | + | |
| 6592 | + | |
| 6593 | + | |
| 6594 | + | |
| 6595 | + | |
| 6596 | + | |
| 6597 | + | |
| 6598 | + | |
| 6599 | + | |
| 6600 | + | |
| 6601 | + | |
| 6602 | + | |
| 6603 | + | |
| 6604 | + | |
| 6605 | + | |
6564 | 6606 | | |
6565 | 6607 | | |
6566 | 6608 | | |
| |||
0 commit comments