Skip to content

Warm pool: wait warmPool.refillDelayMs after a lease grant before refilling #1838

Done

Description

@V3RON

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/ and src/core/
  • e2e/helpers/env.ts
  • website/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): the config.get answer gains a field, so PROTOCOL_VERSION_RANGE goes up by one, min with it, in this PR.
  • src/core/warm-pool/AGENTS.md: policy.ts stays 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 its warmPool slice.
  • 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 WarmPool seam 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 refillDelayMs after 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; no displaced shutdown during the wait; no short and no warm-pool.target-missed while held; at warming-paused the held target reports memory-pressure
  • B2: during the wait a waiting request is served and shutdowns run: a waiting-request boot; a waiting-request creation; an over-budget shutdown; a never-leased-idle shutdown
  • B3: nothing is held with refillDelayMs: 0 and a grant, or with the default and no grant since start (daemon.started); dispose() cancels a pending wait timer
  • B4: warmPool.refillDelayMs loads or is refused: absent gives 60000; 0; 1500.5; -1 and "60s" refused with Invalid config value for "warmPool.refillDelayMs": expected a non-negative number; config.get answers the value

Done when

  • pnpm test:changed passes, with the B1 to B4 cases above.
  • pnpm typecheck passes.
  • 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.ts passes with e2e/helpers/env.ts setting refillDelayMs: 0 (X13) and none of those tests changed.
  • configuration.mdx, worker/warm-pool.mdx and concepts/warm-pool.mdx describe 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

  1. added
    task:draft
    on Nov 25, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Nov 25, 2026
  3. self-assigned this
    on Nov 25, 2026
  4. V3RON commented on Nov 25, 2026

    @V3RON
    ContributorAuthor

    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-reviewer spawns 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..2141ceac outside auto mode, or accept the coordinator's check, then re-run deliver.

    Written by an agent.

  5. added
    task:blocked
    and removed
    task:ready
    on Nov 25, 2026
  6. removed their assignment
    on Nov 25, 2026
  7. added
    task:ready
    and removed
    task:blocked
    on Nov 25, 2026
  8. self-assigned this
    on Nov 25, 2026
  9. added a commit that references this issue on Nov 25, 2026
    8e668de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions