Skip to content

Linux activate_window: answer once the WM confirms the active window (bounded), not on stacking alone #429

Open

Description

@SSFSKIM

Problem

On Linux, activate_window answers ok once X has accepted its SetInputFocus and the window is on top in the stacking order. It does not wait for the window manager to update _NET_ACTIVE_WINDOW. On arm64 at twice the CPU load (#171 M5, H'''' on linux-engine-v0.4.1), the window manager's property lagged the answer, so the harness saw the activation as late:

Family Late
L3c gedit activate_window (background) 4/39
L3d kate 3/33
L3d qtcreator 3/51
L3d writer 2/39
L3d gnome-terminal 2/40
L3d gnome-terminal click (desktop route) 2/31

A precise experiment showed that keys are not misdirected. In 200 runs, 40 per family at twice the load, a dedicated X connection read the state at the instant each answer arrived (rulings 872 and its follow-up):

  • X input focus was on the target 200/200;
  • focus held for the next 500 ms 200/200;
  • a key sent right after the answer landed in the target 200/200;
  • _NET_ACTIVE_WINDOW did not yet name the target 9/200.

What remains is a consistency gap. An observation taken right after the answer can still report the old front window, from the window manager's property or from an app's accessibility tree. The click on the desktop route has nothing to confirm at all. This is declared as an M5 limit on arm64 at twice the load.

Work

  • activate_window waits, within a bound, until _NET_ACTIVE_WINDOW names the target, and answers unconfirmed when the bound runs out.
  • Decide what a desktop-route click could confirm. If the answer is nothing, document that.
  • Measure the latency cost at idle and at twice the load on both architectures.

Acceptance

  • Rerunning the L3c and L3d families at twice the load on arm64 gives no late runs, or only runs answered unconfirmed, with no false ok.
  • The added latency is reported.

Activity

  1. added
    enhancement
    status:ready-for-implementer
    priority:P2
    on Nov 19, 2026
  2. added a commit that references this issue on Nov 21, 2026
  3. SSFSKIM commented on Nov 21, 2026

    @SSFSKIM
    OwnerAuthor

    x64 at twice the load (M5 H6, ruling 950). L3a's chrome-text activate_window (shipped) missed 2 of 41 as late, with _NET_ACTIVE_WINDOW naming the target 91–94 ms after the answer.

    An interleaved measurement of 200 per engine (0.4.1 and 0.4.2):

    • X focus on the target at the answer: 400/400.
    • Key in the target: 400/400.
    • The property hadn't named the target by +10 ms in 4/200 (0.4.1) and 1/200 (0.4.2), with a max lag of 16.5 ms.

    This is the same shape as arm64's (871/872/876): typing goes to the right window, and only the WM's property lags. #429's wait on the property should expect lags up to ~100 ms at load on both arches.

  4. added a commit that references this issue on Nov 21, 2026
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

    enhancementpriority:P2status:ready-for-implementer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions