Skip to content

macOS engine: three activation cases post no click, so the arm can stay set and #187's paste failure recur (spared, noWindowNumber, noFrame) #278

Open

Description

@SSFSKIM

Problem & intent

PR #261 (#187) makes the macOS engine follow one rule for route 3's fake activation: a hold never ends with its arm set. Subtype 1, posted to an app that does not believe it is active, arms that app's mouse activation. Only a mouse down stamped with the window's number consumes the arm. While the arm is set, the app never makes a window key, and Chrome never reads a ⌘V. That holds even after the person brings Chrome to the front themselves: on the 2026-11-05 slot the owner's previous engine (dd7a), which posts no click there, failed both pastes 3 of 3 with "Timed out waiting for the application to read the clipboard". The arm's AppKit internals (_mouseActivationInProgress) come from a static reading of 25G83; the slot measured the effect.

The engine consumes the arm with a click: at the window's AXActivationPoint when it lies in the frame on inert chrome, otherwise with an inert click outside the frame. Three cases post no click at all and record why (activationClickKind = {kind: skipped, skippedReason}; activationClickPlan in native/engine/Sources/Engine/Routes.swift). In each of them the arm stays set when the hold ends, and #187's failure can recur in that app until the person's next real click into it. Subtype 2 at the release does not clear it: dd7a's background paste posted subtype 2, and the arm still blocked the paste after open -a.

  1. spared. Only for a right or middle click. Route 3 spares the click's target, so no left event lands on the element the model aimed a different button at (activationSparing, ElementInput.swift). The case is the window's AXActivationPoint inside the frame and inside that target. An inert point outside the frame can't fall in it except through a hit frame that reaches past the window. Likelihood: rare in titled windows. TextEdit, Finder and Electron put the point 16 pt below the top edge, in the title bar, where few right-click targets lie. Windows whose content reaches the top edge (full-size content: many Electron apps such as Slack, VS Code and Discord) are more exposed, because a right-click whose hit element is a large container (a sidebar, the root group, the web area) covers that corner. The engine counts only a left mouse down as consuming the arm (FakeActivation.postAction). Whether AppKit's right or other mouse down clears it has not been read.
  2. noWindowNumber. Nothing to stamp the click with, and AppKit routes a pid-posted mouse down by the window number alone. windowNumber(of:) (AX.swift) asks _AXUIElementGetWindow (SPI, dlsym'd), then falls back to on-screen layer-0 windows of the pid whose bounds match within 1 pt. Likelihood: low for a standard window. The likely path is an app with no window. Every activation site falls back to the application element (primaryWindow(of: application) ?? application: FocusHold, ElementInput, Input, MenuSpan, Paste), for example a ⌘N or ⌘T key equivalent into a Chrome with every window closed. Off-screen, minimized, other-Space and non-layer-0 windows reach it only when the SPI fails.
  3. noFrame. The window's frame can't be read, so no point is known to lie outside it, and a click could land in the 4 pt resize band or on a view. Likelihood: low. The cases are an AX read that times out on a busy app, a dead element, and the application-element fallback above (where noWindowNumber is checked first).

The 2026-11-05 slot carried 120 activationClickKind records: 72 activationPoint, 46 inertOutside, 2 action, 0 skipped. No live run has entered any of the three.

Intent: an activation never leaves an app armed, or, where it can't avoid that, the engine knows it and says so, so a later key or paste into that app doesn't fail as #187 did.

Constraints

Success criteria

  • Per case, a ruling: closed (a click becomes possible), or accepted with a stated reason and a recorded signal.
    • spared: read offline whether AppKit's right/other mouse down consumes the arm (25G83). If it does, the arm is consumed and the case closes by recording consumedByAction. If not, choose an inert click that cannot land in the sparing rect: outside the frame always, since a rect inside the frame never holds it.
    • noWindowNumber: for the window-less app, decide whether to activate at all. Find the window the key equivalent creates, and consume the arm on it at the release. Or measure that a window-less app is not left blocked.
    • noFrame: read the frame once more from the window list by window number, which the stamp already needs, before giving up.
  • A test per case at activationClickPlan / FakeActivation that fails today.
  • Live, one cell per case that can be staged: a Chrome with no window, ⌘N, then a background paste into the new window; a right-click on a full-size-content Electron window's top-left container, then a background paste. The paste delivers on the shipping build.

Decision log

Sources

  • docs/doperpowers/specs/2026-10-18-own-native-engine-design.md, the Decision Log entry for Fix Chrome background paste clipboard-read timeouts in composing@textedit rows #187's inert click (items 1–8, "The exceptions").
  • native/engine/Sources/Engine/Routes.swift (activationClickPlan, ActivationClickSkip), Activation.swift (postActivation, consumeArm, postAction), AX.swift (windowNumber(of:)), ElementInput.swift (activationSparing).
  • docs/evidence/2026-10-30-macos-agent-cursor/item-187-reslot2/ (runs.md, item-187-rejudge.md): the cell that showed the arm's effect, on branch fix/187-3b-slot.

Activity

  1. added
    bug
    status:ready-for-architect
    priority:P3
    on Nov 5, 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

    bugpriority:P3status:ready-for-architect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions