Repository navigation
Description
Environment
- agent-device 0.21.36, and
mainat035c2b6ca. - Xcode 27.2, macOS 27.0.1.
- A paired iPhone on iOS 27.1, unplugged with Wi-Fi off.
xcrun devicectl list devicesshows it asunavailable. - Not a regression: the devicectl inventory has always reported physical devices as booted.
Description
agent-device devices lists a paired iPhone or iPad that CoreDevice cannot reach as booted: true. agent-device boot --udid <device> then succeeds on it. The first command that fails is the app launch:
COMMAND_FAILED: Failed to launch iOS app: The device is not able to fulfill the requested usage assertion requirements. (com.apple.dt.CoreDeviceError error 4016 (0xFB0))
CoreDevice already reports the state. xcrun devicectl list devices --json-output gives the device connectionProperties.tunnelState: "unavailable". xcrun devicectl device info details gives tunnelState: "unavailable" and bootState: null.
Clients that pick devices from devices send work to the device. For example, the e2e mobile engine gives a worker slot to every booted device, so the tests on that slot fail at launch (tester-army/e2e#1528).
Required behavior
-
deviceslists a CoreDevice device whosetunnelStateisunavailablewithbooted: false. The device stays in the list.{ "platform": "ios", "id": "00008160-…", "kind": "device", "target": "mobile", "booted": false } -
The readiness check refuses that device.
boot, and every command that checks readiness, fail before they reach the device:{ "code": "COMMAND_FAILED", "message": "iOS device is not ready for automation", "details": { "kind": "not_ready", "tunnelState": "unavailable", "hint": "…connect the device…" } } -
A device whose
tunnelStateisconnected,disconnected, or absent keepsbooted: trueand passes readiness. CoreDevice opens a tunnel on demand, so an idle device it can reach reportsdisconnected. -
Simulators and XCTest-backed devices keep their current behavior.
Completion conditions
./repro.shfrom the repro branch exits0against the fix. Both cases pass.- Unit tests cover
unavailableand its closest negatives, in the devicectl inventory mapping and inensureCoreDeviceReady.
Dependencies
None.
Implementation notes
mapDevicectlAppleDevice(packages/platform-apple/src/inventory-classification.ts) setsbooted: truefor every devicectl device. Its input type already declaresconnectionProperties.tunnelState.ensureCoreDeviceReady(packages/platform-apple/src/core/physical-device-coredevice.ts) refusesconnectingand lets every other tunnel state through.- With no selector, the implicit choice ranks simulators ahead of physical devices (
appleDeviceSelectionRank). So the bug mostly affects clients that readdevicesthemselves, and commands that name the device. - devicectl marks
hardwareProperties,deviceProperties, andconnectionPropertiesas deprecated and replaces them withproperties. The whole mapper reads the deprecated keys, so a move toproperties.connection.stateis a separate change.
Reproducible Demo
Runnable repro: gronxb/agent-device-repro@ios-unavailable-device. It needs Xcode and a paired physical device that xcrun devicectl list devices shows as unavailable.
git clone -b ios-unavailable-device https://github.com/gronxb/agent-device-repro.git
cd agent-device-repro
./repro.sh # exit 1 while any case failsWith agent-device 0.21.36:
agent-device: 0.21.36
device: 00008160-XXXXXXXXXXXXXXXX, devicectl tunnelState=unavailable
FAIL devices lists the unreachable device with booted: false
booted: true
FAIL boot refuses the unreachable device as not_ready
succeeded: booted=true
Activity
[-]iOS: a paired device CoreDevice cannot reach is listed as booted and passes boot[/-][+]Unreachable paired iOS device is listed as booted and passes boot[/+]thymikee commentedon Nov 4, 2026
Triage: bug; actionable without more input from you. Confirmed on main:
mapDevicectlAppleDevice(inventory-classification.ts) setsbooted: truefor every devicectl device, andensureCoreDeviceReadyrefuses onlytunnelState: connecting. An agent can pick this up as specified:unavailablelists asbooted: falseand fails readiness asnot_ready, whileconnected,disconnectedand an absent state keep today's behavior. Thanks for the repro branch.fix(ios): report devices CoreDevice cannot reach as not booted (calls…