Repository navigation
Prevent discovery probe timeouts in controlled test connections - #1946
Conversation
jeffhandley
left a comment
There was a problem hiding this comment.
Nice! Looks good to me. The only other thing I would suggest is setting TestConstants.DefaultTimeout to be a property getter that would respect an environment variable to override the 60s hard-coded value, but I don't think we need to introduce that unless we see any further flakiness where 60s isn't always enough in CI, but gosh I hope it is.
Thanks, this is a good idea, let's wait to see any scenario need it and I'll be happy to add it. |
modelcontextprotocol#1943 and modelcontextprotocol#1946 give stdio test_server clients an unbounded server/discover probe when a test passes no options, and leave options a test passes unchanged. Sampling_Stdio passes options for its sampling handler without pinning a protocol version, so its test_server case still used the 5-second probe and could fall back to initialize while the discover answer was on its way; the server then rejects initialize. Start its test_server options from TestMcpClient.CreateOptions(), as CONTRIBUTING.md asks; the everything server keeps the default probe.
Summary
Extend the test-only discovery timeout protection from #1943 to the remaining affected controlled-server connections.
TestMcpClienthelper that disables the separate discovery probe timer while retaining the 60-second overall initialization deadline. Explicitly supplied options remain unchanged.Why
A controlled server can take longer than the default five-second discovery probe budget to respond on a busy CI runner. The client then attempts legacy fallback even though the server supports the modern protocol. For tests pinned to the modern version, this surfaces as a misleading unsupported-protocol error before the behavior under test executes.
This is the connection failure observed in
MapMcpStatelessTests.Mrtr_ConcurrentThreeInputs_ResolvedSimultaneouslyon #1934. The existing fix covered only selected helpers; other direct and shared connection paths retained the short probe budget.Validation