feat(limrun): keep idle sessions alive with LIMRUN_KEEP_ALIVE
Merged
JB
2mo ago+89+89+01234567890123456789-1-1-0123456789
Summary
Limrun ends an instance after its inactivity timeout. An agent-device session that sits idle, for example while a model thinks between steps, loses its instance mid-run. With LIMRUN_KEEP_ALIVE=1, the Limrun runtime pings each leased instance every 30 seconds from the session's own client until the lease is released. It is off by default, so instance lifetime is unchanged unless requested.
export LIMRUN_KEEP_ALIVE=1
agent-device connect limrun --platform ios
new LimrunRuntime({ instances: { ios: { apiUrl, token } }, keepAlive: true });
Stacked on #3173: the flag is read in src/provider-limrun-credentials.ts, which that PR adds. 6 files, including help and the Limrun docs page.
Validation
At 77b62f4:
pnpm check:affected --runpasses (139 files, 1043 tests).- Mutation check: skipping
startKeepAlivefails the on/off and throwing-ping tests. - Live on Limrun iOS and Android instances (3 min inactivity timeout, 240 s idle while connected, no org key in the agent-device environment):
- Without the flag, both instances ended
terminated (InactivityTimeout). - With
LIMRUN_KEEP_ALIVE=1, both stayedreadyandsnapshot -isucceeded after the idle. Release,daemon stopand a daemon SIGKILL still left the attached instances running.
- Without the flag, both instances ended
- Pings from a separate client kept the instance alive, but agent-device's ADB tunnel still went offline. That is why the session's own client sends them.