fix(mobile): name the agent-device session for device-cloud leases
Merged
TH
14d ago+27+27+01234567890123456789-7-7-0123456789
What and why
- agent-device is about to refuse provider-lease requests from a Node client that names no session (
REMOTE_SESSION_REQUIRED, callstack/agent-device#4177): on a shared daemon, an unnamed client lands on thedefaultsession and can act through another agent's lease. - Four e2e clients hit that today: the BrowserStack/TestMu AI lease
allocateandheartbeatinpackages/mobile/src/lease/, and Limrun'sallocateandapps.installinpackages/limrun/src/driver.ts. Limrun's heartbeat reuses the binding's client. - Each now names a session,
e2e-lease-<8 hex of the lease's stateDir>. One daemon holds one lease, so the name only has to be stable perstateDir. The worker engine still sets its own session over the lease client's (packages/mobile/src/engine.ts). - Limrun inlines the same one-line hash instead of importing it, so
@e2e-dev/mobilegains no public export. - Works with the pinned agent-device 0.21.35 as is, so e2e can bump past #4177 without a break.
Issue
No e2e issue: this prepares for callstack/agent-device#4177, planned for agent-device 0.22.
Verified
Ran it locally: yes
pnpm checkpasses;@e2e-dev/mobileunit tests 484 passed,@e2e-dev/limrun17 passed.- On a real daemon, mirroring the lease driver (private
stateDir, socket transport,leaseProvider: 'proxy', allocate then heartbeat):
--- agent-device #4177 head (3707e6277c)
unnamed: refused INVALID_ARGS reason=REMOTE_SESSION_REQUIRED
named: allocate+heartbeat ok (session e2e-lease-fbf28664, lease 2861f02a4e07980798a6afef58c2f492)
--- agent-device 0.21.35 (e2e pin)
unnamed: allocate+heartbeat ok (session none, lease 671c6f9fa6e0b968260b1d2587f727e7)
named: allocate+heartbeat ok (session e2e-lease-3ca37d1f, lease 13eac357ffe4280dbb7fa005a7503172)
- Not run against live BrowserStack, TestMu AI, or Limrun devices.
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.
š¤ Generated with Claude Code