Skip to content

[Bug]: macOS: app with only an alwaysOnTop window is reported as having no window #548

Done

Description

@hiroro-work

agent-desktop version

1.1.0

Operating system

macOS

OS version

macOS 26.7.2 (arm64)

Installation method

npm

Command run and full JSON output

$ agent-desktop list-windows --app Electron
{"version":"2.6","ok":true,"command":"list-windows","data":[]}

$ agent-desktop find --app Electron --surface menu-bar-extras --name <tray item>
{"version":"2.6","ok":false,"command":"find","error":{"code":"WINDOW_NOT_FOUND","message":"Application 'Electron' is running but has no matching window","suggestion":"Wait for the app to present a window, or run 'list-windows --app'.","disposition":{"delivery":"not_delivered","retry":"safe"}}}

Steps to reproduce

  1. Start an Electron app (44.10.0) with one BrowserWindow({ alwaysOnTop: true }) and a Tray.
  2. Run agent-desktop list-windows --app Electron.
  3. Run agent-desktop find --app Electron --surface menu-bar-extras --name <tray item>.

Expected behavior

The window is listed, and the tray item is found.

Actual behavior

list-windows returns [], and find fails with WINDOW_NOT_FOUND. alert and focused fail the same way. After win.setAlwaysOnTop(false), everything works. The window is on screen with kCGWindowLayer 3 (floating level). It looks like the layer != 0 skip in records_from_dictionaries (crates/macos/src/system/window/cg_window.rs) drops it.

macOS Accessibility permission (macOS only)

  • I have granted Accessibility permission

Logs / additional context

Same kind of thing with a parentless modal NSAlert (layer 8). --surface alert doesn't find it, --surface focused does, and screenshot times out ("window inventory did not stabilize").

Activity

  1. changed the title [-]macOS: app with only an alwaysOnTop window is reported as having no window[/-] [+][Bug]: macOS: app with only an alwaysOnTop window is reported as having no window[/+] on Nov 4, 2026
  2. shivanikadirgamarajah commented on Nov 4, 2026

    @shivanikadirgamarajah

    Hi, I'd like to work on this issue! Please let me know if anyone is already working on this.

  3. zj1123581321 commented on Nov 10, 2026

    @zj1123581321

    Another case that the same layer != 0 filter seems to drop, with a bigger impact for automation: macOS privacy (TCC) consent alerts.

    Environment: agent-desktop 1.0.2, macOS 26.7.2 (arm64), Accessibility granted.

    Repro

    1. From a process that has not yet been granted Documents access, run ls ~/Documents. The call blocks, and macOS shows the alert "" would like to access files in your Documents folder with Don't Allow / Allow buttons.
    2. Run agent-desktop list-windows. The output is identical to a listing taken before the alert appeared; the alert window is not in it.

    Where the alert lives: it is owned by /System/Library/CoreServices/UserNotificationCenter.app and sits at kCGWindowLayer 8. Another CGWindowList-based tool (cua-driver) lists it as app_name: UserNotificationCenter, layer: 8. Its AX tree is plain: AXWindow > AXStaticText (message) + AXButton (Help / Don't Allow / Allow). An AXPress on Allow from an Accessibility-trusted process works: the blocked ls returns 0. I reproduced this twice, with Documents and with Downloads.

    Why it matters: an agent driving a remote Mac cannot see these prompts through agent-desktop, so it can't answer them. The command that triggered the prompt just hangs until a human clicks. Listing at least the layer-8 alerts owned by UserNotificationCenter (or, more generally, not dropping on-screen windows with layer > 0, as this issue suggests) would let snapshot/click reach them.

  4. lahfir commented on Nov 28, 2026

    @lahfir
    Collaborator

    fixed in #702 on main: macOS window inventory now includes on-screen floating windows in layers 1..19. thanks @hiroro-work

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