Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: use Mono.when instead of Mono.zip for stdio readiness signals
StdioServerTransportProvider.sendMessage waited on inbound/outbound
readiness with Mono.zip. Both inboundReady and outboundReady are
Sinks.One<Void> that complete empty (tryEmitValue(null)), and Mono.zip
requires every source to emit a value: when one source completes empty
it short-circuits and cancels the others. As a result sendMessage could
proceed before both streams were actually ready instead of waiting for
both.

Mono.when subscribes to all sources and completes only once all of them
complete, which is the correct combinator for completion-only
(Mono<Void>) signals.

Fixes #303
  • Loading branch information
k-krawczyk committed May 28, 2026
commit db594e68696a8257b5a0c6110d082d6111142615
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public StdioMcpSessionTransport() {
@Override
public Mono<Void> sendMessage(McpSchema.JSONRPCMessage message) {

return Mono.zip(inboundReady.asMono(), outboundReady.asMono()).then(Mono.defer(() -> {
return Mono.when(inboundReady.asMono(), outboundReady.asMono()).then(Mono.defer(() -> {
if (outboundSink.tryEmitNext(message).isSuccess()) {
return Mono.empty();
}
Expand Down