Skip to content

fix(desktop): stabilize flaky DM expansion E2E ordering assertions#2004

Open
cameronhotchkies wants to merge 1 commit into
block:mainfrom
cameronhotchkies:fix/flaky-dm-expansion-e2e-ordering
Open

fix(desktop): stabilize flaky DM expansion E2E ordering assertions#2004
cameronhotchkies wants to merge 1 commit into
block:mainfrom
cameronhotchkies:fix/flaky-dm-expansion-e2e-ordering

Conversation

@cameronhotchkies

Copy link
Copy Markdown
Contributor

Summary

Fixes 4 flaky DM expansion E2E tests in Desktop Smoke shard 1 that were failing non-deterministically on CI (also reproducing on main at run 29526844596).

Failing tests:

  • channels.spec.ts:652 — creates the DM before preparing a persona mention
  • channels.spec.ts:760 — routes an agent mention from an existing DM to the expanded conversation
  • channels.spec.ts:815 — routes a relay-agent mention from an existing DM to the expanded conversation
  • channels.spec.ts:940 — drops an expanded DM after the first message fails

Root Cause

Race condition: under fast CI execution, mock command completions (create_managed_agent, open_dm) can resolve in non-deterministic order, causing assertions to observe stale or mid-transition state.

Fix

  • :652 — Move the new-message-recipient-popover hidden assertion after chat-title settles (both names present), so it runs post-transition rather than mid-transition.
  • :760, :940 — Add createManagedAgentDelayMs: 100 to ensure persona provisioning doesn't collapse into the same tick as the expanded-DM open/start sequence.
  • :815 — Add openDmDelayMs: 100 so the two open_dm calls resolve in deterministic order.

Validation

All 4 tests pass with --repeat-each=3 (12/12 green) locally. Biome lint clean.

Scope

Test-only change: 12 insertions, 1 deletion in desktop/tests/e2e/channels.spec.ts.


Investigated by Ferret, reviewed by Grumplestiltzkin.

@cameronhotchkies
cameronhotchkies requested a review from a team as a code owner July 16, 2026 23:06
The DM expansion flow issues multiple async commands (open_dm,
create_managed_agent, start_managed_agent) whose completion order is
non-deterministic without artificial delays. Three tests at lines ~760,
~815, and ~940 lacked the delay guards that the test at line ~652 already
used, causing intermittent CI failures when command-log ordering
assertions ran against a race.

Add createManagedAgentDelayMs or openDmDelayMs (100ms) to the affected
tests to guarantee deterministic command ordering. Also move the
popover-hidden assertion in the line-652 test to after the chat-title
assertions, where the UI has fully settled.

Co-authored-by: Cameron Hotchkies <chotchkies@block.xyz>
Signed-off-by: Cameron Hotchkies <chotchkies@block.xyz>
Co-authored-by: Goose <opensource@block.xyz>
Ai-assisted: true
@cameronhotchkies
cameronhotchkies force-pushed the fix/flaky-dm-expansion-e2e-ordering branch from 2bb310e to ca3ab52 Compare July 17, 2026 17:34
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