Skip to content

Waiting line: with the warm pool off, every waiting request starts its own device #2037

Backlog

Description

@V3RON

Part of #2033.

Scope

With the warm pool off, requests waiting in a worker's line each start their own device in line order, as far as capacity allows, instead of one after another. With the pool on, nothing changes. Until #2038 lands the pool is still on by default, so a worker sees this only with warmPool.enabled: false.

If it goes wrong: a waiting request gets two devices, or one waits forever although a slot is free.

Technical spec

Commit 62c7299.

Rows

  • Behaviours: B1, B2, B3, B4, B5
  • Interfaces: I3
  • Existing code: X1, X2, X3, X4, X20, X10, X12, X13, X18

Facts

# Fact Source
F1 Every decisions.run call is served in the order it was called, so driving each queued waiter in turn plans them in line order src/core/serialized-decision.ts:9
F2 The lease model already runs its worker with the pool off, so after this task it exercises every waiting request planning src/leasing/test-lease-model.ts:398
F3 hangMakeReady holds every boot until releaseMakeReady, so two creations can be seen in flight together src/core/fake-driver.ts:772

Modules touched

src/leasing/ (acquisition-workflow.ts, acquisition-ports.ts (the options type gains the pool switch), create-leasing.ts, their tests, test-lease-model.ts, AGENTS.md), src/leasing/testing.ts if its config type follows LeasingConfig, docs/internal/flows/device-selection.md. Searches: rg -n "queue.head|behind-earlier-request|LeasingConfig" src.

Rules in play

  • src/leasing/AGENTS.md (the queue rules): "Only the head of the virtual line plans" becomes the pool-off rule and the pool-on exception; createLeasing takes LeasingConfig, now with warmPool.enabled (I3), still never the whole config.
  • ADR 0101 §3: with the pool off every waiting request plans in line order; with it on, today's rule; --no-wait unchanged.
  • ADR 0038 §6: the pool's queue step is not touched.

Retired words

  • Only the head of the virtual line plans: true only with the pool on; with it off every queued virtual request plans in line order

Tests

Seam: createHarness (src/leasing/test-create-leasing.ts:122) with warmPoolEnabled and limits; model on src/leasing/create-leasing-waiting-reasons.test.ts:36.

  • B1: Agents whose requests wait on a worker with the pool off: each waiting request plans its own device in line order, against the capacity the earlier ones left, and starts it at once when it fits; a new request plans at once and joins the back only when refused: two waiting, two slots free at once: two creations in flight together; two waiting, one slot free: only the older starts, the other stays queued with its capacity reason; iOS first refused for its running limit, Android second fits: Android is granted, iOS keeps waiting; a shut-down device that serves the second: it is booted for the second while the first creates; a waiting request cancelled while the one ahead creates: the one behind it plans; a new request while one waits and a slot is free: it plans at once; a new request while one waits and no slot is free: it joins the back with its capacity reason
  • B2: An agent sends a --no-wait request while a virtual request waits: refused NO_CAPACITY, reason behind-earlier-request, as today: one waiting and queued; one waiting and starting its device; the line empty: plans as today
  • B3: An operator lists the line (simlock list, waitingRequests()) on a worker with the pool off: each queued virtual request shows its own reason, never "Behind an earlier request": two at the iOS running limit: both platform-running-limit; a physical request behind an older physical one: behind-earlier-request, as today
  • B4: A worker with warmPool.enabled: true and requests waiting: leasing keeps today's rule, so only the first in line plans and each waiting request gets one device: two waiting, two slots free: the second is listed behind-earlier-request, the pool creates its device and it is granted that one, one creation per request; the existing tests of the pool's queue step pass unchanged
  • B5: The lease model keeps its invariants with every waiting request planning: the default seeds; the allowances unchanged

Done when

  • pnpm test:changed passes, src/leasing/lease-model.test.ts included.
  • pnpm typecheck passes.
  • src/leasing/AGENTS.md and docs/internal/flows/device-selection.md state the line rule for the pool off and on.

Out of scope

Depends on

none

Written by an agent.

Activity

  1. added
    task:draft
    on Dec 2, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Dec 2, 2026
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

    task:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions