Skip to content

fix(daemon): lifecycle idle-timer tests on tokio's paused clock - #611

Merged
githubrobbi merged 1 commit into
mainfrom
fix/lifecycle-tests-paused-clock
Aug 22, 2026
Merged

fix(daemon): lifecycle idle-timer tests on tokio's paused clock#611
githubrobbi merged 1 commit into
mainfrom
fix/lifecycle-tests-paused-clock

Conversation

@githubrobbi

Copy link
Copy Markdown
Collaborator

Fixes the Windows CI flake in main run 32601124030: session_tier_upgrade_extends_timeout failed on TRY 1 and passed on TRY 2, and the ci nextest profile treats flaky as failure.

Root cause: the six run_idle_timer tests slept on the real clock with 100–300 ms deadlines. On a loaded Windows runner, a >20 ms scheduling stall between a sleep completing and the activity reset landing lets the idle deadline fire first — the test then observes a retired timer it expected alive. All six tests in the cluster share the hazard; only the tightest one (80 ms of a 100 ms window) has tripped so far.

Fix: #[tokio::test(start_paused = true)]run_idle_timer is pure tokio time (tokio::time::sleep/Instant), so the virtual clock drives it deterministically and runner load can never reorder deadline vs. reset. Because virtual time makes every firing exact, assertion instants were also moved off the timer's own deadline grid (e.g. active_connections_defer_retirement asserted at t=200/400 ms, exactly on the defer re-arm deadlines — now 250/500 ms) so exact-instant poll-order ties cannot appear as a new flake class.

Test-only change, no production code touched, no version bump. Cluster runs 3× green locally in 0.12 s (was >1 s of real sleeping).

The six run_idle_timer tests slept on the real clock with 100-300 ms
deadlines; on a stalled Windows CI runner a >20 ms hiccup let a
deadline fire before the activity reset landed, and the ci profile
treats flaky as failure (session_tier_upgrade_extends_timeout, main
run 32601124030). start_paused = true makes every sleep advance
virtual time deterministically, and assertion instants now sit off
the timer's own deadline grid so exact-instant poll-order ties
cannot happen either.
@githubrobbi
githubrobbi enabled auto-merge August 22, 2026 23:06
@githubrobbi
githubrobbi added this pull request to the merge queue Aug 22, 2026
Merged via the queue into main with commit 863be13 Aug 22, 2026
21 checks passed
@githubrobbi
githubrobbi deleted the fix/lifecycle-tests-paused-clock branch August 22, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant