Repository navigation
Conversation
… read control.actionTargets and control.readAccessibility returned an empty list when the runtime could not read the app's window: the screen was locked, the app was in the background, a dialog or the notification shade had focus, or an action was in progress. That looked the same as a screen without controls, so an agent had no hint to unlock the device or bring the app back. Discovery now throws operationUnavailable with the reason, as the action operations already do. The output schema is unchanged, and an empty list again means the screen has no controls. perform still reads the screen without refusing, so an action that moves the app to the background is reported as dispatched. The iOS NectoUIControlPlugin initializer now takes throwing closures. Existing non-throwing closures still compile. The panel keeps "Input sent" after an action whose next screen can't be read, and shows the reason in the list. The Control e2e retries a content read that fails while the screen is in transition. Refs toss#45
Discovery refuses with "Another action is in progress" while an action runs, but no test exercised that path. Android gets a Robolectric test that lists targets mid-swipe, and the Control e2e lists targets during a slow swipe on iOS, where the UIKit runtime has no unit tests. The actionTargets and readAccessibility descriptions now say that an unreadable screen fails with OPERATION_UNAVAILABLE and the reason, and that an empty list means nothing is there, so an agent knows before it calls. Refs toss#45
easyhooon
marked this pull request as ready for review
November 18, 2026 06:39
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #45
Discovery (
actionTargets,readAccessibility) returned an empty list when the screen couldn't be read — locked, in the background, covered by a dialog, or mid-action. It now fails withOPERATION_UNAVAILABLEand the reason on Android and iOS, so an empty list again means "no controls". The output schema is unchanged, andperformstill doesn't refuse.Also changed:
NectoUIControlPlugininitializer now takes throwing closures, so a custom runtime can report the reason too. Existing non-throwing closures still compile.actionTargetsandreadAccessibilitymanifest descriptions say when they fail and what an empty list means, so an agent knows before calling.Changelog
Control: discovery reports why the screen can't be read instead of returning an empty list.
Test Plan
script/build,script/test: all passedSDK/Android/gradlew -p SDK/Android build: passed (NectoAndroidControlRuntimeTest17/17)script/test e2eon iPhone 17 Pro, iOS 26.2: 9 tests passednode script/tests/control-e2e.mjson the same simulator, whichscript/test e2edoes not run:New tests cover each refusal reason on Android, and discovery during a swipe on both Android and iOS (e2e). With the in-progress check removed from discovery, both the Android test and the iOS e2e check fail.
On a Galaxy S25+ (Android, USB) with the sample app, both
actionTargetsandreadAccessibility:OPERATION_UNAVAILABLE: Another window, such as a dialog or the notification shade, has input focus. …OPERATION_UNAVAILABLE: The app is not in the foreground, is covered by a system dialog, or the screen is locked. …Both recovered to the full list once the app was back in front.
On the iOS 26.2 simulator, the app in front lists targets as before. In the background or behind the lock screen, iOS usually suspends the app within seconds, so the CLI reports
TIMEOUTrather than the reason; the reason appears only while the app is still running. Either way the result is an error, not an empty list.Not verified on an iPhone.