Skip to content

fix(test): widen AwaitAssertAsync budget for snapshot Asks - #1858

Merged
Aaronontheweb merged 1 commit into
devfrom
fix/discord-flaky-test
Aug 10, 2026
Merged

fix(test): widen AwaitAssertAsync budget for snapshot Asks#1858
Aaronontheweb merged 1 commit into
devfrom
fix/discord-flaky-test

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Problem

Flapping_connection_grows_retry_backoff flakes on Windows CI with:

Akka.Actor.AskTimeoutException : Timeout after 3.00 seconds

Root cause is a budget inversion, not an actor bug. The snapshot Ask inside AwaitAssertAsync has a 3s timeout, and AwaitAssertAsync with no duration defaults to akka.test.single-expect-default = 3s — the fixture's akka.test.default-timeout = 5s does not feed it. On a loaded runner one slow Ask consumed the whole assertion budget, so the retry could not fit and the loop rethrew the AskTimeoutException.

Evidence (run 31417450377, Windows, sha 5f2f1c3):

AwaitAssert failed, timeout [00:00:03] is over after [2] attempts and [00:00:05.3375997] elapsed time

Fix

Give the 7 AwaitAssertAsync loops that embed the snapshot Ask an explicit 15s budget (SnapshotAssertTimeout). 15s / (3s Ask + 100ms interval) guarantees ≥4 full retries; the loop still fails fast on a genuinely stuck actor. The 4 Ask-free AwaitAssertAsync calls (pure counter asserts) are left at the default.

Verification

  • Contract suite (Discord + Mattermost fixtures): 22/22 pass on Linux.
  • 15x stress loop of Flapping_connection_grows_retry_backoff: all green.
  • Windows CI is the definitive check for the original failure mode.

Flapping_connection_grows_retry_backoff failed on Windows CI with
Akka.Actor.AskTimeoutException: the 3s Ask inside AwaitAssertAsync had
no headroom because AwaitAssertAsync defaults to a 3s budget
(single-expect-default), not the fixture's default-timeout of 5s. On a
loaded runner one slow Ask consumed the whole budget and the retry
could not fit.

Give the snapshot-Ask assertion loops an explicit 15s budget so the
loop dominates the per-attempt Ask (>=4 full retries) while keeping
the end-state assertions unchanged.

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) August 10, 2026 20:29
@Aaronontheweb Aaronontheweb added tests All issues related to testing, quality assurance, and smoke testing. bug Something isn't working channels Discord, Slack, and other channels. labels Aug 10, 2026
@Aaronontheweb
Aaronontheweb disabled auto-merge August 10, 2026 21:32
@Aaronontheweb
Aaronontheweb merged commit 53fc950 into dev Aug 10, 2026
21 checks passed
@Aaronontheweb
Aaronontheweb deleted the fix/discord-flaky-test branch August 10, 2026 21:32
Aaronontheweb added a commit that referenced this pull request Aug 11, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working channels Discord, Slack, and other channels. tests All issues related to testing, quality assurance, and smoke testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant