fix(device-selection): list only tied devices in an ambiguous device error
Summary
When open without a platform finds a booted iOS simulator and a booted Android emulator, it fails with AMBIGUOUS_MATCH. This PR does not change that. It makes the failure cheaper to recover from, so an agent needs only one short retry:
- Only the tied devices are listed. The error used to list every device that matched, including every shut-down simulator. Now
details.devicesanddetails.retrySelectorshold only the devices that are equally preferred, which are the ones the kernel refused to choose between. - Typed as never dispatched. The kernel's device tie now carries
dispatched: 'no'. The--platform iossimulator ambiguity and the provider ambiguity carry it too. Selection runs before any device operation, so the "May have reached the device… Run snapshot" text no longer appears. - One recovery step. The hint is now
Retry with the id of the intended device: --serial emulator-5554 or --udid <sim-udid>., built from the tied devices' ids.
Scope reduced by maintainer decision. An earlier version of this PR let the installed app break the tie (it probed each tied device and picked the only one with the app). That is dropped: when a device request is ambiguous, agent-device fails explicitly instead of picking a device by a heuristic that different users would expect differently. The existing --platform ios behaviour, where the booted simulator that has the app wins, is unchanged from main. No help or docs change: the error code and its fields keep the same shape.
Validation
- Head b66bea31a3: focused vitest passes (device-selection, kernel, command-output: 44 files, 580 tests).
pnpm typecheckandpnpm lintare clean. - New test: a cross-platform tie with shut-down simulators lists only the two booted devices, carries
dispatched: 'no', and names both ids in the hint. - No live device run. Only the error contents change, not dispatch or native execution. CI owns full validation.
🤖 Generated with Claude Code