Repository navigation
Description
Purpose
With the session app in the background (Home Screen in front), a push notification banner is on screen. press <x> <y> on the banner does not open the notification. Before the tap, the runner re-activates the session app (targetActivation {reason: stale_target, priorState: 3}), the banner goes away, and the tap lands on the app's current screen. The notification's deep link is never opened.
With the app already in front, the same push and the same press open the notification's deep link. So the banner and the coordinates are fine. The pre-tap activation is the difference.
A press at a point targets the screen, not an element of the session app. The point may belong to a system surface (banner, alert, Control Center). Activating the session app first changes what is under the point.
Environment
- agent-device 0.21.39 (npm).
RunnerTests+CommandDispatch.swiftis unchanged onmainat655ede279. First seen on 0.21.29. - macOS 27.2.1 (26B131), Xcode 27.2 (27B52), Node 24.21.0.
- iPhone 17 Simulator, iOS 27.2 (24B8117), language
fr-FR. - App: a production iOS app with a third-party push SDK; notifications authorized through the app's own prompt.
Reproduction
pin='--platform ios --device <sim> --session s --state-dir <dir> --json'
# The app is open on its home screen.
agent-device home $pin # Home Screen in front, app in background
xcrun simctl push <udid> <bundle> deeplink.apns # alert push whose deep link opens the Settings page
# The banner shows at the top (screenshot), centre about (201, 91) pt.
agent-device press 201 91 $pin
# {"success": true, "data": {"x": 201, "y": 91, "message": "Tapped (201, 91)", "targetKind": "point",
# "targetActivation": {"priorState": 3, "reason": "stale_target", "otherActiveApplicationPid": 79623}}}
# runner.log:
# AGENT_DEVICE_RUNNER_ACTIVATE bundle=<bundle> state=3 reason=stale_target
# AGENT_DEVICE_RUNNER_ACTIVATE_FACT bundle=<bundle> reason=stale_target priorState=3 otherActiveApplicationPid=79623
# Screen 2 s later and the next snapshot: the app's home, not the Settings page. Same app pid before and after.2 runs of 2. We ran no snapshot between home and the press, because a snapshot also re-activates the app.
Control, 2 runs of 2: the app in front on its home, the same push, press 201 91. The answer has no targetActivation, and the app opens the Settings page.
Cause (source at v0.21.39)
RunnerTests+CommandDispatch.swift:576-625:prepareActivatedTargetactivates the session app when it is not in front (activateTarget(bundleId:reason: "stale_target"),:625), also for a point tap.- Silent target re-activation lets a screenshot and the next snapshot describe different apps #2682 made this activation visible (
targetActivation), but a caller cannot avoid it.
Required behavior
One of:
- A point
pressdoes not activate the session app first, or - a flag or option lets the caller skip the activation for one command, or
- the press refuses before dispatch (
dispatched: no) with a reason that says the session app is not in front, instead of activating it.
In each case, a tap on a banner over the Home Screen reaches the banner.
Example shape for the third option (the reason name is only a suggestion):
{"success": false, "error": {"code": "COMMAND_FAILED",
"details": {"reason": "session_app_not_foreground", "priorState": 3, "dispatched": "no"}}}Completion conditions
- The reproduction above opens the notification's deep link, or answers a typed refusal with
dispatched: no. targetActivationstays reported whenever an activation does happen.
Dependencies
Blocked by: none.
Related: #4557 (observe the frontmost app without activating it) needs a decision on the same activation contract. #2682 made the activation visible.
Workaround
Tap a banner only while the session app is in front. To test a cold or background open of a deep link, use xcrun simctl openurl instead of a banner.
Activity
thymikee commentedon Nov 21, 2026
An agent is picking this up; the PR will link here.
fix(ios): run a coordinate press on a SpringBoard surface in place (c…