Skip to content

Commit 0726434

Browse files
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 <[email protected]>
1 parent 0d34048 commit 0726434

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎tests/ModelContextProtocol.Tests/ClientServerTestBase.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ public async ValueTask DisposeAsync()
8686

8787
protected async Task<McpClient> CreateMcpClientForServer(McpClientOptions? clientOptions = null)
8888
{
89+
clientOptions ??= new McpClientOptions();
90+
91+
// Disable the server/discover probe timeout to avoid CI slowness spuriously tripping it (issue #1701).
92+
// Tests that need a specific probe timeout should create their own client instead of using this helper.
93+
clientOptions.DiscoverProbeTimeout = Timeout.InfiniteTimeSpan;
94+
8995
return await McpClient.CreateAsync(
9096
new StreamClientTransport(
9197
serverInput: _clientToServerPipe.Writer.AsStream(),

0 commit comments

Comments
 (0)