Skip to content

Flaky transcript-scroll E2E can run before initial tail positioning #4619

Description

@Sun-GLiang

What happened

The Desktop E2E test history asked for at the very top of the scroller still lands above the reader in apps/desktop/e2e/transcript-scroll.spec.ts can time out under concurrent CI load. The failure was observed in PR #4417, but the flake is independent of that PR and should be fixed separately.

In the failing sample, immediately before the test assigned root.scrollTop = 0, the scroller already reported:

{ "scrollTop": 0, "scrollHeight": 3246, "clientHeight": 780 }

The 0 -> 0 assignment is a no-op, so Chromium emits no reader scroll event. useChatScroll therefore does not call requestEarlier / loadEarlier, and the first resident turn remains turn-prompt-rail-111 until the 20-second assertion timeout. The initial transcript tail pin completes only afterward.

Expected behavior: the test must wait until initial tail positioning has settled before it performs the real move to the top and asserts that earlier history loads.

How to reproduce

From apps/desktop, after building the Desktop E2E app:

npx playwright test --config e2e/playwright.config.ts e2e/transcript-scroll.spec.ts --grep "history asked for at the very top" --workers=4 --repeat-each=12

The failure is timing-dependent. Investigation results:

  • Single-worker isolated rerun: 5/5 passed.
  • Four workers with 12 repeats: reproduced twice.
  • Four workers with 16 repeats and temporary read-only diagnostics: reproduced once.

Environment

Logs, screenshots, or additional context

Root cause: the prompt-rail fixture waits for transcript DOM presence, not for initial tail positioning to settle. Under load, the test can overtake that positioning. A deterministic test-only fix should wait for one geometry sample with scrollTop > 0 and distance-to-tail <= 4, then set scrollTop = 0. A fixed delay or a larger history assertion timeout would not address the race.

Created with OpenAI Codex assistance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions