Repository navigation
Description
Part of #1833.
Scope
After a simulator or emulator lease is granted, the warm pool waits warmPool.refillDelayMs (default 60 s, counted from the latest grant) before it boots or creates any warm device, while a waiting request's boot or creation still runs at once. An operator can set the wait, or 0 for today's behaviour, and simlock config get shows it. The whole feature is this task.
If it goes wrong: a lease that waits for a device is held up by the wait, or the warm pool never refills after a grant.
Technical spec
Commit 200afe5.
Rows
- Behaviours: B1, B2, B3, B4
- Stored state: none
- Interfaces: I1, I2, I3
- Existing code: X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13
Facts
| # | Fact | Source |
|---|---|---|
| F1 | The warm-pool tests build a WarmPool on a FakeClock and an EventBus in one rig, which B1 to B3 extend |
src/core/warm-pool/test-fixtures.ts:172-173, :304 |
| F2 | config-reference.test.ts reads every key the validators accept and checks configuration.mdx lists it, so the new key without its reference row fails a test |
src/core/config-reference.test.ts:20-60 (acceptedKeys, configuration.mdx) |
| F3 | The warm-pool config load tests, which B4's cases join | src/core/config-warm-pool.test.ts:24, :38 |
| F4 | The config.get round-trip test reads a warmPool answer through the contract |
src/contract/operations-round-trips-catalog-config.test.ts (rg -n warmPool hits) |
Modules touched
Searches: rg "maxConcurrentBoots" src e2e website docs/internal, rg "lease.granted" src/core/warm-pool, rg "PROTOCOL_VERSION_RANGE" src/contract.
src/core/warm-pool/(config.ts,policy.ts,converger.ts,test-fixtures.ts,test-policy.ts,AGENTS.md)src/contract/(config-schemas.ts,protocol.ts)- the hand-built test configs X10 lists in
src/leasing/andsrc/core/ e2e/helpers/env.tswebsite/src/content/docs/docs/reference/configuration.mdx,docs/worker/warm-pool.mdx,docs/concepts/warm-pool.mdx
Rules in play
src/contract/AGENTS.md(protocol version): theconfig.getanswer gains a field, soPROTOCOL_VERSION_RANGEgoes up by one,minwith it, in this PR.src/core/warm-pool/AGENTS.md:policy.tsstays pure, as the hold is read from the view (I3); the plan rules gain one line on the refill hold (X12).src/core/AGENTS.md(wiring): the pool reads only itswarmPoolslice.- documentation rule 9: a new config key updates the website pages X11 names in the same PR.
- testing rules: the wait is proven at the
WarmPoolseam with the fake clock, never by a real wait or a device.
Tests
The seam is WarmPool with the fake clock and bus from src/core/warm-pool/test-fixtures.ts, modelled on src/core/warm-pool/converger-memory-pressure.test.ts; B4 is modelled on src/core/config-warm-pool.test.ts.
- B1: a grant holds every refill until
refillDelayMsafter the latest grant: a configured target with a shut-down device to boot; one needing a creation; a learned kind's spare; nothing at 59 999 ms and the refill on the timer's pass at 60 000 ms; a second grant at 30 000 ms moves it to 90 000 ms; an iOS grant holds an Android target; a physical grant starts no wait; nodisplacedshutdown during the wait; noshortand nowarm-pool.target-missedwhile held; atwarming-pausedthe held target reportsmemory-pressure - B2: during the wait a waiting request is served and shutdowns run: a
waiting-requestboot; awaiting-requestcreation; an over-budget shutdown; anever-leased-idleshutdown - B3: nothing is held with
refillDelayMs: 0and a grant, or with the default and no grant since start (daemon.started);dispose()cancels a pending wait timer - B4:
warmPool.refillDelayMsloads or is refused: absent gives60000;0;1500.5;-1and"60s"refused withInvalid config value for "warmPool.refillDelayMs": expected a non-negative number;config.getanswers the value
Done when
pnpm test:changedpasses, with the B1 to B4 cases above.pnpm typecheckpasses.- The push hook's e2e typecheck (and CI's) passes, and
pnpm test:e2e e2e/warm-pool-learned.test.ts e2e/warm-pool-reserve.test.ts e2e/doctor-drift.test.ts e2e/lease-lifecycle.test.tspasses withe2e/helpers/env.tssettingrefillDelayMs: 0(X13) and none of those tests changed. configuration.mdx,worker/warm-pool.mdxandconcepts/warm-pool.mdxdescribe the key, its default and that a waiting request is never held.
Out of scope
- A host CPU gate, a short reason or an event for the wait (feature Non-goals).
Depends on
Written by an agent.
Activity
test: during the wait a waiting request is served and shutdowns run; …
test: warmPool.refillDelayMs loads or is refused (#1838)
feat(config): load warmPool.refillDelayMs, 60000 by default (#1838)
test: config.get keeps warmPool.refillDelayMs through its output sche…
feat(contract): config.get answers warmPool.refillDelayMs (#1838)
docs(warm-pool): document warmPool.refillDelayMs, keep e2e and fixtur…
refactor(warm-pool): keep the refill delay default private (#1838)
test: the refill wait ends on its own timer between ticks and a 0 wai…
fix(warm-pool): a refill wait timer that fires early re-arms for what…
V3RON commentedon Nov 25, 2026
Handoff
Done: PR #1848 (draft,
task/1838, head 2141cea). B1 to B4 are built and audited. Tests, typecheck and the four e2e files passed. Review round 1 found R1: the wait-end timer could fire early, so the refill slipped to the next 30 s tick. R1 is fixed in 2141cea. The spec and claims lenses found nothing.Not done: the Done when checklist in the body, and the gate. CI on 2141cea was pending.
Findings: R1's fix never had a code lens. Auto mode refused the
code-reviewerspawns because a hook rewrites the prompt. The coordinator checked it alone, with one red mutation probe.Blocked on: the review cap is reached with a behaviour fix unchecked (rule 14). Run a code lens on
aa0c1740..2141ceacoutside auto mode, or accept the coordinator's check, then re-run deliver.Written by an agent.
fix(test): console worker daemons refill at once after a grant (#1838)
feat(warm-pool): wait refillDelayMs after a lease grant before refill…