.NET: Fix and re-enable flaky InputWaiter timeout test - #7377
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a previously quarantined flaky workflows unit test by removing a wall-clock race and asserting timeout behavior via the API result instead of task scheduling/identity, allowing the test to be re-enabled without destabilizing net472 CI legs.
Changes:
- Introduces a consistent “guard timeout” backstop in
InputWaiterTeststo prevent hangs while keeping assertions focused on behavior. - Rewrites the timeout test (and related siblings) to assert on a boolean result (
signaledvstimed out) rather than racingSemaphoreSlim.WaitAsync(timeout)againstTask.Delay. - Updates
InputWaiter.WaitForInputAsync(TimeSpan, ...)to returnbool, exposing whether the wait ended due to a signal or a timeout.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InputWaiterTests.cs | Re-enables and stabilizes the timeout test by asserting on a returned flag and adding a liveness guard. |
| dotnet/src/Microsoft.Agents.AI.Workflows/Execution/InputWaiter.cs | Returns a boolean from the timeout wait overload to distinguish signal vs timeout and support non-flaky tests. |
peibekwe
marked this pull request as ready for review
July 29, 2026 03:14
westey-m
approved these changes
Jul 29, 2026
SergeyMenshykh
approved these changes
Jul 29, 2026
rogerbarreto
approved these changes
Jul 29, 2026
This was referenced Jul 30, 2026
Merged
This was referenced Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
InputWaiterTests.InputWaiter_WaitForInputAsync_CompletesWhenTimeoutExpiresAsyncwas quarantined in #7361 because it failed intermittently on thenet472/windows-latestleg ofmerge_groupruns, blocking the merge queue for PRs that never touched workflow code.The test raced a 300ms wait against a 5s
Task.Delayand then asserted which one won by comparing task identity. That assertion measured scheduling latency rather than behaviour:SemaphoreSlim.WaitAsync(timeout)reaches its timeout through several thread-pool hops, whileTask.Delaycompletes directly in its timer callback. On a loaded runner the semaphore honored its 300ms timeout exactly, but the continuation was not observed until after the 5s guard, so the delay won and the test failed.Re-enable the quarantined test and also fix related siblings. Fixes #7360
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.