From 69858b5a16ed0e1b639f621ff09dbf430a9c1460 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 03:50:26 +0000 Subject: [PATCH] test: remove finite timeout in BlocksUntilSignaledAsync to fix race Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/962b7404-4266-4a16-906c-ba3e607c2764 Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com> --- .../InputWaiterAndOutputFilterTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InputWaiterAndOutputFilterTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InputWaiterAndOutputFilterTests.cs index dead5454b4..ab83b340f9 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InputWaiterAndOutputFilterTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InputWaiterAndOutputFilterTests.cs @@ -34,7 +34,12 @@ public sealed class InputWaiterTests : IDisposable [Fact] public async Task InputWaiter_WaitForInputAsync_BlocksUntilSignaledAsync() { - Task waitTask = this._waiter.WaitForInputAsync(TimeSpan.FromSeconds(5)); + // Use the no-timeout overload: the wait must only be released by SignalInput. + // Passing a finite timeout here is racy on slow hosts: if the test thread is + // paused longer than the timeout (e.g., heavy CI load or GC) before the + // assertion runs, SemaphoreSlim's internal timer fires and waitTask completes + // on its own, causing the "should not complete before signaled" check to flake. + Task waitTask = this._waiter.WaitForInputAsync(CancellationToken.None); Task completedBeforeSignal = await Task.WhenAny(waitTask, Task.Delay(100)); completedBeforeSignal.Should().NotBeSameAs(