You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warm pool boots no spare baseline copy while the warm one is held #1371
Once the warm pool had learned baseline demo (iOS), a lease took 0 s. But while that warm copy was leased (about 7 minutes), no spare copy was booted. Releasing it and leasing again 2 s later booted a new copy (38 s):
# three leases of the baseline, 45 s apart, each released first
lease 1: 27 s
lease 2: 23 s
lease 3: 0 s # learned on the 3rd lease, as documented
# … that lease held about 7 minutes …
$ simlock --gateway release <lease 3>; sleep 2
$ simlock --gateway lease --platform ios --baseline demo --detach
{"push":"progress","stage":"booting","etaMs":60000}
lease: 38 s
What you expected
The capacity docs say the warm pool "keeps idle devices booted, so a lease starts without waiting for a boot", and keeps as many booted as were leased at once at the busiest moment (here 1). Either the pool should boot a replacement while the warm copy is held, so the next lease is 0 s, or the docs should say that a held warm device counts toward that target, so no idle spare exists.
How to reproduce
Save an iOS baseline, then lease and release it three times (warmPool.baselineLearnAfter 3)
Hold the 3rd lease for a few minutes. In status, watch whether an idle copy of the baseline boots.
Release, and lease the baseline again.
Environment
Simlock 0.6.0 from main at 6674ad0, on both sides. Gateway: macOS 26.6.1 arm64. Worker (connected to the gateway over Tailscale): macOS 27.0.1 arm64, Xcode 27.1 (27A9275), emulator 37.2.13, platform-tools 36.0.0, cmdline-tools 19.0. Default warm pool settings. There was room: ios managed 2/5, RAM 11/28 GiB.
Logs and evidence
A released baseline copy is not reused (a new device id, dev_a9242485…), so the next lease always needs either a warm spare or a boot.
Confirmed, in the pure planner. This is a decision: the code follows ADR 0038 §2, and §2 rests on a premise ADR 0061 §2 made false. The test's expectation is a proposal.
src/core/warm-pool/policy.test.ts, "creates a ready copy of a learned baseline kind of count one while its only copy is leased, and while that copy is reclaiming", on bug/1371-repro.
pnpm exec vitest run --project unit src/core/warm-pool/policy.test.ts -t "baseline kind of count one"
AssertionError: expected [] to deeply equal [ { action: 'provision', reason: 'target', spec: demo, target: demo } ]
❯ src/core/warm-pool/policy.test.ts:1804:53 (the leased case)
Root cause
src/core/warm-pool/policy.ts:673: a learned kind is missing learnedCount - haveOfKind(...). haveOfKind (policy.ts:446-461) counts the kind's leased, reclaiming and claimed devices as devices the kind has. ADR 0038 §2 says so, because "when the three are released they come back ready". Since ADR 0061 §2 a virtual device is destroyed after one lease, so a held copy never comes back. With a peak of 1 and that 1 copy leased, the plan wants 0 more. The next lease boots, as the issue shows. ADR 0061 narrowed ADR 0038 §5 only and left §2 alone. Plain learned kinds behave the same way.
Simplest fix
A superseding ADR to 0038 §2: a learned kind has only its ready, idle copies. In code:
Then delete haveOfKind, and make the "counts a learned kind's leased, reclaiming and claimed devices as had" assertions in policy.test.ts:1742 expect a creation.
pnpm exec vitest run --project unit src/core/warm-pool/
Tests 1 failed | 219 passed (220) # the failure is that ADR 0038 §2 test
Alternatives rejected
Change only the docs: the behaviour is the one the docs promise. Keeping it means every learned lease pays a boot.
Count held copies only while the peak is above 1: this still leaves no spare at a peak of 1, the case in this issue.
Risk
A held burst now holds twice its peak in running slots and RAM: one leased set and one warm set.
targeted() and the over-budget rule must still spare the new ready copies.
Fast track
Defect: no — a decision, ADR 0038 §2
Fix tried: no — the ADR 0038 §2 test fails
Nothing public added or broken: yes
No ADR or rule changed: no — supersedes ADR 0038 §2
One fix: no — a docs-only fix changes what users see
Activity
V3RON commentedon Nov 6, 2026
Reproduction
Confirmed, in the pure planner. This is a decision: the code follows ADR 0038 §2, and §2 rests on a premise ADR 0061 §2 made false. The test's expectation is a proposal.
src/core/warm-pool/policy.test.ts, "creates a ready copy of a learned baseline kind of count one while its only copy is leased, and while that copy is reclaiming", onbug/1371-repro.Root cause
src/core/warm-pool/policy.ts:673: a learned kind is missinglearnedCount - haveOfKind(...).haveOfKind(policy.ts:446-461) counts the kind's leased, reclaiming and claimed devices as devices the kind has. ADR 0038 §2 says so, because "when the three are released they come back ready". Since ADR 0061 §2 a virtual device is destroyed after one lease, so a held copy never comes back. With a peak of 1 and that 1 copy leased, the plan wants 0 more. The next lease boots, as the issue shows. ADR 0061 narrowed ADR 0038 §5 only and left §2 alone. Plain learned kinds behave the same way.Simplest fix
A superseding ADR to 0038 §2: a learned kind has only its ready, idle copies. In code:
Then delete
haveOfKind, and make the "counts a learned kind's leased, reclaiming and claimed devices as had" assertions inpolicy.test.ts:1742expect a creation.Alternatives rejected
Risk
targeted()and the over-budget rule must still spare the new ready copies.Fast track
Side findings
Written by an agent.
V3RON commentedon Nov 6, 2026
Being specified in #1374. This issue stays open until that feature ships.
Written by an agent.
docs(adr): accept 0069, a learned kind keeps one ready copy while its…
github-actions commentedon Nov 7, 2026
Shipped as #1374.