From 07264340ee264bf9571a86c0b8dc0ec9c9ad0cfc Mon Sep 17 00:00:00 2001 From: Pranav Senthilnathan Date: Wed, 15 Jul 2026 17:34:44 -0700 Subject: [PATCH 1/3] 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(), From 0c3045504000a2339b9d06fde3b9f3c71fa3da24 Mon Sep 17 00:00:00 2001 From: Pranav Senthilnathan Date: Fri, 24 Jul 2026 16:18:29 -0700 Subject: [PATCH 2/3] Update tests/ModelContextProtocol.Tests/ClientServerTestBase.cs Co-authored-by: Stephen Halter --- tests/ModelContextProtocol.Tests/ClientServerTestBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs b/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs index 76eaac5ac..1bb37ae51 100644 --- a/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs +++ b/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs @@ -90,7 +90,7 @@ protected async Task CreateMcpClientForServer(McpClientOptions? clien // 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; + clientOptions.DiscoverProbeTimeout = TestConstant.DefaultTimeout; return await McpClient.CreateAsync( new StreamClientTransport( From 5ccb2d2e2b76d20e97ec74c1e987938ac0baed12 Mon Sep 17 00:00:00 2001 From: Pranav Senthilnathan Date: Fri, 24 Jul 2026 16:20:33 -0700 Subject: [PATCH 3/3] Apply suggestion from @PranavSenthilnathan --- tests/ModelContextProtocol.Tests/ClientServerTestBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs b/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs index 1bb37ae51..4e500b5ab 100644 --- a/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs +++ b/tests/ModelContextProtocol.Tests/ClientServerTestBase.cs @@ -90,7 +90,7 @@ protected async Task CreateMcpClientForServer(McpClientOptions? clien // 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 = TestConstant.DefaultTimeout; + clientOptions.DiscoverProbeTimeout = TestConstants.DefaultTimeout; return await McpClient.CreateAsync( new StreamClientTransport(