[Internal] Tests: Fixes AppCancellationDuringHedging with deterministic synchronization#5712
Merged
kirankumarkolli merged 1 commit intoMar 19, 2026
Conversation
…ic synchronization Replaces timing-dependent Task.Delay cancellation pattern with deterministic TaskCompletionSource + ct.Register() approach. Previously used 10ms threshold + 15ms cancel delay (5ms margin), which was unreliable on loaded CI agents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
kirankumarkolli
approved these changes
Mar 19, 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.
Summary
Replaces timing-dependent cancellation pattern with deterministic
TaskCompletionSource+ct.Register()approach in theAppCancellationDuringHedging_DoesNotSpawnNewHedgeRequeststest.Root Cause
The test used a 10ms threshold with a 15ms cancellation delay, giving only 5ms margin.
Task.Delayprecision at these scales is unreliable on loaded CI agents, causing the test to fail ~4% of the time.Fix
TaskCompletionSourceuntil cancelled via the cancellation tokenTest Fixed (95.89% pass rate — 29 failures in 30 days)
AppCancellationDuringHedging_DoesNotSpawnNewHedgeRequestsImpact