fix(test): make LlmSession Windows CI flakes deterministic - #1862
Merged
Conversation
Two LlmSessionIntegrationTests flaked on Windows CI (run 31435126237) with real-time budget races — same family as the #1858 Discord fix, but fixed without touching any timeouts: Reminder_redelivery_is_deduped_while_first_turn_is_in_flight: The CommandAck fires BEFORE the first turn's LLM call is scheduled (recall resolution + working-context mailbox hop run first), so polling CallCount==1 raced the very thing it measured (got 0 under load). Added a FirstCallEntered TaskCompletionSource to FakeChatClient, set when the first GetResponseAsync entry increments CallCount (before the gate); the test now awaits the signal instead of polling. Event-driven, not wall-clock. JoinSession_receives_SessionJoined_acknowledgement: The first JoinSession cold-spawns the session actor through DI (fresh SQLite store, persistence recovery, serialization verification) inline in the parent mailbox — unbounded on a loaded runner, exceeding the 3s Ask. The test now warms the session with an unbounded-gated Tell + probe ExpectMsg first, so the assertion Ask measures only the hot path. The 30s ceilings are hang guards only, not pass/fail mechanisms.
Aaronontheweb
enabled auto-merge (squash)
August 10, 2026 23:40
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
Two
LlmSessionIntegrationTestsflaked on Windows CI (run 31435126237, PR #1859):Reminder_redelivery_is_deduped_while_first_turn_is_in_flight—Assert.Equal(1, _fakeChatClient.CallCount)gotActual: 0inside a 3sAwaitAssertAsyncpoll.JoinSession_receives_SessionJoined_acknowledgement—AskTimeoutException : Timeout after 3.00 seconds.Both are real-time-budget races on a loaded runner — same family as the #1858 Discord fix. This PR fixes them deterministically, without touching any timeouts.
Fixes
1. Reminder dedup test — event barrier instead of polling.
The
CommandAckfires before the first turn's LLM call is scheduled (recall resolution + working-context mailbox hop run first), so pollingCallCount == 1raced the very thing it measured. Added aFirstCallEnteredTaskCompletionSourcetoFakeChatClient, set when the firstGetResponseAsyncentry incrementsCallCount(before the gate). The test now awaits the signal — proving the turn is genuinely in flight (blocked on the gate) — then assertsCallCount == 1directly. Event-driven, not wall-clock.2. JoinSession test — warm up the cold spawn outside the timed Ask.
The first
JoinSessioncold-spawns the session actor through DI (fresh SQLite store, persistence recovery, serialization verification) inline in the parent mailbox — unbounded cost on a loaded runner that exceeds the 3s Ask. The test now warms the session first (Tell+ probeExpectMsgAsync<SessionJoined>), so the assertion Ask measures only the hot mailbox path.TurnCount == 0/Title == nullstill hold — the warmup runs no turn.The 30s ceilings are hang guards only, not pass/fail mechanisms — the pass/fail is event-driven (TCS completion / probe message receipt).
Verification
LlmSessionIntegrationTestsclass 34/34 passes on Linux.Follow-up
~30 other tests in this file carry the same latent cold-start
Ask<SessionJoined>(3s)pattern. Scoping this PR to the two observed flakes; a base-classWarmUpSession(...)helper sweep is a good tracked follow-up.