Repository navigation
Description
Problem
An Android lease hands back the AVD name, not the adb serial:
// src/drivers/android/index.ts:189
return { deviceId: avdName, driverData };Both frontends then expose that as the device's identity:
src/mcp/session.ts—device_id: grant.device.driverDeviceIdsrc/cli/index.ts:539—udid: device.driverDeviceId
The actual serial (emulator-5554) exists in driverData
(src/drivers/android/data.ts) and is simply dropped. So an agent that leases
an Android emulator has to run adb devices and guess which emulator is
its own — reintroducing exactly the collision Pitlane exists to prevent. It
is worse under MCP, where there is no CLI output to fall back on.
Separately, the CLI's lease result drops fields the MCP output already has:
src/cli/index.ts:520 builds its object without ttlDeadline or timing,
even though parseRawLeaseGrant (src/daemon-client/contracts.ts) parses
both. A CLI-held lease therefore cannot tell when it expires — which matters
directly for the manual-renewal flow in #11.
Proposed change
Add an opaque address to the driver contract and carry it through:
DriverDevicegainsaddress: string— the string platform tooling
accepts. iOS: the simulator UDID. Android:emulator-<port>.- The core carries it without interpreting it; no core module learns what adb
or simctl is. This keeps the driver boundary intact (architecture rule:
adding a third driver must require no core changes). - Persist it on
DeviceRecordalongsidedriverDeviceId, which stays the
registry/ownership identity (thepitlane-prefixed name that proves
Pitlane created the device).
Important: the address must be re-read on makeReady, not captured at
provision. The Android port allocator (portAllocatorFor,
src/drivers/android/index.ts) assigns a console port per boot, so a device
booted from shutdown can come back on a different port. A provision-time
serial goes stale exactly in the warm-pool path that matters most.
Surface it:
- MCP
lease_simulatoroutput gainsaddressalongsidedevice_id
(src/mcp/contracts.ts). - CLI lease JSON gains
address,expires_at_ms, andtimingso both
frontends return the same information.
Acceptance criteria
- Leasing an Android emulator returns a serial that
adb -s <serial>
accepts, verified against the scriptedProcessRunner. - Booting a device from
shutdownonto a different port yields the
updated address in the next grant (regression test for the stale-serial
case). - iOS returns its UDID as the address;
device_idis unchanged for both
platforms. - CLI lease output includes
address,expires_at_ms, andtiming. -
docs/CLI.mdand the README MCP section document the new fields. -
pnpm checkgreen.
Activity
feat(driver): surface the platform address and complete the lease pay…