From 07264340ee264bf9571a86c0b8dc0ec9c9ad0cfc Mon Sep 17 00:00:00 2001 From: Pranav Senthilnathan Date: Wed, 15 Jul 2026 17:34:44 -0700 Subject: [PATCH] Disable server/discover probe timeout in in-memory tests (#1701) On slow Windows Debug CI, the default 5s DiscoverProbeTimeout can be spuriously exceeded when a July2026-capable client probes server/discover over the in-memory pipe. The client then falls back to the initialize handshake and negotiates an older protocol, dropping tasks-extension negotiation. For TaskCancellationIntegrationTests, whose tool runs Task.Delay(Timeout.Infinite), the fallback makes the server run the tool inline instead of as a background task, so the tools/call never returns and the test host hangs until the blame timeout. Force DiscoverProbeTimeout = Timeout.InfiniteTimeSpan in ClientServerTestBase.CreateMcpClientForServer. The in-memory pipe server always answers server/discover immediately, so the probe never legitimately needs to time out. This is applied even when a caller supplies its own options so no test can reintroduce the flake. Tests that intentionally exercise the probe-timeout fallback (July2026ProtocolFallbackTests) build their own transport and bypass this helper, so they are unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/ModelContextProtocol.Tests/ClientServerTestBase.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs b/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs index 564225abd..76eaac5ac 100644 --- a/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs +++ b/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs @@ -86,6 +86,12 @@ public async ValueTask DisposeAsync() protected async Task CreateMcpClientForServer(McpClientOptions? clientOptions = null) { + clientOptions ??= new McpClientOptions(); + + // Disable the server/discover probe timeout to avoid CI slowness spuriously tripping it (issue #1701). + // Tests that need a specific probe timeout should create their own client instead of using this helper. + clientOptions.DiscoverProbeTimeout = Timeout.InfiniteTimeSpan; + return await McpClient.CreateAsync( new StreamClientTransport( serverInput: _clientToServerPipe.Writer.AsStream(),