Skip to content

Test runners work through the agent-device proxy without a relay #1292

Closed

Description

@V3RON

The problem

Test runners that drive devices through simlock's agent-device proxy (/v1/agent-device) need a local relay and workarounds before they work. budgie's e2e suite (budgie-at/budgie#1867, e2e/support/simlock/relay.ts and provider.ts) runs the e2e runner (@e2e-dev/mobile) from Linux against a simlock gateway and hits all of these:

  1. boot is denied. simlock's agent-device daemon policy denies boot (src/agent-device/shared/daemon-environment.ts:7). The leased simulator is already booted, but the e2e engine always sends boot before it starts, so the call fails. budgie's relay answers boot locally.
  2. close ends the lease. A session close with no arguments ends the simlock lease and deletes the simulator (src/agent-device/front/ended.ts:43). The e2e engine closes a session in the middle of a run, on a worker restart or a recording reset, and device.closeApp() sends the same close. The device is gone mid-run. budgie's relay swallows every bare close, and the provider releases the lease itself at the end.
  3. Runs that share a token share sessions. The agent-device tenant is the token's principal (src/agent-device/host/host.ts:123), so two CI runs with one token and the runner's default session name (e2e-ios) drive each other's device. budgie sets a random session name per run. The gap is documented in src/agent-device/AGENTS.md, but nothing stops it.
  4. The UDID and the lease id are hard to find. The allocate reply has no udid field, so budgie takes it from deviceKey.split(':').pop(). To call POST /v1/leases/<id>/exec, budgie scans GET /v1/leases and searches each lease's JSON for the UDID. It does not know that the agent-device leaseId already is simlock's lease id (ADR 0020).
  5. Errors don't say whose fault they are. budgie tells "the farm is down" from "this device failed" by matching message text: not connected to the gateway|no worker connected|Remote daemon is unavailable|ECONNREFUSED|…|error code: 52\d. Proxy errors carry only INVALID_ARGS, COMMAND_FAILED or UNAUTHORIZED, and details.reason is set only for WORKER_UNREACHABLE and LEASE_ENDED_BY_HOST (src/agent-device/shared/replies.ts).

Who runs into this

A CI job, or a team writing one, that runs an e2e suite with one leased simulator per test worker and drives each one through the agent-device proxy, often from a Linux runner with no Mac.

What you would like to happen

  • boot on the leased, already-booted device succeeds without doing anything. boot on any other device is still refused.
  • A test runner can close an agent-device session without ending the simlock lease. Releasing the lease stays explicit.
  • Two runs that share a token can't end up on each other's device, whatever session names they use.
  • The allocate reply names the device's udid. The docs say the agent-device leaseId is the simlock lease id used by /v1/leases/<id>/….
  • Proxy and exec errors carry a stable reason a caller can branch on: at least "the worker or gateway is unreachable" versus "this device or command failed".

Anything else

With this done, budgie can delete relay.ts (201 lines) and the string matching in provider.ts. Related: #944 (a lease grant names no device identifier), #1104.

Written by an agent.

Activity

  1. added
    request:new
    on Nov 5, 2026
  2. V3RON commented on Nov 7, 2026

    @V3RON
    ContributorAuthor

    Being specified in #1419. This issue stays open until that feature ships.

    Written by an agent.

  3. github-actions commented on Nov 8, 2026

    @github-actions
    Contributor

    Shipped as #1419.

  4. github-actions commented on Nov 8, 2026

    @github-actions
    Contributor

    Shipped as #1419.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    request:new

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions