Repository navigation
Conversation
|
One edge case appears to leave the original silent-stdio hang intact for custom/wrapped transports.
This is especially easy to hit for instrumentation/filtering wrappers (the codebase already has precedent for wrapped transport/connection types). Could stdio/discover-timeout capability be preserved through a small optional interface/marker, or otherwise made wrapper-safe, instead of relying only on the concrete outer transport type? A regression can wrap the same silent AI assistance was used to inspect the patch; no acceptance/merge claim is implied. |
d8b43e6 to
c481cad
Compare
|
Thanks, good catch. I switched the check from the transport type to the connection it returns. The probe is now bounded whenever the connection is a newline-delimited stream connection ( A wrapper that also wraps the |
On stdio transports, a handshake-era server may silently ignore
server/discover, which the stdio spec permits.Connectthen blocked until the caller's context expired and never reached theinitializefallback, which reused the same expired context.Connectnow bounds the discover probe when the transport's connection is a newline-delimited stream connection. That coversCommandTransport,IOTransport,StdioTransportandInMemoryTransport, including throughLoggingTransportor a custom transport that returns the inner connection. The bound is set by the newClientSessionOptions.DiscoverTimeout: 10s by default, disabled by a negative value, and never more than half of the caller's remaining deadline. On timeoutConnectfalls back toinitializeas for any other discover error. HTTP transports are unchanged.A modern stdio server that answers discover only after the probe times out still connects through
initialize, so it gets the 2025-11-25 protocol. Its late discover reply is dropped.Fixes #1332