Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ea83342
test: a worker with no targets keeps a released device ready past idl…
V3RON Oct 20, 2026
c29ba25
feat(warm-pool): a worker with no targets keeps the kinds it has leas…
V3RON Oct 20, 2026
3b353d9
test: the warm targets flow keeps a leased non-targeted kind ready (#…
V3RON Oct 20, 2026
61dd6cc
test: LearnedKinds.kinds counts a kind's peak over the last 24 hours,…
V3RON Oct 20, 2026
122ed3b
test: RetrySchedule.failures answers the failures in a row and 0 afte…
V3RON Oct 20, 2026
87259f6
feat(warm-pool): RetrySchedule answers the failures in a row of a spe…
V3RON Oct 20, 2026
e2611cd
test: LearnedKinds keeps at most 32 kinds per platform (#776)
V3RON Oct 20, 2026
fc91962
feat(warm-pool): a platform keeps at most 32 learned kinds (#776)
V3RON Oct 20, 2026
2e79d64
test: LearnedKinds survives a reopen and forget and clear remove the …
V3RON Oct 20, 2026
60c4b87
feat(warm-pool): the record can forget a kind and clear (#776)
V3RON Oct 20, 2026
04f39ad
test: warmPoolOwner version 1 creates both STRICT tables with their c…
V3RON Oct 20, 2026
487b65c
test: warmPoolOwner's lease_id column reads as required in a STRICT t…
V3RON Oct 20, 2026
3402770
test: evaluate fills configured targets in config order, then learned…
V3RON Oct 20, 2026
f01a17b
test: evaluate keeps a learned kind's never-leased device out of neve…
V3RON Oct 20, 2026
5ea41fe
test: evaluate displaces an older learned kind's least recently used …
V3RON Oct 20, 2026
15a767a
feat(warm-pool): a newer learned kind displaces an older one's idle d…
V3RON Oct 20, 2026
314f42a
test: evaluate proposes no recently-released boot (#776)
V3RON Oct 20, 2026
86d95fe
feat(warm-pool): the pool boots no released device back unasked; a le…
V3RON Oct 20, 2026
107e488
test: targetedDevices lists a learned kind's ready devices up to its …
V3RON Oct 20, 2026
9e43706
test: WarmPool learns on lease.granted, closes on lease.released and …
V3RON Oct 21, 2026
e911a05
fix(warm-pool): a pool that is off learns nothing, and a lease grante…
V3RON Oct 21, 2026
a20ddfc
test: WarmPool.start() closes open lease rows the registry no longer …
V3RON Oct 21, 2026
9371f0e
feat(warm-pool): start() closes the lease rows the registry no longer…
V3RON Oct 21, 2026
76ec33d
test: WarmPool starts one catalog read per platform with a learned ki…
V3RON Oct 21, 2026
51cdcbf
feat(warm-pool): the pool forgets learned kinds whose model, runtime,…
V3RON Oct 21, 2026
3311808
test: WarmPool.figures() and the short log list configured targets on…
V3RON Oct 21, 2026
1710405
feat(warm-pool): status, the short log and target-missed describe con…
V3RON Oct 21, 2026
fd7c002
test: WarmPool logs a LearnedKinds throw once and runs the pass witho…
V3RON Oct 21, 2026
ab7410d
feat(warm-pool): a failing record costs the pool what it learns, neve…
V3RON Oct 21, 2026
3fa9e9c
test: WarmPool forgets a learned kind on its third failed boot or cre…
V3RON Oct 21, 2026
dada3fd
feat(warm-pool): a learned kind is forgotten after three failed boots…
V3RON Oct 21, 2026
641f07e
test: NukeService clears the warm pool's record before it resets devi…
V3RON Oct 21, 2026
e78b368
feat(nuke): nuke clears the warm pool's record before it resets devic…
V3RON Oct 21, 2026
6731bcf
test: the fake driver lists the models the warm pool tests lease, as …
V3RON Oct 21, 2026
307d3f9
test: e2e restart from the record with the pool off then on, and nuke…
V3RON Oct 21, 2026
69e6f04
docs: the pool keeps leased kinds; the reserve e2e counts the warm bo…
V3RON Oct 21, 2026
69591da
test: slow lane, with no target a released simulator and emulator are…
V3RON Oct 21, 2026
6ef8428
refactor(warm-pool): split the pass's resolve step and the displacing…
V3RON Oct 21, 2026
6e85f91
test: the RAM-budget and doctor-drift e2e account for the pool keepin…
V3RON Oct 21, 2026
0d5a7e7
test: cleanup e2e expects a leased kind's idle device kept, not demot…
V3RON Oct 21, 2026
851801f
test: the attention console specs run with the pool off, so no learne…
V3RON Oct 21, 2026
2844743
test: audit closes the gaps probing found in the warm pool's record, …
V3RON Oct 21, 2026
eef1aff
test: the cleanup e2e stops claiming a dry run executes nothing, whic…
V3RON Oct 21, 2026
d4d4a24
docs: neverLeasedIdle also spares the devices a learned kind keeps (#…
V3RON Oct 21, 2026
3582994
fix(warm-pool): displace only when the kind can then boot, never a sp…
V3RON Oct 21, 2026
bb314d4
fix(warm-pool): a catalog answer asks for a pass at once, a failed-re…
V3RON Oct 21, 2026
5658882
test: slow lane, a released targeted device may stay down once its ki…
V3RON Oct 21, 2026
8b3b067
test: slow lane, wait for the ready device of each kind after release…
V3RON Oct 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,7 @@ never acts on it.

Emergency reset: force-release all leases, kill emulator/simulator processes
simlock started, clear the queue. With `--delete-devices`, also destroy every
registry-managed device. Never touches devices outside the registry. A lease on
registry-managed device. It also clears what the warm pool has learned from past leases, so no device is booted back unasked afterwards. Never touches devices outside the registry. A lease on
an enrolled physical device ends like any other, and its apps are uninstalled;
the device stays enrolled, and `--delete-devices` never deletes one. It stays
a per-machine command: a gateway answers `UNSUPPORTED_IN_GATEWAY_MODE` (exit
Expand Down
6 changes: 3 additions & 3 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ edit yourself keeps the mode you give it until the next `config set`; run
| Property | Description | Default |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `capacity.strategy` | Which policy decides how many devices may exist and run at once: `resource` or `fixed`. The options under `capacity.config` are that strategy's own -- see [Capacity strategies](#capacity-strategies). | `resource` |
| `idle.shutdownAfterMs` | How long an unused device sits idle before Simlock shuts it down (tier 1, reclaims RAM). Devices that a `warmPool.targets` entry keeps ready ignore it; a device that never served a lease and that no target keeps is shut down once it has been ready this long. | `10 minutes` |
| `idle.shutdownAfterMs` | How long an unused device sits idle before Simlock shuts it down (tier 1, reclaims RAM). Devices that a `warmPool.targets` entry keeps ready, or that the pool keeps for a kind it has leased, ignore it; a device that never served a lease and that no target or leased kind keeps is shut down once it has been ready this long. | `10 minutes` |
| `idle.deleteAfterMs` | How long a shut-down device sits idle before Simlock deletes it (tier 2, reclaims disk). Idle counts from the end of the device's last lease, or, for a device that never served one (one the pool created for a `warmPool.targets` entry that was later lowered or removed, say), from when it was shut down. | `1 hour` |
| `warmPool.enabled` | Whether released devices are kept warm. `true` keeps a released device running or boots it back when the running limit has room, and shuts down the least recently used idle devices when the machine is over its running limit. `false` keeps nothing warm: every idle running device is shut down. | `true` |
| `warmPool.enabled` | Whether released devices are kept warm. `true` boots a released device back and keeps it ready, when the running limit has room: the pool remembers every kind of device it has leased (model, OS, mode, image tag) and keeps as many ready as were leased at once in the last 24 hours, at least one, across daemon restarts, until the model or runtime is gone, three boots in a row fail, or `simlock nuke` clears it. It also shuts down the least recently used idle devices when the machine is over its running limit. `false` keeps nothing warm and learns nothing: every idle running device is shut down. | `true` |
| `warmPool.reserveRunning.ios` / `warmPool.reserveRunning.android` | Running slots per platform that idle warm devices may not fill, so a request for a model nobody predicted boots at once instead of shutting a warm device down first. With a running limit of 3 for the platform and a reserve of 1, at most 2 idle devices stay warm. The global running limit loses the sum of the two reserves, each counted at most up to its platform's running limit. A non-negative integer; a reserve at or above the platform's running limit keeps no device of that platform warm. | `0` |
| `warmPool.targets` | Kinds of device Simlock keeps booted, clean and unleased ahead of demand. Each entry is written like a lease request: `platform` (`ios` or `android`), `model` (the exact model name), optionally `osVersion` (a version or an OS range such as `">=18"`) and `mode` (`slim` or `full`), and a `count`. Every pass Simlock resolves each entry the way a lease request is resolved, so the newest installed runtime in range is used and the platform's default mode applies when `mode` is left out, then boots a shut-down device of that kind or creates one until `count` are ready. The first lease for that kind is granted without a boot, including under `lease.identity` `fresh`, where every lease then costs one new device. A target never shuts a device down to make room and never downloads a runtime: one whose runtime or model is not available stays short and is logged. `simlock status` shows each kind of device the targets name (entries that resolve to the same device are one line; an entry that could not be resolved, and every entry while the pool is off or before its first pass, is a line of its own) with how many are ready and booting and, when the last pass could do nothing for it, why it is short (`runtime-missing`, `unknown-model`, `running-limit`, `reserve`, `ram-budget` and the others listed under [`simlock status`](CLI.md#simlock-status)), and with `warmPool.enabled` `false` shows every target as `disabled`; a target that is filling or waiting behind a queued request the pool could not serve is not short. `simlock doctor` reports a target whose runtime or model does not exist, and targets whose counts add up to more than the running limit leaves after the reserve. A device that fails to boot is tried again after 1, 2, 4 and so on minutes, at most 10 apart. Unknown keys, a `count` below 1, an unknown platform, more than 256 entries and a `model` or `osVersion` longer than 256 characters fail the load, naming the key. Changes take effect on daemon restart; with `warmPool.enabled` `false` no target is kept. | `[]` |
| `warmPool.maxConcurrentBoots` | The most boots and creations in flight at once. The warm pool starts a boot, or a creation for a request behind the head, for every queued request no ready device serves, oldest first (the head's creation and requests a ready device serves are the lease's own), and then for the targets, up to this many together with the boots and creations queued requests are running themselves. A positive integer. | `max(1, floor(cpuCount / 4))` over the host's CPUs, so `3` on a 12-CPU Mac |
Expand All @@ -26,7 +26,7 @@ edit yourself keeps the mode you give it until the next `config set`; run
| `warmPool.quarantine.maxRetryBackoffMs` | Cap on the quarantine retry backoff. | `5 minutes` |
| `lease.defaultTtlMs` | TTL applied to a lease whose `lease.request` carried no `ttlMs` — **that request only**. It is *not* the renew fallback: a renew given no explicit TTL re-applies the lease's own stored width, so a lease granted for longer keeps it. A lease not renewed before its deadline expires and its device is reclaimed. | `15 minutes` |
| `lease.maxTtlMs` | Largest TTL a request or a renew may ask for. A larger `ttlMs` is rejected with `BAD_REQUEST` rather than silently clamped, so a caller is never left believing it has more time than it does. | `4 hours` |
| `lease.identity.ios` | Whether iOS leases reuse simulators. `reusable` erases a released simulator, shuts it down and keeps it for a later lease. `fresh` creates a simulator for each lease and deletes it when the lease ends — by release, by expiry, or because the device was lost — so no simulator serves two leases. If the delete fails, the simulator is quarantined, never leased again, and the delete is retried. **Boot cost:** under `fresh` no simulator stays warm after a release, so every iOS lease pays a full boot (about 30 seconds on an Apple silicon Mac), unless a `warmPool.targets` entry has already created and booted a device of that kind, which the lease is then granted at once. Under `reusable` a released simulator is booted back when the running limit has room (see `warmPool.enabled`), so a lease that arrives afterwards often finds it ready; one that arrives while it boots waits for it and is granted it when it is ready (not with `--no-wait`, which plans as if the device were not there and so gets what any lease gets at that moment: a device of its own, an idle device made room for, or `NO_CAPACITY`); one that arrives first, or when there is no room, pays the boot. Each device keeps the setting it was created with, even if you change this value later. | `reusable` |
| `lease.identity.ios` | Whether iOS leases reuse simulators. `reusable` erases a released simulator, shuts it down and keeps it for a later lease. `fresh` creates a simulator for each lease and deletes it when the lease ends — by release, by expiry, or because the device was lost — so no simulator serves two leases. If the delete fails, the simulator is quarantined, never leased again, and the delete is retried. **Boot cost:** under `fresh` no simulator stays warm after a release, so every iOS lease pays a full boot (about 30 seconds on an Apple silicon Mac), unless a `warmPool.targets` entry, or a kind the pool learned from earlier leases, has already created and booted a device of that kind, which the lease is then granted at once. Under `reusable` a released simulator is booted back and kept ready when the running limit has room (see `warmPool.enabled`), so a lease that arrives afterwards often finds it ready; one that arrives while it boots waits for it and is granted it when it is ready (not with `--no-wait`, which plans as if the device were not there and so gets what any lease gets at that moment: a device of its own, an idle device made room for, or `NO_CAPACITY`); one that arrives first, or when there is no room, pays the boot. Each device keeps the setting it was created with, even if you change this value later. | `reusable` |
| `lease.identity.android` | The same setting for Android emulators. `fresh` is accepted, but it is designed for iOS. | `reusable` |
| `lease.requestRetentionMs` | How long a settled lease request stays stored, counted from when it settled. A client that repeats a request with the same `idempotencyKey` inside this window gets the stored result back; after it, the record is removed and the same key starts a new request. | `10 minutes` |
| `lease.maxRequestRecords` | The most lease-request records Simlock keeps. When a new request would go over it, the oldest settled record is removed. A request that is still open is never removed. | `10000` |
Expand Down
2 changes: 1 addition & 1 deletion docs/EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ the gateway's own lease index before any worker is ever contacted. `lease-id-tak
| `device.quarantine-recovered` | device id, attempts, reclaim strategy (erase/snapshot/wipe/uninstall), `missingApps` for a physical device, the device's `platform` (`ios` or `android`) | a quarantined device's retried purge succeeded; it returned to `ready`/`shutdown` and rejoined the warm pool. Never emitted for a `fresh` device: its retry is a delete, and a successful one emits `device.deleted` | QuarantineCoordinator | implemented |
| `device.quarantine-abandoned` | device id, attempts, the device's `platform` (`ios` or `android`) | a quarantined device exhausted its configured retry budget (`warmPool.quarantine.maxRetries`) — purge retries, or delete retries for a `fresh` device — and was destroyed, or, for a physical device, unenrolled: Simlock never destroys a physical device | QuarantineCoordinator | implemented |
| `device.quarantine-stranded` | device id, attempts, stable error summary, the device's `platform` (`ios` or `android`) | a quarantined device exhausted its retry budget (purge or delete retries) and the destroy that should have retired it also failed; it stays `quarantined` with no further retry until an operator intervenes | QuarantineCoordinator | implemented |
| `device.shutdown` | device id, initiator (rule/command; `warm-pool` when the warm pool shut an idle device down, over the running limit, with `warmPool.enabled: false`, to keep `warmPool.reserveRunning` running slots free, or because a ready device that never served a lease and that no `warmPool.targets` entry keeps has been idle past `idle.shutdownAfterMs`) | device stopped, still on disk | Registry; the reclaim coordinator for interrupted reclaim recovery | implemented |
| `device.shutdown` | device id, initiator (rule/command; `warm-pool` when the warm pool shut an idle device down, over the running limit, with `warmPool.enabled: false`, to keep `warmPool.reserveRunning` running slots free, or because a ready device that never served a lease and that no `warmPool.targets` entry and no kind the pool learned from a lease keeps has been idle past `idle.shutdownAfterMs`, or to displace it: an older leased kind's idle device shut down so a newer kind can boot into its running slot) | device stopped, still on disk | Registry; the reclaim coordinator for interrupted reclaim recovery | implemented |
| `device.deleted` | device id, initiator (`lease-end` when a `fresh` device's lease ended and its delete completed, including a delete retried from quarantine; `doctor` when `doctor --fix`, or a daemon start that found a leased device gone from its platform, marked it missing; `operator` when `device remove` unenrolled a physical device; `quarantine` when a physical device's retries ran out and it was unenrolled; `lease-engine` when a device that failed to boot for a lease was destroyed in cleanup; `cleanup-reaper` when the cleanup reaper destroyed a device; `nuke` when `nuke` destroyed it), physical (`true` for an enrolled physical device, `false` for a simulator or emulator) | device removed from the registry, and from disk for a simulator or emulator; a physical device is only forgotten, nothing on it changes | Registry | implemented |
| `device.enrolled` | device id, platform, driver device id (the canonical ID), model, OS version, class (phone/tablet), app count, reenrolled | `device add` wrote a physical device `ready`; `reenrolled` is `true` when the device already had a record, which kept its device id and took a fresh read of its model, OS version, class and apps | Registry | implemented |
| `device.absence-detected` | device id, previous state (ready/leased/reclaiming), absent reason (locked/untrusted/not-present) | an enrolled physical device became `absent`: it was not present for the grace period (`health.stableObservations` reads in a row, `health.probeIntervalMs` apart), or its reclaim failed while it was not present. For a leased device `lease.released` (device-lost) comes first | Registry; ReclaimCoordinator | implemented |
Expand Down
2 changes: 1 addition & 1 deletion docs/internal/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ worker daemon ── uplink (WebSocket to /v1/uplink, worker dials) ──┘
- A gateway is a second set of handlers for the same contract. Every frontend
works against either mode unchanged.
- State lives on the worker (`state.db`, its registry tables written only by core's
`Registry`). A gateway keeps only its tokens, its instance id and its drained-worker set on
`Registry`; the warm pool's learned kinds in its own tables). A gateway keeps only its tokens, its instance id and its drained-worker set on
disk (`state.db`); everything else is rebuilt from the workers that reconnect.

## Modules
Expand Down
Loading
Loading