Skip to content

iOS: report or observe the frontmost app without activating it #4557

Open

Description

@akshat-OwO

Problem

On iOS simulators, an SDK client can observe only the app its session is bound to. An observe-only snapshot (observeOnly: true) refuses with OBSERVATION_UNAVAILABLE unless that app's XCUIApplication state is runningForeground (prepareActiveCommandContext in RunnerTests+CommandDispatch.swift). Rebinding with apps.open({ app, relaunch: false }) activates the app, so a client cannot learn which app is in front without changing the screen.

This matters when the bound app hands off to another app by itself, for example a link that opens Safari or an "Open Settings" button. The bound app then reports runningBackground, and nothing says which app came forward:

  • appState reports only the session app's state.
  • The frontmost-app surface is macOS-only.
  • Binding to com.apple.springboard to find out sends the device Home whenever another app is in front.

Today the only non-destructive workaround is to guess from host process scheduling priority, which is fragile.

Checked on 0.21.25, 0.21.36, and 0.21.38-nightly.20261113.167 with an iOS 26.5 simulator.

Request

Either of these would solve it:

  1. A frontmost-app query on iOS. For example, a runner command or an appState field that reports the bundle id in front. The runner already has activeApplicationProcessIdentifiers() through its accessibility client, and Springboard's tree names the app in front as card:<bundleId>:sceneID:….
  2. An appBundleId override for observe-only snapshots. A client that already knows the bundle id could then snapshot that app (or Springboard) without rebinding or activating anything.

Related observations

These may be worth handling in the same change:

  • Springboard always reports runningForeground. This holds on the Home Screen, with an app in front, and in the App Switcher, so its state alone is not evidence of being in front.
  • The previous app keeps reporting runningForeground after Home. This lasts about 0.5 s after home, and for as long as the App Switcher is open. Its observe-only snapshot succeeds with a shrinking or card-sized, offset root.

Activity

  1. added
    enhancement
    on Nov 15, 2026
  2. thymikee commented on Nov 15, 2026

    @thymikee
    Member

    Triage: enhancement; this needs a maintainer decision on the observation contract. Current main still requires the supplied app to report runningForeground for an observe-only snapshot, and opening another app activates it. The runner's active-process list alone does not establish one frontmost bundle, especially on Home or in the App Switcher. A non-activating query and an override of the session's observation target need separate scope decisions; no additional reproduction is needed.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions