fix(mobile): skip booted devices another agent-device session holds
Merged
OK
21d ago+95+95+01234567890123456789-18-18-01234567890123456789
What and why
- A mobile target without
deviceused every booted device of the platform (packages/mobile/src/pool.ts,BootedDevices). A simulator another tool was driving through its own agent-device session (a host app, another agent) was picked like any other, and the run died atpreparewith agent-device'sDEVICE_IN_USE, even with a free simulator booted next to it. - agent-device 0.21.29 already has the signal: device claims are host-global (
~/.agent-device/device-claims, shared by every daemon), anddevices.listprojects a live claim asclaimedBy: { session, workspace }. Dead owners are not projected. BootedDevices.bindnow skips a device whoseclaimedBy.sessionis not one of this target's slot sessions (<session>-0..slots-1), and logs what it skipped. A device held by its own slot session stays in the pool.- Every booted device held:
preparefails withENGINE_FAILURE(not retryable) naming each device and holding session, instead of failing on the first one. - No booted device and zero-config CI with one booted simulator or emulator behave as before.
- A booted device nothing holds (one you use by hand) is still in the pool. agent-device has no signal for that, so the docs say to name the device.
ℹ 2 booted ios device(s), skipping 1 held by another agent-device session (bds-a by session "t3-holder"); driving 1: bds-b
Verified
Ran it locally: yes
- Two fresh iOS 26.5 simulators in an isolated simulator set (
AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET), each daemon under its ownAGENT_DEVICE_STATE_DIR.bds-aheld byagent-device open com.apple.MobileSMS --session t3-holderfrom a separate daemon, standing in for another tool. Scratch project:mobile({ platform: 'ios' }), nodevice, one Settings test,e2e run --workers 2 --retries 0.
| main | this branch |
|---|---|
2 booted ios device(s); driving 1: bds-a then ENGINE_FAILURE boot failed: ios device DA9C... is owned by session "t3-holder", no tests run | skipping 1 held by another agent-device session (bds-a by session "t3-holder"); driving 1: bds-b, test passes, t3-holder still on Messages |
- Both held (
t3-holder,t3-holder-2):every booted ios device is held by another agent-device session (bds-a by session "t3-holder", bds-b by session "t3-holder-2"); boot another one, close a holding session, or name the device in the target's \device` option`, nothing booted or opened. - Holders closed, two free: drives as before. One booted, no holder (CI shape):
1 booted ios device(s); driving 1: bds-a, passes.