fix(tests): stop SessionLogActor diagnostic test racing the FlushTick - #1927
Merged
Conversation
Dispatcher_writes_audit_and_diagnostic_to_same_session_log sent the buffered diagnostic AFTER the durable audit line, so the diagnostic only became visible when the actor's 1s wall-clock FlushTick fired. On loaded Windows CI runners the tick can land past the 3s AwaitAssertAsync budget, failing the test even though the write was correct (seen on run 31715544081, job 94499226187). Send the buffered diagnostic first; the durable audit write drains it synchronously via WriteDurable — the documented natural flush point. The test no longer depends on the wall-clock timer (verified: passes in ~0.5s, previously ~1s gated on the tick).
Aaronontheweb
enabled auto-merge (squash)
August 13, 2026 20:33
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.
Problem
SessionLogActorTests.Dispatcher_writes_audit_and_diagnostic_to_same_session_logis flaky on Windows CI. It failed on run 31715544081 (job 94499226187, 2026-08-13): after the full ~3sAwaitAssertAsyncbudget, the file contained the assistant line but not the diagnostic line, even though the write was correct.Root cause (confirmed by
dotnet-concurrency-specialist+akka-net-specialist):TextOutputfirst (flushed immediately viaWriteDurable), then the bufferedSessionLogDiagnostic(Writeonly — no flush).FlushTick(real wall-clock scheduler, not the test'sFakeTimeProvider), the 256-write threshold, a later durable write, orPostStop.Fix (test-only, deterministic)
Send the buffered diagnostic first, then the durable audit line — the audit write's
WriteDurable→Flush()drains the buffered diagnostic synchronously in the same mailbox turn. This is the exact behavior documented inSessionLogActor.cs: "audit lines are natural flush points."No production change: the buffered-diagnostic path is deliberate (batching, per #1499) and bounded in production.
Verification
SessionLogActorTestsclass: 4/4 pass.Notes