Skip to content

Commit 4d2da38

Browse files
stephentoubCopilot
andauthored
Fix MCP E2E send wait race (#1556)
Use SendAndWaitAsync in MCP and custom agent configuration tests so the session idle subscription is registered before sending the prompt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4b29473 commit 4d2da38

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

dotnet/test/E2E/SessionMcpAndAgentConfigE2ETests.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public async Task Should_Accept_MCP_Server_Configuration_On_Session_Create()
2323
await WaitForMcpServerStatusAsync(session, "test-server", McpServerStatus.Connected);
2424

2525
// Simple interaction to verify session works
26-
await session.SendAsync(new MessageOptions { Prompt = "What is 2+2?" });
27-
28-
var message = await TestHelper.GetFinalAssistantMessageAsync(session);
26+
var message = await session.SendAndWaitAsync(new MessageOptions { Prompt = "What is 2+2?" });
2927
Assert.NotNull(message);
3028
Assert.Contains("4", message!.Data.Content);
3129

@@ -112,9 +110,7 @@ public async Task Should_Accept_Custom_Agent_Configuration_On_Session_Create()
112110
Assert.Matches(@"^[a-f0-9-]+$", session.SessionId);
113111

114112
// Simple interaction to verify session works
115-
await session.SendAsync(new MessageOptions { Prompt = "What is 5+5?" });
116-
117-
var message = await TestHelper.GetFinalAssistantMessageAsync(session);
113+
var message = await session.SendAndWaitAsync(new MessageOptions { Prompt = "What is 5+5?" });
118114
Assert.NotNull(message);
119115
Assert.Contains("10", message!.Data.Content);
120116

0 commit comments

Comments
 (0)