fix(limrun): let tests run on Limrun devices again

Merged
KR
7d ago
+59-23

What and why

  • Every limrun() lease failed seconds after Limrun created the device, so no test or e2e mcp session could run on one (@e2e-dev/limrun 0.2.4 with @e2e-dev/mobile 0.12.6):

    ENGINE_FAILURE: device provider "Limrun" could not lease a device: returned a lease without an id and a daemon baseUrl or JSON client configuration (no `session` or daemon keys) while preparing engine mobile for target "ios"
    
  • #1513 put the agent-device session on the lease's client, so the install and heartbeat clients that reuse that object would name one. The mobile engine reserves that key (RESERVED_CLIENT_KEYS in packages/mobile/src/bindings.ts) and rejects a lease that sets it.

  • The driver now leaves session off the client it returns. Its allocate and install clients and the heartbeat add it themselves from leaseSession(stateDir), the way packages/mobile/src/lease/ does.

  • DriverBinding.client is typed as DeviceClientConfig, so a session in that literal no longer compiles.

  • leaseSession is a local copy of mobile's five lines. @e2e-dev/mobile/lease does not export it, and exporting it would raise Limrun's peer floor on mobile.

  • The driver unit test asserted that session was on the binding. It now asserts the exact client the engine receives, and fails on main.

Issue

No e2e issue. This is a regression from #1513, found on 2026-11-10 with the published packages.

Verified

Ran it locally: yes

  • A scratch project on the built packages, against a real Limrun iOS simulator. The target is mobile({ platform: 'ios', device: limrun({ hardTimeout: '15m' }) }) with app: { bundleId: 'com.apple.mobilesafari' }, run with e2e run tests/safari.e2e.ts --video. The test opens Safari, opens https://example.com, closes Safari's first-launch tip, and expects the page text.
mainthis branch
Lease rejected, no test executed, exit 3Lease accepted, 1 test passed, exit 0
no device to showSafari on the Limrun simulator

main:

ℹ leasing 1 ios device(s) from Limrun
ℹ Limrun (1 of 1): created ios_euna_01m723ptnafjqaby9advh0rnmp
ℹ Limrun: released 1 device(s)

 ERROR  infrastructure error ENGINE_FAILURE (launch)
device provider "Limrun" could not lease a device: returned a lease without an id and a daemon baseUrl or JSON client configuration (no `session` or daemon keys) while preparing engine mobile for target "ios"

 Test Files  no test files
      Tests  no tests executed
     Errors  1 error

this branch:

ℹ leasing 1 ios device(s) from Limrun
ℹ Limrun (1 of 1): created ios_euna_01m724he11fya8hmab1bjqgwm3
ℹ Limrun: leased ios_euna_01m724he11fya8hmab1bjqgwm3
ℹ booting limrun:ios:1e6bf23c551b5a69ed8fbb04f9baeb0f (1 of 1)
 ✓ mobile engine for target "ios" prepared 1.42s
   ✓ |ios| tests/safari.e2e.ts > Safari opens a page on a Limrun device 7.10s
ℹ Limrun: released 1 device(s)

 Test Files  1 passed (1)
      Tests  1 passed (1)
  • A second test idles 90s before driving Safari, past the lease's 60s TTL. It passed and logged no driver lease renewal failed line. I ran no control without the heartbeat.
  • After the runs the account has no instance in creating, assigned, or ready.
  • Not run: Android on Limrun, the appPath install on a live device (Safari is preinstalled, so that client is unit-tested only), and e2e mcp (it reaches the same engine prepare).
  • A fresh-context review of the diff found nothing to fix.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: not applicable.
  • Docs updated in the same PR: no change needed, the docs do not describe the lease client's session.
  • Contract change: not applicable.
  • Engine contract change: not applicable.

Written by Claude Fable 5.2 in Claude Code, running in T3 Code.

https://github.com/user-attachments/assets/07357783-67e3-420c-a33e-97b9fc7f8995