mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +00:00
00a6dc56a7
TestPromoteQueuedWhileRunningRespectsMessageOrder was flaky because it read queue state from the database immediately after PromoteQueued returned. The active server worker drains queued messages concurrently, so the DB read races the auto-promote pipeline (TOCTOU). Instead of asserting intermediate queue state, wait for all three promoted messages to appear in chat history and verify their relative order (B before A before C). This asserts the same invariant (promote reorders B to the front) without reading during the race window. Closes CODAGT-384