You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android leases over HTTP give no adb serial: udid is the AVD name #817
A lease granted over the HTTP API gives no way to reach an Android emulator with adb. The lease object's udid is the device's driver id (device.driverDeviceId, src/http/tracker.ts:71). For an Android emulator that is the AVD name (simlock_<uuid>), not the adb serial (emulator-5554) that adb -s needs. No HTTP response carries the serial: the lease object has no address field, although the contract's device record has one (src/contract/schemas.ts:211,272) and the CLI's lease line includes device.address.
So a remote agent that leases an Android device over HTTP cannot run adb -s <serial> … through POST /v1/leases/{id}/exec without first running adb devices and then adb -s <serial> emu avd name on each serial to find its own. iOS is not affected, because a simulator's driver id and its address are both the UDID.
What you expected
The HTTP lease object names the address to point tools at (the adb serial on Android, the UDID on iOS), the same value the CLI prints as device.address.
How to reproduce
On a worker with Android set up and HTTP on, create an agent token: simlock token create --role agent.
curl -X POST http://127.0.0.1:4701/v1/lease-requests -H "Authorization: Bearer <secret>" -H 'Content-Type: application/json' -d '{"platform":"android","model":"Pixel 8"}', then wait until the request is granted.
Look at the lease object: udid is simlock_…, and no field holds emulator-5554.
Compare simlock lease --platform android --device "Pixel 8" --detach, whose device.address is the serial.
Environment
main at 4cc44f8. Found while writing the website's "Remote agents over HTTP" page (PR #816), which documents the adb devices workaround.
Confirmed as reported. A gap: the expected address field beside udid is a proposal.
src/http/app.test.ts › lease routes › "names an Android emulator's adb serial as address, beside its AVD name as udid, on the lease object the POST, the request poll and GET /v1/leases/:id answer", on bug/817-repro.
pnpm exec vitest run --project unit src/http/app.test.ts -t "adb serial as address"
{
"get": { - "address": "emulator-5554", "udid": "simlock_3f9a2c1e" },
"poll": { - "address": "emulator-5554", "udid": "simlock_3f9a2c1e" },
"post": { - "address": "emulator-5554", "udid": "simlock_3f9a2c1e" },
}
❯ src/http/app.test.ts:1526 }).toMatchObject({ get: named, poll: named, post: named });
Root cause
Gap. The address reaches the HTTP layer on every path: the grant's device.address (src/contract/schemas.ts:272), the worker registry's DeviceRecord.address, and a gateway's grantedDevices() (grant shape). buildLeasePayload (src/http/tracker.ts:60) copies only driverDeviceId, into udid (:71); HttpLeaseDevice (:376) has no address, so it is dropped. The OpenAPI leasePayloadSchema (src/http/lease-declarations.ts:16) lacks it too.
Simplest fix
Add address?: string to HttpLeaseDevice and LeasePayload, spread it in buildLeasePayload when defined, declare it optional in leasePayloadSchema, and replace the adb devices workaround in remote-agents.mdx:153 with adb -s <address>. The tracker change alone turns the test green, with the rest of app.test.ts still green.
Shape pinned: a field named address, as the CLI's device.address; udid unchanged.
Alternatives rejected
Serial in udid on Android: changes a documented field's meaning.
Exec adds -s <serial> for virtual adb: fixes exec only, not other clients.
ANDROID_SERIAL in the virtual lease environment: the HTTP lease object does not carry the environment.
Risk
Gateway GET /v1/leases/:id reads grantedDevices(): check the worker refresh keeps address. The test covers the worker only.
A device never made ready, or shut down, has no address: the field stays optional and the docs say so.
Activity
V3RON commentedon Oct 23, 2026
Reproduction
Confirmed as reported. A gap: the expected
addressfield besideudidis a proposal.src/http/app.test.ts› lease routes › "names an Android emulator's adb serial as address, beside its AVD name as udid, on the lease object the POST, the request poll and GET /v1/leases/:id answer", onbug/817-repro.Root cause
Gap. The address reaches the HTTP layer on every path: the grant's
device.address(src/contract/schemas.ts:272), the worker registry'sDeviceRecord.address, and a gateway'sgrantedDevices()(grant shape).buildLeasePayload(src/http/tracker.ts:60) copies onlydriverDeviceId, intoudid(:71);HttpLeaseDevice(:376) has noaddress, so it is dropped. The OpenAPIleasePayloadSchema(src/http/lease-declarations.ts:16) lacks it too.Simplest fix
Add
address?: stringtoHttpLeaseDeviceandLeasePayload, spread it inbuildLeasePayloadwhen defined, declare it optional inleasePayloadSchema, and replace theadb devicesworkaround inremote-agents.mdx:153withadb -s <address>. The tracker change alone turns the test green, with the rest ofapp.test.tsstill green.Shape pinned: a field named
address, as the CLI'sdevice.address;udidunchanged.Alternatives rejected
udidon Android: changes a documented field's meaning.-s <serial>for virtual adb: fixes exec only, not other clients.ANDROID_SERIALin the virtual lease environment: the HTTP lease object does not carry the environment.Risk
GET /v1/leases/:idreadsgrantedDevices(): check the worker refresh keepsaddress. The test covers the worker only.check-openapi.mjsmust pass with the new field.Written by an agent.
fix(http): an Android lease over HTTP names its adb serial as address (…
docs(website): the granted-lease example shows address (#817)
fix(http): an Android lease over HTTP names its adb serial as address (…