Skip to content

Warm pool: learn a baseline only after it is leased 3 times in a day #1257

Closed
1 of 1 issue completed
Closed

Description

@V3RON

Request: #1255

Problem

With baselines (#327), the warm pool learns every baseline that is leased even once as its own kind and keeps at least one copy of it booted until the kind is forgotten, with no time limit. On 2026-11-04, one lease each of ios-test and android-test on a test worker made the pool keep 4 kinds warm (plain iPhone 17, plain Pixel 9 and the two baselines): 3 simulators and 2 emulators booted at once, a load average of 217 on an M3 Pro, and baseline leases of 39 s and 60 s instead of ~25 s.

A worker whose agents use several baselines a day keeps one extra booted device per baseline, even for a baseline someone leased once to try it. An operator cannot opt one out: warm forget works per model, and warmPool.learn: false turns all learning off.

A second gap: when a new version of a learned baseline is saved, the learned kind takes only the new version number. A version saved from a device of another model, OS or image tag leaves the pool warming copies that no longer match the baseline (found in #1245's review).

Who it is for

An operator of a worker whose agents lease baselines: some all day, some once to try them. They want the busy baselines warm and the one-off ones to cost nothing after their lease.

Outcome

  • A baseline leased fewer than N times in 24 hours leaves no device booted after its lease. N is warmPool.baselineLearnAfter, default 3.
  • A baseline leased N times within 24 hours is kept warm from its Nth lease on, as a plain kind is after its first.
  • A learned baseline is warmed as its newest version: platform, model, OS, mode, image tag and version. A version saved from another model is warmed as that model on the next pass.
  • Plain kinds behave as today.

How it works for the user

flowchart TD
  A[agent leases baseline ios-test] --> B{leases of ios-test in the last 24 h, this one included}
  B -->|fewer than N| C[copy, boot, lease; after release nothing stays booted]
  B -->|N or more| D[kind learned: a copy stays booted, as a plain kind]
  D --> E[a new version is saved from another model]
  E --> F[next pass warms copies of the new version's model]
  D --> G[forgotten: catalog, 3 failed boots, 33rd kind, removed or stale, warm forget, nuke]
  G --> B
Loading

With N = 3 (the default), on a worker with no other leases:

$ simlock lease --baseline ios-test   # 1st today; released after
$ simlock status
warm pool
  (nothing listed for ios-test)

$ simlock lease --baseline ios-test   # 2nd; released after
$ simlock lease --baseline ios-test   # 3rd; released after
$ simlock status
warm pool
  iPhone 17 / 26.0 / full / baseline ios-test   learned   wanted 1  ready 1  booting 0

Today the first lease alone makes that learned line appear.

$ simlock config set warmPool.baselineLearnAfter 0
{"error":{"code":"USAGE","message":"Invalid config after setting warmPool.baselineLearnAfter: Invalid config value for \"warmPool.baselineLearnAfter\": expected a positive integer"}}
# exit 2

Examples

Leases of one baseline, N = 3, times counted from the first lease:

Leases Today After
one at 0 h learned at 0 h not learned
at 0 h, 1 h learned at 0 h not learned
at 0 h, 1 h, 2 h learned at 0 h learned at 2 h
at 0 h, 1 h, 25 h learned at 0 h not learned (the 0 h lease is out of the window at 25 h)
at 0 h, 1 h, 25 h, 26 h learned at 0 h not learned (at 26 h only 25 h and 26 h are within 24 h)
at 0 h, 20 h, 23 h learned at 0 h learned at 23 h
at 0 h, 12 h, 24 h learned at 0 h not learned (a lease exactly 24 h before is out of the window)
v1 at 0 h, v2 at 1 h, v2 at 2 h learned at 0 h as v1's model learned at 2 h, warmed as v2
a plain iPhone 17 lease at 0 h learned at 0 h learned at 0 h

warmPool.baselineLearnAfter:

Value Today After
unset key unknown 3
1 key unknown every baseline learned on its first lease, as today
5 key unknown learned on the 5th lease in 24 h
0, -1, 2.5, "3" key unknown the config fails to load, naming the key

What could go wrong

  • A busy baseline is never kept warm because its leases are counted apart (per version or per model): every lease pays a copy and a boot. Unlikely; one record per baseline name prevents it.
  • A one-off baseline still stays booted after its lease. Likely only with N set to 1.
  • After a new version from another model, the pool keeps booting copies of the old model, which no lease can take. That is today's bug; this feature fixes it.

Words used

  • kind: what the warm pool keeps ready, a device's platform, model, OS version, mode and image tag, plus a baseline name for a baseline kind, e.g. ios / iPhone 17 / 26.0 / full / baseline ios-test.
  • learned kind: a kind the pool keeps warm because it was leased, shown as learned in simlock status.
  • baseline kind: a kind made from a baseline; its model, OS, mode, image tag and version are the baseline's newest version's.
  • counting: a baseline kind leased but not yet N times in 24 hours; it is recorded, not warmed and not listed.
  • N: the value of warmPool.baselineLearnAfter.
  • forgotten: the pool drops a learned kind and stops warming it, e.g. after simlock warm forget ios "iPhone 17".

Non-goals

  • Naming a baseline in warmPool.targets (an operator target for a baseline).
  • Forgetting a baseline by name (warm forget --baseline).
  • Showing a counting baseline (leased 2 of 3) in status or the console.
  • Forgetting a learned kind after a fixed time; ADR 0038 rejected it.
  • Live Android snapshots to speed up seed making and baseline save (parked until fresh-home workers such as CI make the first lease matter).

Completion conditions

  • On a worker with N = 3, two leases of a baseline within an hour leave no device of it booted after release, and simlock status lists no learned line for it.
  • A third lease within 24 hours adds the learned line, and a copy stays booted after release.
  • With N = 1, the first lease of a baseline adds the learned line.
  • After a new version of a learned baseline is saved from another model, simlock status shows the kind with the new model, and the pool boots copies of that model.
  • warmPool.baselineLearnAfter: 0 fails the config load naming the key.

Open questions

none

Decisions

Shared values

none: a one-task feature.

Behaviours

Behaviour (invoker, action, what it sees) Seam Cases Task
An operator sets warmPool.baselineLearnAfter and the daemon loads it and answers it in config.get loadConfig, config.get unset → 3; 1; 5; 0, -1, 2.5, "3" → invalid config naming the key; config.get returns the value #1261
Agents lease a baseline, and the warm pool learns its kind only on the Nth lease within 24 hours WarmPool on lease.granted, read through figures() and the pass's proposals N = 3: 1st and 2nd leases → no learned kind, nothing booted after release; 3rd within 24 h → learned, kept booted; leases at 0 h, 1 h, 25 h, 26 h → not learned; at 0 h, 20 h, 23 h → learned at 23 h; at 0 h, 12 h, 24 h → not learned; learned at 2 h (leases at 0, 1, 2 h) → still learned and kept booted at 30 h, and a 4th lease at 30 h keeps it learned; N = 1 → 1st lease learns; leases of v1 and v2 count together; a plain kind learned on its 1st lease; a forgotten baseline kind counts from zero #1261
A learned baseline kind is warmed as the baseline's newest version WarmPool pass, figures() new version from another model → kind shows and creates the new model and version; another OS; another image tag; another platform; same model, new version → version only; after a save from another model, its third failed boot in a row forgets it #1261
An operator forgets a learned baseline kind with warm forget WarmPool.forgetKinds match by the newest version's model → forgotten; by the old version's model → not forgotten; narrowed by OS, mode, image tag; a baseline still counting → not answered, keeps counting #1261
A worker restarts, and the record keeps what it learned LearnedKinds over a reopened state.db a learned baseline kind stays learned; a counting one keeps its lease rows and counts on; a file at warm pool version 2 opens at version 3 with plain kinds and their leases kept and baseline kinds dropped #1261

Tasks

Completion conditions → task: all five by #1261's Done when.

Open work in the same area:

Written by an agent.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    feature:spec
    on Nov 4, 2026
  2. added
    feature:planned
    and removed
    feature:spec
    on Nov 4, 2026
  3. V3RON commented on Nov 4, 2026

    @V3RON
    ContributorAuthor

    Spec updated: every section written (business sections, Decisions with ADR 0062 on PR #1260, Behaviours, Tasks); one task, #1261, set ready after its spec check.

    Written by an agent.

  4. github-actions commented on Nov 5, 2026

    @github-actions
    Contributor

    Closing: all 1 sub-issues are closed. The PR that closed the last one walks the completion conditions (delivery rule 9); reopen this if one does not hold on main. Flip its ADRs to Accepted if delivery has not.

  5. V3RON commented on Nov 5, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1260 (ADR 0062), #1335 (#1261)
    Parked: none
    Waiting: none
    Decided: #1261 — the gate refused because ADR 0038 still read "not yet implemented" although its feature #771 is done → flipped 0038 to Accepted in the stack (see the Decision taken comment on #1335)

    Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions