From 8eb6cb10565e746c7dd388d413353744aec4b506 Mon Sep 17 00:00:00 2001 From: Steve Sanderson <1101362+SteveSandersonMS@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:15:07 +0000 Subject: [PATCH 1/2] Fix flaky .NET ask-user E2E tests Subscribe for completion events before sending ask-user prompts by using SendAndWaitAsync. This removes the post-send event backfill race that caused the Windows test to time out waiting for an assistant message. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/test/E2E/AskUserE2ETests.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dotnet/test/E2E/AskUserE2ETests.cs b/dotnet/test/E2E/AskUserE2ETests.cs index db1a4dd92b..580af39f77 100644 --- a/dotnet/test/E2E/AskUserE2ETests.cs +++ b/dotnet/test/E2E/AskUserE2ETests.cs @@ -30,12 +30,10 @@ public async Task Should_Invoke_User_Input_Handler_When_Model_Uses_Ask_User_Tool } }); - await session.SendAsync(new MessageOptions + await session.SendAndWaitAsync(new MessageOptions { Prompt = "Ask me to choose between 'Option A' and 'Option B' using the ask_user tool. Wait for my response before continuing." - }); - - await TestHelper.GetFinalAssistantMessageAsync(session); + }, TimeSpan.FromSeconds(120)); // Should have received at least one user input request Assert.NotEmpty(userInputRequests); @@ -62,12 +60,10 @@ public async Task Should_Receive_Choices_In_User_Input_Request() } }); - await session.SendAsync(new MessageOptions + await session.SendAndWaitAsync(new MessageOptions { Prompt = "Use the ask_user tool to ask me to pick between exactly two options: 'Red' and 'Blue'. These should be provided as choices. Wait for my answer." - }); - - await TestHelper.GetFinalAssistantMessageAsync(session); + }, TimeSpan.FromSeconds(120)); // Should have received a request Assert.NotEmpty(userInputRequests); From a9588ff18e6c491e25cba1f362d7bf1fade2e9c0 Mon Sep 17 00:00:00 2001 From: Steve Sanderson <1101362+SteveSandersonMS@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:22:27 +0000 Subject: [PATCH 2/2] Use default ask-user test timeout Let SendAndWaitAsync apply its standard 60-second timeout instead of retaining the legacy helper's explicit 120-second timeout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/test/E2E/AskUserE2ETests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/test/E2E/AskUserE2ETests.cs b/dotnet/test/E2E/AskUserE2ETests.cs index 580af39f77..e08ba10cb4 100644 --- a/dotnet/test/E2E/AskUserE2ETests.cs +++ b/dotnet/test/E2E/AskUserE2ETests.cs @@ -33,7 +33,7 @@ public async Task Should_Invoke_User_Input_Handler_When_Model_Uses_Ask_User_Tool await session.SendAndWaitAsync(new MessageOptions { Prompt = "Ask me to choose between 'Option A' and 'Option B' using the ask_user tool. Wait for my response before continuing." - }, TimeSpan.FromSeconds(120)); + }); // Should have received at least one user input request Assert.NotEmpty(userInputRequests); @@ -63,7 +63,7 @@ public async Task Should_Receive_Choices_In_User_Input_Request() await session.SendAndWaitAsync(new MessageOptions { Prompt = "Use the ask_user tool to ask me to pick between exactly two options: 'Red' and 'Blue'. These should be provided as choices. Wait for my answer." - }, TimeSpan.FromSeconds(120)); + }); // Should have received a request Assert.NotEmpty(userInputRequests);