Skip to content

Support iOS 16 physical devices visible to xctrace but absent from devicectl #1355

Description

@pengshengsongcode

Summary

An iPhone 8 Plus running iOS 16.7.16 is available to Xcode, xcdevice, and xctrace, but it is absent from devicectl/CoreDevice. This exposes two separate compatibility gaps:

  1. agent-device does not parse the current parenthesized physical-device format emitted by xctrace.
  2. After discovery is fixed, physical-device readiness and lifecycle operations still require devicectl, so the device cannot open a session.

Environment

  • agent-device: current main at 32ba4b67f462032338154f95b4c0d9f734eccbc9 (package version 0.19.3)
  • macOS: 15.6 (24G84)
  • Xcode: 26.2 (17C52)
  • Node.js: 22.22.3
  • Device: iPhone 8 Plus (iPhone10,2), iOS 16.7.16 (20H392)

Reproduction

The device is connected, trusted, and usable from Xcode.

$ xcrun xcdevice list
# The iPhone 8 Plus is present and available.

$ xcrun xctrace list devices
== Devices ==
iPhone 8 Plus (16.7.16) (<legacy-device-udid>)

$ xcrun devicectl list devices
# The iPhone 8 Plus is absent.

$ agent-device devices --platform ios
# Before the parser fix, the iPhone 8 Plus is absent.

$ agent-device open <bundle-id> --platform ios --device <legacy-device-udid>
DEVICE_NOT_FOUND

Root cause: discovery parser

parseXctracePhysicalAppleDevices currently accepts only this legacy format:

Device Name [device-id]

Current Xcode emits physical devices as:

Device Name (OS Version) (device-id)

A minimal local change that accepts both formats, plus a regression test for the parenthesized format, makes the iPhone 8 Plus appear in:

$ agent-device devices --platform ios
iPhone 8 Plus (ios device target=mobile) booted=true

The full affected check passes after this change:

  • related tests: 1323/1323
  • coverage tests: 4542/4542
  • provider integration tests: 140/140
  • format, lint, typecheck, layering, fallow, and build: passed

Remaining blocker after discovery

Opening a session still fails because this device is not managed by devicectl/CoreDevice. In particular, the current physical-device paths depend on devicectl for:

  • readiness checks in src/daemon/device-ready.ts
  • app inventory and process lookup in src/platforms/apple/core/devicectl.ts
  • app launch/install in app-launch.ts and app-install.ts
  • runner transport address lookup in runner/runner-transport.ts
  • screenshots/file copy in screenshot.ts

A direct xcodebuild build-for-testing + test-without-building run of the agent-device XCTest runner succeeds on the same phone and reaches AGENT_DEVICE_RUNNER_LISTENER_READY. This suggests the XCTest runner itself can support the device; the blocker is the devicectl-only lifecycle/transport path.

Expected behavior

Ideally:

  1. Parse both supported xctrace physical-device line formats.
  2. For devices visible to xcdevice/xctrace but absent from devicectl, use an Xcode/XCTest/MobileDevice-compatible fallback for readiness, launch, transport, and artifact copy.

If supporting these devices is intentionally out of scope, please document the minimum supported iOS/Xcode/CoreDevice combination and report a targeted unsupported-device error instead of DEVICE_NOT_FOUND.

I can prepare the small discovery parser fix as a PR separately from the larger legacy-device backend work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-infoWaiting on reporter or external input

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions