Skip to content

test_a_user_on_a_thread_returning_to_the_diff_goes_with_it[marker]: the page reports inactive focus after marker.focus(), intermittently on macOS #6664

Closed

Description

@leaf-agent

tests/browser/threads/test_seated_threads.py::test_a_user_on_a_thread_returning_to_the_diff_goes_with_it[marker] fails intermittently on the macOS runner at test_seated_threads.py:929. This is the step right after marker.focus(), before the diff changes back:

AssertionError: Locator expected to be focused
Actual value: inactive
236 × locator resolved to <span tabindex="0" role="button" … class="lf-margin-marker" data-lf-kinds="comment" …>

The locator resolved to the same marker on every poll for the whole 120 s timeout. Playwright reported inactive, not "not focused", so the page apparently lost focus as a whole rather than the marker losing it to another element or being replaced. That needs confirming: compare document.activeElement and document.hasFocus() in a failing copy.

Evidence (ci dispatches on the macOS runner):

  • Scheduled run 44896279165 on c72a8ad03: failed. The test hadn't failed in the eleven scheduled macOS runs before it.
  • 44920350281, --workers 1 --load 4 --copies 6 at c72a8ad03: 6 of 6 passed.
  • 44922543784, --workers 3 --load 2 --copies 18 at f1d623be2: 2 of 18 failed with the same inactive reading.

It reproduces with three copies running in parallel and not with one, so the next step is to check what in the browser fixture can take focus away from a page while another copy runs. Dispatch command:

gh workflow run ci --ref BRANCH -f flake="--workers 3 --load 2 --copies 18 'tests/browser/threads/test_seated_threads.py::test_a_user_on_a_thread_returning_to_the_diff_goes_with_it[marker]'"

Cause of a failure tracked in #6659.

Activity

  1. added
    tend-ci-cause
    on Nov 21, 2026
  2. leaf-agent commented on Nov 21, 2026

    @leaf-agent
    CollaboratorAuthor

    This is a test race, and #6667 fixes it. The page never lost focus: instrumented copies on CI's Mac failed with document.hasFocus() true and activeElement on <body>, and no focusin ever reached a margin marker. told(page) waits only through the state stage. The margin row the patch change brings stays visibility: hidden until layout places it (annotation-theme.css), so under load marker.focus() hit a hidden marker and did nothing. Playwright reads not-focused as inactive; that word doesn't mean the page lost focus.

    #6667 waits for the marker to be visible before focusing it. The original dispatch passes 54 of 54 copies on the branch (44926183383), against 2 of 18 failing on f1d623be2. The PR's own CI and landing are still pending.

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

    tend-ci-cause

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions