From aeb6dfbc34a037bcfc6f630369d21a568ac8e878 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:16:01 +0200 Subject: [PATCH 01/16] test: figures lists learned kinds with origin, tag and short (#777) --- src/core/doctor.test.ts | 2 + src/core/warm-pool/converger.test.ts | 68 ++++++++++++++++++---------- src/core/warm-pool/converger.ts | 1 + src/core/warm-pool/figures.ts | 2 + 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/src/core/doctor.test.ts b/src/core/doctor.test.ts index 48affb235..58bc664ff 100644 --- a/src/core/doctor.test.ts +++ b/src/core/doctor.test.ts @@ -2519,6 +2519,7 @@ describe("Doctor: optional module findings", () => { count: 1, mode: "full" as const, model: "iPhone 17", + origin: "configured" as const, osVersion: "27.0", platform: "ios" as const, ready: 0, @@ -3108,6 +3109,7 @@ describe("Doctor: warm pool targets", () => { booting: 0, count: 1, mode: "full" as const, + origin: "configured" as const, platform: "ios" as const, ready: 0, ...target, diff --git a/src/core/warm-pool/converger.test.ts b/src/core/warm-pool/converger.test.ts index fc576876d..df2039a78 100644 --- a/src/core/warm-pool/converger.test.ts +++ b/src/core/warm-pool/converger.test.ts @@ -1857,6 +1857,7 @@ describe("warm pool targets", () => { const wanted = { mode: "full", model: "iPhone 17", + origin: "configured", osVersion: "26.0", platform: "ios", } as const; @@ -2010,6 +2011,7 @@ describe("warm pool targets", () => { count: 1, mode: "full", model: "iPhone 17", + origin: "configured", platform: "ios", ready: 0, short: "no-driver", @@ -2580,40 +2582,56 @@ describe("warm pool learned kinds", () => { ).toEqual([{ deviceId: "d1", reason: "displaced" }]); }); - it("lists configured targets only in figures() and the short log, with a learned kind short in the same pass", async () => { - const short = harness([], { limit: 0, state: await withLearned([1]), targets: [phone] }); - await short.pool.pass(); - await short.pool.settle(); - const met = harness([device("d1", "ready", 0)], { - limit: 1, - state: await withLearned([1, 2]), - targets: [phone], - }); - await met.pool.pass(); - await met.pool.settle(); + it("lists a learned kind in figures() with its origin, count, image tag and short, a merged kind once with the larger count, and drops a forgotten kind on the next pass", async () => { + const pixel = { ...device("d2", "ready", 0, "android").spec, imageTag: "google_apis" }; + const state = await openMemoryState([warmPoolOwner]); + const learned = new LearnedKinds(state); + learned.learn(ipad, "pad", now - minute); + learned.learn(pixel, "pixel", now - 3 * minute); + learned.learn(device("d1", "ready", 0).spec, "phone-0", now - 2 * minute); + learned.learn(device("d1", "ready", 0).spec, "phone-1", now - 2 * minute); + const rig = harness([], { limit: 0, state, targets: [phone] }); + const summary = () => + rig.pool.figures().targets.map((target) => ({ + count: target.count, + imageTag: target.imageTag, + model: target.model, + origin: target.origin, + short: target.short, + })); + + await rig.pool.pass(); + await rig.pool.settle(); - expect(short.pool.figures().targets).toEqual([ + expect(summary()).toEqual([ + { count: 2, model: "iPhone 15", origin: "configured", short: "running-limit" }, + { count: 1, model: "iPad Pro", origin: "learned", short: "running-limit" }, { - booting: 0, count: 1, - mode: "full", - model: "iPhone 15", - osVersion: "26.0", - platform: "ios", - ready: 0, + imageTag: "google_apis", + model: "Pixel 8", + origin: "learned", short: "running-limit", }, ]); - const shortLogs = short.sink.records.filter( + const shortLogs = rig.sink.records.filter( (record) => record.message === "a warm pool target is short", ); expect(shortLogs.map((record) => record.fields?.target)).toEqual(["ios iPhone 15 26.0"]); - expect( - met.pool.figures().targets.map((target) => [target.model, target.ready, target.short]), - ).toEqual([["iPhone 15", 1, undefined]]); - expect( - met.sink.records.filter((record) => record.message === "a warm pool target is short"), - ).toEqual([]); + + learned.forget(ipad); + await rig.pool.pass(); + await rig.pool.settle(); + + expect(summary().map((entry) => entry.model)).toEqual(["iPhone 15", "Pixel 8"]); + const off = harness([], { enabled: false, state, targets: [phone] }); + expect(off.pool.figures().targets.map((target) => [target.model, target.origin])).toEqual([ + ["iPhone 15", "configured"], + ]); + const fresh = harness([], { state, targets: [phone] }); + expect(fresh.pool.figures().targets.map((target) => [target.model, target.origin])).toEqual([ + ["iPhone 15", "configured"], + ]); }); it("emits warm-pool.target-missed for a merged entry by its configured count", async () => { diff --git a/src/core/warm-pool/converger.ts b/src/core/warm-pool/converger.ts index 3aa93f018..80f35b2a9 100644 --- a/src/core/warm-pool/converger.ts +++ b/src/core/warm-pool/converger.ts @@ -853,6 +853,7 @@ function figureOf(report: TargetReport): WarmTargetFigures { ...report.kind, booting: report.booting, count: report.count, + origin: "configured", ready: report.ready, ...(report.short === undefined ? {} : { short: report.short }), }; diff --git a/src/core/warm-pool/figures.ts b/src/core/warm-pool/figures.ts index 54bdeddea..c3cd09fab 100644 --- a/src/core/warm-pool/figures.ts +++ b/src/core/warm-pool/figures.ts @@ -2,6 +2,8 @@ import type { TargetKind, TargetShort } from "./policy.js"; /** One warm target as `status` reports it: its kind, how many it wants, and how it stands. */ export interface WarmTargetFigures extends TargetKind { + readonly origin: "configured" | "learned"; + readonly imageTag?: string; readonly count: number; readonly ready: number; readonly booting: number; From 0324beeacef7867515d03b043e5f553e98f55748 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:17:32 +0200 Subject: [PATCH 02/16] feat(warm-pool): figures lists learned kinds with origin and image tag (#777) --- src/core/warm-pool/converger.test.ts | 15 ++++++++++++++- src/core/warm-pool/converger.ts | 11 ++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/core/warm-pool/converger.test.ts b/src/core/warm-pool/converger.test.ts index df2039a78..5d5d54f02 100644 --- a/src/core/warm-pool/converger.test.ts +++ b/src/core/warm-pool/converger.test.ts @@ -2590,7 +2590,20 @@ describe("warm pool learned kinds", () => { learned.learn(pixel, "pixel", now - 3 * minute); learned.learn(device("d1", "ready", 0).spec, "phone-0", now - 2 * minute); learned.learn(device("d1", "ready", 0).spec, "phone-1", now - 2 * minute); - const rig = harness([], { limit: 0, state, targets: [phone] }); + const androidListing: PlatformCatalog = { + ...iosListing, + images: [{ abi: "arm64", runtime: "35", tag: "google_apis" }], + modelRuntimes: { "Pixel 8": ["35"] }, + models: ["Pixel 8"], + platform: "android", + runtimes: ["35"], + }; + const rig = harness([], { + catalog: async () => [iosListing, androidListing], + limit: 0, + state, + targets: [phone], + }); const summary = () => rig.pool.figures().targets.map((target) => ({ count: target.count, diff --git a/src/core/warm-pool/converger.ts b/src/core/warm-pool/converger.ts index 80f35b2a9..e1f38a936 100644 --- a/src/core/warm-pool/converger.ts +++ b/src/core/warm-pool/converger.ts @@ -134,6 +134,8 @@ export class WarmPool { readonly #lastSpecs = new Map(); /** Every target's state as the last pass left it. */ #reports: readonly TargetReport[] = []; + /** why: every report of the last pass, learned kinds included, which `figures()` lists and the log and the event leave out. */ + #figured: readonly TargetReport[] = []; /** Whether a pass has left its reports yet: until one has, the figures come from the config. */ #passed = false; /** @@ -314,7 +316,7 @@ export class WarmPool { const { enabled, reserveRunning, targets } = this.options.config; const reports = enabled && this.#passed - ? this.#reports + ? this.#figured : targets.map((target): TargetReport => { const kind = this.#kindOfTarget(target); return { @@ -394,7 +396,9 @@ export class WarmPool { try { const refused = await this.#resolveEnabled(); const plan = await this.options.decisions.run(() => evaluate(this.#view())); - const reports = configuredOnly([...refused, ...plan.targets]); + const everyReport = [...refused, ...plan.targets]; + const reports = configuredOnly(everyReport); + this.#figured = everyReport; this.#note(reports); for (const proposal of plan.proposals) { if (this.#draining) break; @@ -853,8 +857,9 @@ function figureOf(report: TargetReport): WarmTargetFigures { ...report.kind, booting: report.booting, count: report.count, - origin: "configured", + origin: report.origin, ready: report.ready, + ...(report.spec?.imageTag === undefined ? {} : { imageTag: report.spec.imageTag }), ...(report.short === undefined ? {} : { short: report.short }), }; } From af9b42a90787d9b2c0173cabaa75ccf78f82042d Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:18:00 +0200 Subject: [PATCH 03/16] test: statusWarmPoolSchema accepts origin, image tag and 320 entries, and refuses the rest (#777) --- src/contract/schemas.test.ts | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/contract/schemas.test.ts b/src/contract/schemas.test.ts index 197bb820f..0451dc10a 100644 --- a/src/contract/schemas.test.ts +++ b/src/contract/schemas.test.ts @@ -14,6 +14,7 @@ import { leaseGrantSchema, leaseRequestRecordSchema, platformCatalogSchema, + statusWarmPoolSchema, statusDeviceSchema, waitingRequestSchema, workerViewSchema, @@ -1032,3 +1033,45 @@ describe("waitingRequestSchema's workers", () => { ).toBe(false); }); }); + +describe("statusWarmPoolSchema", () => { + const entry = { + booting: 0, + count: 1, + mode: "full", + model: "Pixel 8", + origin: "learned", + osVersion: "35", + platform: "android", + ready: 1, + }; + const block = (targets: readonly unknown[]) => ({ + enabled: true, + reserveRunning: { android: 0, ios: 0 }, + targets, + }); + const { origin: _origin, ...withoutOrigin } = entry; + + it("accepts origin configured and learned, an optional imageTag, and 320 entries, and refuses an entry without origin or with another word, a tag imageTagSchema refuses, and 321 entries", () => { + const cases: readonly { name: string; targets: readonly unknown[]; accepted: boolean }[] = [ + { accepted: true, name: "learned", targets: [entry] }, + { accepted: true, name: "configured", targets: [{ ...entry, origin: "configured" }] }, + { accepted: true, name: "a tag", targets: [{ ...entry, imageTag: "google_apis_playstore" }] }, + { accepted: true, name: "320 entries", targets: Array.from({ length: 320 }, () => entry) }, + { accepted: false, name: "no origin", targets: [withoutOrigin] }, + { accepted: false, name: "another word", targets: [{ ...entry, origin: "remembered" }] }, + { accepted: false, name: "a bad tag", targets: [{ ...entry, imageTag: "no spaces" }] }, + { accepted: false, name: "321 entries", targets: Array.from({ length: 321 }, () => entry) }, + ]; + + expect( + cases.map(({ name, targets }) => [ + name, + statusWarmPoolSchema.safeParse(block(targets)).success, + ]), + ).toEqual(cases.map(({ accepted, name }) => [name, accepted])); + expect( + statusWarmPoolSchema.parse(block([{ ...entry, imageTag: "google_apis" }])).targets[0], + ).toMatchObject({ imageTag: "google_apis", origin: "learned" }); + }); +}); From 3e79ed76cd995207f391dd7d7330f389fbf68ebf Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:20:18 +0200 Subject: [PATCH 04/16] feat(contract): status.get warm pool entries carry origin and image tag, up to 320 (#777) --- src/cli/index.test.ts | 3 +++ src/contract/AGENTS.md | 2 +- src/contract/operations.test.ts | 7 +++++-- src/contract/protocol.test.ts | 4 ++-- src/contract/protocol.ts | 2 +- src/contract/schemas.ts | 6 +++++- src/daemon-protocol/index.test.ts | 2 +- src/daemon/AGENTS.md | 2 +- src/daemon/dispatcher.test.ts | 3 +++ src/daemon/server.test.ts | 4 ++-- src/gateway/dispatcher.test.ts | 1 + src/gateway/service.test.ts | 2 +- ui/src/model/worker-page.test.ts | 1 + ui/src/model/workers.test.ts | 1 + ui/src/screens/fleet/fleet.test.tsx | 2 ++ 15 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/cli/index.test.ts b/src/cli/index.test.ts index 7aa25f37f..69b087c54 100644 --- a/src/cli/index.test.ts +++ b/src/cli/index.test.ts @@ -4201,6 +4201,7 @@ describe("CLI: status renders the fleet a gateway reports (ADR 0005 §20)", () = count: 2, mode: "full" as const, model: "iPhone 17", + origin: "configured" as const, osVersion: "26.0", platform: "ios" as const, ready: 1, @@ -4210,6 +4211,7 @@ describe("CLI: status renders the fleet a gateway reports (ADR 0005 §20)", () = count: 1, mode: "full" as const, model: "iPhone 17", + origin: "configured" as const, osVersion: "27.0", platform: "ios" as const, ready: 0, @@ -4246,6 +4248,7 @@ describe("CLI: status renders the fleet a gateway reports (ADR 0005 §20)", () = count: 1, mode: "slim" as const, model: "iPhone 17", + origin: "configured" as const, platform: "ios" as const, ready: 0, }, diff --git a/src/contract/AGENTS.md b/src/contract/AGENTS.md index 715684d66..4b4715889 100644 --- a/src/contract/AGENTS.md +++ b/src/contract/AGENTS.md @@ -55,7 +55,7 @@ Three identities: ## Protocol version -- `PROTOCOL_VERSION_RANGE` in `protocol.ts` holds it, now `{ min: 52, max: 52 }`. `DAEMON_PROTOCOL_VERSION` (`src/daemon-protocol/`) is its `max`. +- `PROTOCOL_VERSION_RANGE` in `protocol.ts` holds it, now `{ min: 53, max: 53 }`. `DAEMON_PROTOCOL_VERSION` (`src/daemon-protocol/`) is its `max`. - Every change to a contract shape bumps it by one in the same PR. Move `min` too, unless a compatibility path stays side by side. `.agents/scripts/protocol-bump-check.mjs` checks it on push and in CI; it counts every file here as a shape but tests, `index.ts` and the diff --git a/src/contract/operations.test.ts b/src/contract/operations.test.ts index ed0e761cd..eee2f4410 100644 --- a/src/contract/operations.test.ts +++ b/src/contract/operations.test.ts @@ -538,6 +538,7 @@ describe("operation input/output round trips", () => { count: 2, mode: "full", model: "iPhone 17", + origin: "configured", osVersion: "26.0", platform: "ios", ready: 1, @@ -547,6 +548,7 @@ describe("operation input/output round trips", () => { count: 1, mode: "full", model: "iPhone 17", + origin: "learned", osVersion: "27.0", platform: "ios", ready: 0, @@ -595,7 +597,7 @@ describe("operation input/output round trips", () => { ).toEqual({ daemon: { health: "starting", mode: "worker" }, host }); }); - it("rejects a short outside the ten reasons, and a target list longer than 256", () => { + it("rejects a short outside the ten reasons, and a target list longer than 320", () => { const target = warmPool.targets[0]; expect(() => OPERATIONS["status.get"].output.parse({ @@ -606,7 +608,7 @@ describe("operation input/output round trips", () => { expect(() => OPERATIONS["status.get"].output.parse({ ...running, - warmPool: { ...warmPool, targets: Array.from({ length: 257 }, () => target) }, + warmPool: { ...warmPool, targets: Array.from({ length: 321 }, () => target) }, }), ).toThrow(); }); @@ -629,6 +631,7 @@ describe("operation input/output round trips", () => { count: 1, mode: "full", model: "iPhone 17", + origin: "configured", platform: "ios", ready: 0, short, diff --git a/src/contract/protocol.test.ts b/src/contract/protocol.test.ts index 5f06d3ed2..a698599c9 100644 --- a/src/contract/protocol.test.ts +++ b/src/contract/protocol.test.ts @@ -47,7 +47,7 @@ describe("helloRequestSchema", () => { }); describe("PROTOCOL_VERSION_RANGE", () => { - it("is one above the base branch's, for the alerts.test operation", () => { - expect(PROTOCOL_VERSION_RANGE).toEqual({ max: 52, min: 52 }); + it("is one above the base branch's, for the warm pool entries' origin", () => { + expect(PROTOCOL_VERSION_RANGE).toEqual({ max: 53, min: 53 }); }); }); diff --git a/src/contract/protocol.ts b/src/contract/protocol.ts index d537902ce..34403ac17 100644 --- a/src/contract/protocol.ts +++ b/src/contract/protocol.ts @@ -10,7 +10,7 @@ export interface ProtocolRange { const protocolRangeSchema = z.object({ min: z.number().int(), max: z.number().int() }); /** Widen only once a second version is kept alive side by side with the first; a bump that leaves no shim behind moves both ends. */ -export const PROTOCOL_VERSION_RANGE: ProtocolRange = { min: 52, max: 52 }; +export const PROTOCOL_VERSION_RANGE: ProtocolRange = { min: 53, max: 53 }; const LEGACY_DAEMON_PROTOCOL_VERSION = 2; diff --git a/src/contract/schemas.ts b/src/contract/schemas.ts index 148a03e1b..c9682bdde 100644 --- a/src/contract/schemas.ts +++ b/src/contract/schemas.ts @@ -520,6 +520,8 @@ export const statusCapacitySchema = z.object({ /** The most targets the block carries, and the longest model or OS version it names. The config load enforces the same. */ export const WARM_POOL_TARGETS_MAX = 256; export const WARM_POOL_NAME_MAX = 256; +/** why: the configured targets plus the learned kinds, 32 per platform, the pool keeps. */ +export const WARM_POOL_ENTRIES_MAX = WARM_POOL_TARGETS_MAX + 64; /** Why a warm target is short, in the order the first that applies is the one reported. */ const warmPoolShortSchema = z.enum([ @@ -540,6 +542,8 @@ const warmPoolTargetSchema = z.object({ model: z.string().max(WARM_POOL_NAME_MAX), osVersion: z.string().max(WARM_POOL_NAME_MAX).optional(), mode: z.enum(["slim", "full"]), + imageTag: imageTagSchema.optional(), + origin: z.enum(["configured", "learned"]), count: z.number().int().nonnegative(), ready: z.number().int().nonnegative(), booting: z.number().int().nonnegative(), @@ -553,7 +557,7 @@ export const statusWarmPoolSchema = z.object({ ios: z.number().int().nonnegative(), android: z.number().int().nonnegative(), }), - targets: z.array(warmPoolTargetSchema).max(WARM_POOL_TARGETS_MAX), + targets: z.array(warmPoolTargetSchema).max(WARM_POOL_ENTRIES_MAX), }); export const daemonHealthSchema = z.enum(["starting", "running", "failed"]); diff --git a/src/daemon-protocol/index.test.ts b/src/daemon-protocol/index.test.ts index 6ceef37ca..104b5766e 100644 --- a/src/daemon-protocol/index.test.ts +++ b/src/daemon-protocol/index.test.ts @@ -9,7 +9,7 @@ import { describe("daemon protocol", () => { it("keeps the current protocol version and newline framing", () => { - expect(DAEMON_PROTOCOL_VERSION).toBe(52); + expect(DAEMON_PROTOCOL_VERSION).toBe(53); expect(serializeFrame({ id: 1, type: "hello" })).toBe('{"id":1,"type":"hello"}\n'); }); diff --git a/src/daemon/AGENTS.md b/src/daemon/AGENTS.md index f386f1cc2..1a8ff5610 100644 --- a/src/daemon/AGENTS.md +++ b/src/daemon/AGENTS.md @@ -52,7 +52,7 @@ An HTTP bind failure after a good start stops the daemon (`http-start-failed`). Principal: `hello.principal`, else `SIMLOCK_AGENT_ID`, else the daemon's pid. Both are fixed for the connection's life. 3. **Version** — ranges overlap → highest common version. `PROTOCOL_VERSION_RANGE` - is `{ min: 52, max: 52 }` (`src/contract/protocol.ts`). No overlap → the + is `{ min: 53, max: 53 }` (`src/contract/protocol.ts`). No overlap → the connection stays open, and every request but `daemon.stop` gets `PROTOCOL_VERSION_UNSUPPORTED`. 4. **Request** — one frame → one `dispatch()` call. While stopping: `DAEMON_STOPPING`. diff --git a/src/daemon/dispatcher.test.ts b/src/daemon/dispatcher.test.ts index c7e458017..a7d8dc5d2 100644 --- a/src/daemon/dispatcher.test.ts +++ b/src/daemon/dispatcher.test.ts @@ -1738,6 +1738,7 @@ describe("Dispatcher: device mode on every surface", () => { count: 1, mode: "full", model: "iPhone 17", + origin: "configured", osVersion: "27.0", platform: "ios", ready: 0, @@ -1770,6 +1771,7 @@ describe("Dispatcher: device mode on every surface", () => { count: 2, mode: "full", model: "iPhone 17", + origin: "configured", osVersion: "26.5", platform: "ios", ready: 0, @@ -1780,6 +1782,7 @@ describe("Dispatcher: device mode on every surface", () => { count: 1, mode: "slim", model: "Pixel 8", + origin: "configured", platform: "android", ready: 0, short: "disabled", diff --git a/src/daemon/server.test.ts b/src/daemon/server.test.ts index 0d7f3f493..ac8b61e22 100644 --- a/src/daemon/server.test.ts +++ b/src/daemon/server.test.ts @@ -230,7 +230,7 @@ describe("DaemonServer", () => { [48, "cannot read config.get's gateway.alerts"], [51, "cannot page events.replay with beforeId or limit"], ])( - "answers PROTOCOL_VERSION_UNSUPPORTED, naming protocol 52, to a client on protocol %i, which %s", + "answers PROTOCOL_VERSION_UNSUPPORTED, naming protocol 53, to a client on protocol %i, which %s", async (version) => { const harness = await createHarness(); const previous = await createClient(harness.socketPath); @@ -240,7 +240,7 @@ describe("DaemonServer", () => { ).resolves.toMatchObject({ error: { code: "PROTOCOL_VERSION_UNSUPPORTED", - details: { client: { min: version, max: version }, daemon: { min: 52, max: 52 } }, + details: { client: { min: version, max: version }, daemon: { min: 53, max: 53 } }, }, ok: false, }); diff --git a/src/gateway/dispatcher.test.ts b/src/gateway/dispatcher.test.ts index 1c3ba6433..6c886a172 100644 --- a/src/gateway/dispatcher.test.ts +++ b/src/gateway/dispatcher.test.ts @@ -376,6 +376,7 @@ describe("GatewayDispatcher", () => { count: 1, mode: "full" as const, model: "iPhone 17", + origin: "configured" as const, osVersion: "27.0", platform: "ios" as const, ready: 0, diff --git a/src/gateway/service.test.ts b/src/gateway/service.test.ts index 22ddb4105..ba3a7aa43 100644 --- a/src/gateway/service.test.ts +++ b/src/gateway/service.test.ts @@ -1265,7 +1265,7 @@ describe("GatewayService", () => { min: PROTOCOL_VERSION_RANGE.max - 1, max: PROTOCOL_VERSION_RANGE.max - 1, }; - expect(PROTOCOL_VERSION_RANGE.max).toBe(52); + expect(PROTOCOL_VERSION_RANGE.max).toBe(53); expect(negotiateProtocolVersion(PROTOCOL_VERSION_RANGE, previous)).toBeUndefined(); const harness = fleet(); await harness.service.start(); diff --git a/ui/src/model/worker-page.test.ts b/ui/src/model/worker-page.test.ts index e8cce67af..19851ce56 100644 --- a/ui/src/model/worker-page.test.ts +++ b/ui/src/model/worker-page.test.ts @@ -576,6 +576,7 @@ describe("a worker's warm pool tab", () => { count: 1, mode: "full" as const, model: "iPhone 17", + origin: "configured" as const, osVersion: "27.0", platform: "ios" as const, ready: 0, diff --git a/ui/src/model/workers.test.ts b/ui/src/model/workers.test.ts index 836a26890..79bc1eb37 100644 --- a/ui/src/model/workers.test.ts +++ b/ui/src/model/workers.test.ts @@ -7,6 +7,7 @@ const REFUSED: WarmTarget = { count: 1, mode: "full", model: "iPhone 17", + origin: "configured", osVersion: "27.0", platform: "ios", ready: 0, diff --git a/ui/src/screens/fleet/fleet.test.tsx b/ui/src/screens/fleet/fleet.test.tsx index 65a8cfc85..23dba9a29 100644 --- a/ui/src/screens/fleet/fleet.test.tsx +++ b/ui/src/screens/fleet/fleet.test.tsx @@ -309,6 +309,7 @@ describe("a worker's host and warm pool tabs", () => { count: 2, mode: "full", model: "iPhone 17", + origin: "configured", osVersion: "26.0", platform: "ios", ready: 1, @@ -318,6 +319,7 @@ describe("a worker's host and warm pool tabs", () => { count: 1, mode: "full", model: "iPhone 17", + origin: "configured", platform: "ios", ready: 0, short: "runtime-missing", From 91103779427149bbf44d7b28afbcab73ea82d65e Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:21:28 +0200 Subject: [PATCH 05/16] test: simlock status prints the origin word, the tag and a learned line's short (#777) --- src/cli/index.test.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/cli/index.test.ts b/src/cli/index.test.ts index 69b087c54..10c7e769b 100644 --- a/src/cli/index.test.ts +++ b/src/cli/index.test.ts @@ -4211,18 +4211,29 @@ describe("CLI: status renders the fleet a gateway reports (ADR 0005 §20)", () = count: 1, mode: "full" as const, model: "iPhone 17", - origin: "configured" as const, + origin: "learned" as const, osVersion: "27.0", platform: "ios" as const, ready: 0, short: "runtime-missing" as const, }, + { + booting: 0, + count: 1, + imageTag: "google_apis_playstore", + mode: "full" as const, + model: "Pixel 8", + origin: "learned" as const, + osVersion: "35", + platform: "android" as const, + ready: 1, + }, ], }; const statusWith = (block: StatusGetOutput["warmPool"]) => fakeClient({ getStatus: () => Promise.resolve({ ...EMPTY_STATUS, warmPool: block }) }); - it("simlock status prints whether the pool is on, the reserve, and each target with how many are wanted, ready and booting, and why it is short", async () => { + it("simlock status prints the origin word on every warm pool line, learned lines included, the tag in the name, and a learned line's short:", async () => { const output = outputCapture(); await runCli( @@ -4232,8 +4243,9 @@ describe("CLI: status renders the fleet a gateway reports (ADR 0005 §20)", () = expect(output.stdout).toContain( "warm pool: enabled, reserve ios 1 android 0\n" + - " iPhone 17 / 26.0 / full wanted 2 ready 1 booting 1\n" + - " iPhone 17 / 27.0 / full wanted 1 ready 0 booting 0 short: runtime-missing\n", + " iPhone 17 / 26.0 / full configured wanted 2 ready 1 booting 1\n" + + " iPhone 17 / 27.0 / full learned wanted 1 ready 0 booting 0 short: runtime-missing\n" + + " Pixel 8 / 35 / full / google_apis_playstore learned wanted 1 ready 1 booting 0\n", ); }); @@ -4262,7 +4274,7 @@ describe("CLI: status renders the fleet a gateway reports (ADR 0005 §20)", () = expect(output.stdout).toContain( "warm pool: enabled, reserve ios 0 android 0\n" + - " iPhone 17 / slim wanted 1 ready 0 booting 0\n", + " iPhone 17 / slim configured wanted 1 ready 0 booting 0\n", ); }); @@ -4286,7 +4298,7 @@ describe("CLI: status renders the fleet a gateway reports (ADR 0005 §20)", () = expect(output.stdout).toContain( "warm pool: disabled, reserve ios 0 android 0\n" + - " iPhone 17 / 26.0 / full wanted 2 ready 0 booting 0 short: disabled\n", + " iPhone 17 / 26.0 / full configured wanted 2 ready 0 booting 0 short: disabled\n", ); }); From 595ca38c9013737045e2b67e64e286918bc35b77 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:21:50 +0200 Subject: [PATCH 06/16] feat(cli): simlock status shows each warm pool entry's origin and tag (#777) --- src/cli/format.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/format.ts b/src/cli/format.ts index c837800d5..11ec2f694 100644 --- a/src/cli/format.ts +++ b/src/cli/format.ts @@ -256,11 +256,11 @@ function formatWarmPool(warmPool: NonNullable): str return [ `warm pool: ${enabled ? "enabled" : "disabled"}, reserve ios ${reserveRunning.ios} android ${reserveRunning.android}`, ...targets.map((target) => { - const name = [target.model, target.osVersion, target.mode] + const name = [target.model, target.osVersion, target.mode, target.imageTag] .filter((part) => part !== undefined) .join(" / "); const short = target.short === undefined ? "" : ` short: ${target.short}`; - return ` ${name} wanted ${target.count} ready ${target.ready} booting ${target.booting}${short}`; + return ` ${name} ${target.origin} wanted ${target.count} ready ${target.ready} booting ${target.booting}${short}`; }), ]; } From 5abca708cde1d2bbc2bd4b6f89ba47b23c36c38b Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:22:39 +0200 Subject: [PATCH 07/16] test: warm-pool.target-missed carries origin configured and no learned kind emits it (#777) --- src/core/warm-pool/converger.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/warm-pool/converger.test.ts b/src/core/warm-pool/converger.test.ts index 5d5d54f02..d57b4d6c3 100644 --- a/src/core/warm-pool/converger.test.ts +++ b/src/core/warm-pool/converger.test.ts @@ -2042,6 +2042,7 @@ describe("warm pool targets", () => { count: 1, mode: "full", model: "iPhone 17", + origin: "configured", osVersion: "27.0", platform: "ios", ready: 0, @@ -2084,6 +2085,7 @@ describe("warm pool targets", () => { count: 1, mode: "full", model: "iPhone 17", + origin: "configured", platform: "ios", ready: 0, reason: "no-driver", @@ -2647,7 +2649,7 @@ describe("warm pool learned kinds", () => { ]); }); - it("emits warm-pool.target-missed for a merged entry by its configured count", async () => { + it("emits warm-pool.target-missed with origin configured and the configured count, and for no learned kind however short it is", async () => { const payloads = (rig: ReturnType): unknown[] => { const seen: unknown[] = []; rig.eventBus.subscribe("warm-pool.target-missed", (envelope) => @@ -2674,6 +2676,7 @@ describe("warm pool learned kinds", () => { count: 1, mode: "full", model: "iPhone 15", + origin: "configured", osVersion: "26.0", platform: "ios", ready: 0, From 9ac36aab3b145fbe94de1a83ea33de874c95c40e Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:23:11 +0200 Subject: [PATCH 08/16] feat(warm-pool): warm-pool.target-missed names origin configured (#777) --- docs/internal/EVENTS.md | 2 +- src/bus/index.ts | 1 + src/core/warm-pool/converger.ts | 1 + website/src/content/docs/docs/reference/events.mdx | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/internal/EVENTS.md b/docs/internal/EVENTS.md index c5e7a8f72..cde25fb50 100644 --- a/docs/internal/EVENTS.md +++ b/docs/internal/EVENTS.md @@ -70,7 +70,7 @@ worker is ever contacted. `lease-id-taken` (ADR 0020; widens a published vocabul |---|---|---|---|---| | `capacity.changed` | per platform (`ios`, `android`) and `global`: running, max running, reserved, warm; `ramBudget` (used bytes, limit bytes) only under the `resource` capacity strategy | a worker's capacity figures differ from the last ones emitted: after a registry commit, or after a provisioning or boot reservation is taken or released. Emitted once when the daemon has started, so every run begins with a step; two consecutive events never carry equal figures. The figures are the ones `simlock status` reports | CapacityObserver (worker) | implemented | | `queue.changed` | depth, `physical: true` when the physical line changed (ADR 0022 §3, additive, events rule 6) | the number of requests waiting in a queue changed: a request joined it or left it. A queue has two lines; `depth` is the changed line's, and the event without `physical` is the virtual line's. Emitted once when the daemon has started. A worker emits it for its own queue and a gateway for its fleet queue; a worker's events a gateway relays carry `workerId`, and the gateway's own do not | WaitQueue (worker) / FleetLeaseCoordinator (gateway) | implemented | -| `warm-pool.target-missed` | `{ platform, model, osVersion?, mode, count, ready, reason }` — `osVersion` is the resolved one, or the configured one for a target that did not resolve, and absent when it names none and did not resolve; `reason` is the one reason the pool records for the target (`warm-pool/policy.ts` for one that resolved, `warm-pool/converger.ts` for one the resolver refused), the one `short` carries in `status.get` (the one reason `simlock status` shows as the target's `short`, but never `disabled`, since a pool that is off reports no target: `no-driver`, `runtime-missing`, `unknown-model`, `unresolvable`, `boot-failed`, `device-limit`, `running-limit`, `reserve` or `ram-budget`) | a warm pool target went short: after a pass the pool could do nothing for a target that has fewer ready devices than its count, and it was not already missed (ADR 0017 §7). Emitted once the pass's actions have run (events rule 3), once per report on that edge (targets that resolve to one spec are one report and emit one event between them, with their counts added; each target the resolver refuses emits its own), not on each short pass after, nor when a retry or a boot fills it and it is short again; the edge is kept per configured target, and only ready devices reaching its count end the miss, so a target met in between and missed again emits again. A target that is filling, held by `warmPool.maxConcurrentBoots` or waiting behind a queued request the pool could not serve is not short | WarmPool (worker) | implemented | +| `warm-pool.target-missed` | `{ platform, model, osVersion?, mode, origin, count, ready, reason }` — `origin` is always `configured`: the event is for the `warmPool.targets` entries, never for a kind the pool learned, and `count` is the configured count (ADR 0038 §8); `osVersion` is the resolved one, or the configured one for a target that did not resolve, and absent when it names none and did not resolve; `reason` is the one reason the pool records for the target (`warm-pool/policy.ts` for one that resolved, `warm-pool/converger.ts` for one the resolver refused), the one `short` carries in `status.get` (the one reason `simlock status` shows as the target's `short`, but never `disabled`, since a pool that is off reports no target: `no-driver`, `runtime-missing`, `unknown-model`, `unresolvable`, `boot-failed`, `device-limit`, `running-limit`, `reserve` or `ram-budget`) | a warm pool target went short: after a pass the pool could do nothing for a target that has fewer ready devices than its count, and it was not already missed (ADR 0017 §7). Emitted once the pass's actions have run (events rule 3), once per report on that edge (targets that resolve to one spec are one report and emit one event between them, with their counts added; each target the resolver refuses emits its own), not on each short pass after, nor when a retry or a boot fills it and it is short again; the edge is kept per configured target, and only ready devices reaching its count end the miss, so a target met in between and missed again emits again. A target that is filling, held by `warmPool.maxConcurrentBoots` or waiting behind a queued request the pool could not serve is not short | WarmPool (worker) | implemented | ## Device lifecycle diff --git a/src/bus/index.ts b/src/bus/index.ts index 1125f9996..ae9e996bc 100644 --- a/src/bus/index.ts +++ b/src/bus/index.ts @@ -297,6 +297,7 @@ export interface EventMap { /** Absent for a target that names none and did not resolve. */ readonly osVersion?: string; readonly mode: "slim" | "full"; + readonly origin: "configured"; readonly count: number; readonly ready: number; /** why: one reason, not all: the first of the reasons the target is short that applies. */ diff --git a/src/core/warm-pool/converger.ts b/src/core/warm-pool/converger.ts index e1f38a936..45e6d9033 100644 --- a/src/core/warm-pool/converger.ts +++ b/src/core/warm-pool/converger.ts @@ -533,6 +533,7 @@ export class WarmPool { count: report.count, mode: report.kind.mode, model: report.kind.model, + origin: "configured", platform: report.kind.platform, ready: report.ready, reason: report.short, diff --git a/website/src/content/docs/docs/reference/events.mdx b/website/src/content/docs/docs/reference/events.mdx index e8c55be69..72a5ab79d 100644 --- a/website/src/content/docs/docs/reference/events.mdx +++ b/website/src/content/docs/docs/reference/events.mdx @@ -124,7 +124,7 @@ release and records nothing. | --- | --- | --- | --- | | `capacity.changed` | The worker's running figures changed, and once at start. | `ios`, `android`, `global`, each with `running`, `maxRunning`, `reserved`, `warm`; `ramBudget` (`usedBytes`, `limitBytes`) under the `resource` strategy | Relayed | | `queue.changed` | A request joined or left the queue, and once at start. | `depth` (requests waiting in that line), `physical: true` when the physical line changed | Own and relayed | -| `warm-pool.target-missed` | A `warmPool.targets` entry went short and the pool could do nothing about it. Once per time it goes short. | `platform`, `model`, `osVersion`, `mode`, `count`, `ready`, `reason` (`no-driver`, `runtime-missing`, `unknown-model`, `unresolvable`, `boot-failed`, `device-limit`, `running-limit`, `reserve`, `ram-budget`) | Relayed | +| `warm-pool.target-missed` | A `warmPool.targets` entry went short and the pool could do nothing about it. Once per time it goes short. | `platform`, `model`, `osVersion`, `mode`, `origin` (always `configured`), `count`, `ready`, `reason` (`no-driver`, `runtime-missing`, `unknown-model`, `unresolvable`, `boot-failed`, `device-limit`, `running-limit`, `reserve`, `ram-budget`) | Relayed | ## Devices From 8c9f9e84e40f9164bc025f32bbcd6ee2da8ea68f Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:23:49 +0200 Subject: [PATCH 09/16] test: doctor reports warm-pool-target-unreachable for no learned entry (#777) --- src/core/doctor.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/doctor.test.ts b/src/core/doctor.test.ts index 58bc664ff..bff1465cf 100644 --- a/src/core/doctor.test.ts +++ b/src/core/doctor.test.ts @@ -3098,6 +3098,7 @@ describe("Doctor: warm pool targets", () => { const figuresOf = ( targets: readonly { model: string; + origin?: "configured" | "learned"; osVersion?: string; platform?: "ios" | "android"; short?: "runtime-missing" | "unknown-model" | "ram-budget"; @@ -3152,11 +3153,13 @@ describe("Doctor: warm pool targets", () => { return report.findings.filter((finding) => finding.kind === "warm-pool-target-unreachable"); } - it("reports a target short with runtime-missing as unreachable, naming the install command", async () => { + it("reports a configured target short with runtime-missing as unreachable, naming the install command, and no learned entry, even one short runtime-missing", async () => { const found = await findings({ figures: figuresOf([ { model: "iPhone 17", osVersion: "26.0" }, { model: "iPhone 17", osVersion: "27.0", short: "runtime-missing" }, + { model: "iPhone 16", origin: "learned", osVersion: "27.0", short: "runtime-missing" }, + { model: "iPhone 15", origin: "learned", osVersion: "26.0", short: "unknown-model" }, ]), }); From 2d60b959319bbf1b04d3dee37ffae600ab309d55 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:24:03 +0200 Subject: [PATCH 10/16] feat(doctor): warm-pool-target-unreachable reads configured entries only (#777) --- src/core/doctor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/doctor.ts b/src/core/doctor.ts index 5575b0a02..ea2017af0 100644 --- a/src/core/doctor.ts +++ b/src/core/doctor.ts @@ -610,7 +610,7 @@ export class Doctor { const { enabled, targets } = this.options.config.warmPool; if (warmPool === undefined || !enabled) return []; const limits = warmPool.runningCapacity(); - const figures = warmPool.figures().targets; + const figures = warmPool.figures().targets.filter((target) => target.origin === "configured"); const catalogs = await this.#catalogsOfMissingRuntimes(figures); const findings = figures.flatMap((target) => unreachableTarget(target, catalogs.get(target.platform)), From 98fbb14cd20970c9b6797e70951fdefd73833c12 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:24:47 +0200 Subject: [PATCH 11/16] test: the worker page maps origin and the tag onto each warm row and renders the Origin column (#777) --- ui/src/model/worker-page.test.ts | 19 +++++++++++++++---- ui/src/model/worker-page.ts | 2 ++ ui/src/screens/fleet/fleet.test.tsx | 19 ++++++++++++++++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/ui/src/model/worker-page.test.ts b/ui/src/model/worker-page.test.ts index 19851ce56..03f1412e7 100644 --- a/ui/src/model/worker-page.test.ts +++ b/ui/src/model/worker-page.test.ts @@ -583,7 +583,7 @@ describe("a worker's warm pool tab", () => { short: "runtime-missing" as const, }; - it("lists each kind the pool keeps with its wanted, ready and booting numbers and the reason it is short, a dash where there is none", () => { + it("lists each kind the pool keeps with its origin, its image tag, its wanted, ready and booting numbers and the reason it is short, a dash where there is none, and gives two kinds that differ by tag two keys", () => { const { warm } = inspect( worker({ warmPool: { @@ -591,7 +591,14 @@ describe("a worker's warm pool tab", () => { reserveRunning: { android: 0, ios: 1 }, targets: [ { ...target, booting: 1, count: 2, osVersion: "26.0", ready: 1, short: undefined }, - { ...target, osVersion: undefined }, + { ...target, origin: "learned" as const, osVersion: undefined }, + { ...target, imageTag: "google_apis", model: "Pixel 8", platform: "android" as const }, + { + ...target, + imageTag: "google_apis_playstore", + model: "Pixel 8", + platform: "android" as const, + }, ], }, }), @@ -601,6 +608,7 @@ describe("a worker's warm pool tab", () => { expect( warm?.targets.map((row) => [ row.model, + row.origin, row.runtime, row.wanted, row.ready, @@ -608,9 +616,12 @@ describe("a worker's warm pool tab", () => { row.short, ]), ).toEqual([ - ["iPhone 17", "26.0", 2, 1, 1, "—"], - ["iPhone 17", "—", 1, 0, 0, "runtime-missing"], + ["iPhone 17", "configured", "26.0", 2, 1, 1, "—"], + ["iPhone 17", "learned", "—", 1, 0, 0, "runtime-missing"], + ["Pixel 8 / google_apis", "configured", "27.0", 1, 0, 0, "runtime-missing"], + ["Pixel 8 / google_apis_playstore", "configured", "27.0", 1, 0, 0, "runtime-missing"], ]); + expect(new Set(warm?.targets.map((row) => row.key)).size).toBe(4); }); it("says the pool is off when the worker reports it so, and keeps two refused targets of one kind as two rows", () => { diff --git a/ui/src/model/worker-page.ts b/ui/src/model/worker-page.ts index 52ae32795..408175fda 100644 --- a/ui/src/model/worker-page.ts +++ b/ui/src/model/worker-page.ts @@ -507,6 +507,7 @@ function hostTabOf(worker: WorkerView): HostTab { export interface WarmRow { readonly key: string; readonly model: string; + readonly origin: string; readonly runtime: string; readonly mode: string; readonly wanted: number; @@ -536,6 +537,7 @@ function warmRow(row: WarmPoolRow): WarmRow { key: row.key, mode: row.mode, model: row.model, + origin: "", ready: row.ready, runtime: row.osVersion ?? "—", short: row.short ?? "—", diff --git a/ui/src/screens/fleet/fleet.test.tsx b/ui/src/screens/fleet/fleet.test.tsx index 23dba9a29..1148aa0ba 100644 --- a/ui/src/screens/fleet/fleet.test.tsx +++ b/ui/src/screens/fleet/fleet.test.tsx @@ -319,11 +319,22 @@ describe("a worker's host and warm pool tabs", () => { count: 1, mode: "full", model: "iPhone 17", - origin: "configured", + origin: "learned", platform: "ios", ready: 0, short: "runtime-missing", }, + { + booting: 0, + count: 1, + imageTag: "google_apis_playstore", + mode: "full", + model: "Pixel 8", + origin: "learned", + osVersion: "35", + platform: "android", + ready: 1, + }, ], }, }; @@ -333,8 +344,10 @@ describe("a worker's host and warm pool tabs", () => { expect(shown).toContain("Pool On"); expect(shown).toContain("Reserved running slots iOS 1, Android 0"); - expect(shown).toContain("iPhone 17 26.0 full 2 1 1 —"); - expect(shown).toContain("iPhone 17 — full 1 0 0 runtime-missing"); + expect(shown).toContain("Origin"); + expect(shown).toContain("iPhone 17 26.0 full configured 2 1 1 —"); + expect(shown).toContain("iPhone 17 — full learned 1 0 0 runtime-missing"); + expect(shown).toContain("Pixel 8 / google_apis_playstore 35 full learned 1 1 0 —"); expect(shown).toContain("iOS 19.0 downloading for 7 s , 1 waiter"); expect(markup).toContain('2'); }); From 72e243648892ab7ee6b8fae8a0ba78083fd9d788 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:25:17 +0200 Subject: [PATCH 12/16] feat(console): the Warm pool table shows each entry's origin and tag (#777) --- ui/src/model/worker-page.ts | 4 ++-- ui/src/model/workers.ts | 3 ++- ui/src/screens/fleet/worker-page.tsx | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/src/model/worker-page.ts b/ui/src/model/worker-page.ts index 408175fda..905e55d8e 100644 --- a/ui/src/model/worker-page.ts +++ b/ui/src/model/worker-page.ts @@ -536,8 +536,8 @@ function warmRow(row: WarmPoolRow): WarmRow { booting: row.booting, key: row.key, mode: row.mode, - model: row.model, - origin: "", + model: row.imageTag === undefined ? row.model : `${row.model} / ${row.imageTag}`, + origin: row.origin, ready: row.ready, runtime: row.osVersion ?? "—", short: row.short ?? "—", diff --git a/ui/src/model/workers.ts b/ui/src/model/workers.ts index b20756c71..cf1168d19 100644 --- a/ui/src/model/workers.ts +++ b/ui/src/model/workers.ts @@ -71,7 +71,8 @@ export type WarmPoolRow = WarmTarget & { readonly key: string }; export function warmPoolRows(targets: readonly WarmTarget[]): WarmPoolRow[] { const seen = new Map(); return targets.map((target) => { - const kind = `${target.platform}-${target.model}-${target.osVersion}-${target.mode}`; + const tag = target.imageTag === undefined ? "" : `-${target.imageTag}`; + const kind = `${target.platform}-${target.model}-${target.osVersion}-${target.mode}${tag}`; const occurrence = seen.get(kind) ?? 0; seen.set(kind, occurrence + 1); return { ...target, key: `${kind}#${occurrence}` }; diff --git a/ui/src/screens/fleet/worker-page.tsx b/ui/src/screens/fleet/worker-page.tsx index 1b25e0b77..15b74d975 100644 --- a/ui/src/screens/fleet/worker-page.tsx +++ b/ui/src/screens/fleet/worker-page.tsx @@ -374,6 +374,7 @@ const WARM_COLUMNS: readonly Column[] = [ { cell: (target) => target.model, header: "Model" }, { cell: (target) => target.runtime, header: "Runtime", mono: true }, { cell: (target) => target.mode, header: "Mode" }, + { cell: (target) => target.origin, header: "Origin" }, { cell: (target) => target.wanted, header: "Wanted", numeric: true }, { cell: (target) => target.ready, header: "Ready", numeric: true }, { cell: (target) => target.booting, header: "Booting", numeric: true }, From 2e3900852571090219d03e40cadee996975d988e Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:29:30 +0200 Subject: [PATCH 13/16] docs(warm-pool): describe origin, image tag and the learned pool in status (#777) --- src/core/doctor.ts | 2 +- src/core/warm-pool/AGENTS.md | 9 +++++---- src/core/warm-pool/converger.ts | 5 ++--- website/src/content/docs/docs/worker/capacity.mdx | 9 ++++++--- website/src/content/docs/docs/worker/console.mdx | 2 +- website/src/content/docs/docs/worker/monitoring.mdx | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/core/doctor.ts b/src/core/doctor.ts index ea2017af0..b910ea1a9 100644 --- a/src/core/doctor.ts +++ b/src/core/doctor.ts @@ -599,7 +599,7 @@ export class Doctor { } /** - * The warm pool's targets that cannot be met as configured: those the last pass found a runtime + * why: the warm pool's configured targets (a learned kind is never a finding) that cannot be met: those the last pass found a runtime * or a model missing for, and the platforms (or the machine) whose targets add up to more than * the running limit leaves once the reserve is held back. Read, never acted on, like * `prerequisite-missing`. A target short for RAM, the device limit or a failed boot is no diff --git a/src/core/warm-pool/AGENTS.md b/src/core/warm-pool/AGENTS.md index 25ac27e1f..bd185a543 100644 --- a/src/core/warm-pool/AGENTS.md +++ b/src/core/warm-pool/AGENTS.md @@ -76,16 +76,17 @@ every call, so cancellation removes this protection. The reaper's `idle-shutdown these devices. With no pass yet, it resolves the targets first. With the pool off it returns none. Figures (`figures()`, read by `status.get`, doctor's `warm-pool-target-unreachable`, the console): -`enabled`, `reserveRunning`, and per kind `platform`, `model`, `osVersion`, `mode`, `count`, `ready`, -`booting`, `short`. Before the first pass, or with the pool off, they come from config. +`enabled`, `reserveRunning`, and per kind `platform`, `model`, `osVersion`, `mode`, `imageTag`, `origin` +(`configured` or `learned`), `count`, `ready`, `booting`, `short`; learned kinds included, a merged kind once +with the larger count. Before the first pass, or with the pool off, they are the configured targets from config. `short`, the first that applies: `disabled`; set in the converger `no-driver`, `runtime-missing`, `unknown-model`, `unresolvable`; set in the policy `boot-failed`, `device-limit`, `running-limit`, `reserve`, `ram-budget`. None while filling or waiting behind a queued request the pass could not serve. `warm-pool.target-missed`: once per report that is short now and whose configured targets have not -missed since they were last met (ready ≥ count). Payload: platform, model, osVersion, mode, count, -ready, reason. +missed since they were last met (ready ≥ count). Configured targets only, by the configured count. Payload: +platform, model, osVersion, mode, origin (`configured`), count, ready, reason. Stop: `close()` at stop start; `drain()` finishes the pass and running boots, starts nothing; `dispose()` cancels the timers. diff --git a/src/core/warm-pool/converger.ts b/src/core/warm-pool/converger.ts index 45e6d9033..3ff75251d 100644 --- a/src/core/warm-pool/converger.ts +++ b/src/core/warm-pool/converger.ts @@ -302,7 +302,7 @@ export class WarmPool { }); } - /** Every report as the last pass left it: how many are ready, and why not more. Targets that resolved to one spec are one report. */ + /** why: every configured target's report as the last pass left it: how many are ready, and why not more. Targets that resolved to one spec are one report. */ targets(): readonly TargetReport[] { return this.#reports; } @@ -835,8 +835,7 @@ function shutDownIn(devices: readonly VirtualDevice[], down: ReadonlySet } /** - * why: status, the short log and `warm-pool.target-missed` describe the operator's targets only in - * this version, so a learned kind's report is left out and a merged entry is judged by the + * why: the short log and `warm-pool.target-missed` describe the operator's targets only, so a learned kind's report is left out and a merged entry is judged by the * configured count: a configured target that is met is not short however short the learned count is. */ function configuredOnly(reports: readonly TargetReport[]): TargetReport[] { diff --git a/website/src/content/docs/docs/worker/capacity.mdx b/website/src/content/docs/docs/worker/capacity.mdx index 7a7cf0cf2..ac0b3a5d6 100644 --- a/website/src/content/docs/docs/worker/capacity.mdx +++ b/website/src/content/docs/docs/worker/capacity.mdx @@ -192,14 +192,17 @@ Other settings: ### Read the warm pool in `simlock status` -Each target gets a line under `warm pool`. Learned kinds are not listed. +Each target and each learned kind gets a line under `warm pool`. The word after the name says where the line came from: `configured` for a `warmPool.targets` entry, `learned` for a kind the worker leased. A kind that is both is one `configured` line, wanted the larger of the two counts. An Android kind with an image tag shows the tag after the mode. A learned kind the pool forgets leaves the list on the next pass. With the warm pool off, nothing is learned and only the targets are listed. ```text warm pool: enabled, reserve ios 1 android 0 - iPhone 16 / 26.0 / full wanted 2 ready 1 booting 1 - Pixel 8 / 35 / full wanted 1 ready 0 booting 0 short: runtime-missing + iPhone 16 / 26.0 / full configured wanted 2 ready 1 booting 1 + iPhone 15 / 18.4 / full learned wanted 1 ready 1 booting 0 + Pixel 8 / 35 / full / google_apis_playstore learned wanted 1 ready 0 booting 0 short: running-limit ``` +`simlock status --json` carries the same in `warmPool.targets[]`: `origin` (`configured` or `learned`) and, when the kind names one, `imageTag`. `simlock doctor` and the `warm-pool.target-missed` event cover the configured targets only. + `short` says why the last pass could do nothing for a target: | Reason | What to do | diff --git a/website/src/content/docs/docs/worker/console.mdx b/website/src/content/docs/docs/worker/console.mdx index 42e44c2cc..939a34329 100644 --- a/website/src/content/docs/docs/worker/console.mdx +++ b/website/src/content/docs/docs/worker/console.mdx @@ -127,7 +127,7 @@ Select the worker to see three tabs: - **Overview**: CPU, memory and disk, each with a bar; how many leases it holds; a square per device slot for iOS and Android (leased, ready, booting, quarantined or free); and every device, with its state, model, runtime, whether it is physical or virtual, and the lease holding it. - **Host**: the worker's id, health, operating system, CPU architecture, the version of each platform tool, each optional module (such as screen streaming) as `available`, `off` or `unavailable` with a reason, and the catalog of models and runtimes it can lease. -- **Warm pool**: whether the worker keeps devices warm, the running slots it holds back, and per target how many devices it wants, how many are ready and how many are booting. A target it cannot fill shows the reason, such as `runtime-missing`. Under it, **Installs in progress** lists runtimes and system images being downloaded. See [Capacity and the warm pool](/simlock/docs/worker/capacity). +- **Warm pool**: whether the worker keeps devices warm, the running slots it holds back, and per target and learned kind its origin (`configured` or `learned`), how many devices it wants, how many are ready and how many are booting. A target it cannot fill shows the reason, such as `runtime-missing`. Under it, **Installs in progress** lists runtimes and system images being downloaded. See [Capacity and the warm pool](/simlock/docs/worker/capacity). While the daemon is still starting, devices, capacity and the warm pool are left out. They appear once startup finishes. diff --git a/website/src/content/docs/docs/worker/monitoring.mdx b/website/src/content/docs/docs/worker/monitoring.mdx index 177f0e194..d7c937d99 100644 --- a/website/src/content/docs/docs/worker/monitoring.mdx +++ b/website/src/content/docs/docs/worker/monitoring.mdx @@ -29,7 +29,7 @@ Capacity ios: managed 4/8, running 3 + 1 reserved/4, warm 1 Capacity android: managed 0/4, running 0 + 0 reserved/2, warm 0 RAM budget: 11.50 GiB/22.00 GiB used warm pool: enabled, reserve ios 0 android 0 - iPhone 16 / 18.4 / full wanted 1 ready 1 booting 0 + iPhone 16 / 18.4 / full configured wanted 1 ready 1 booting 0 Device dev_6f1c2a9e-3b7d-4e0a-9c55-2d8f1e4a7b10: leased, mode full, serves default mode: yes Device dev_0b93d4c1-8a2e-4f6b-b1d7-5e9c3a2f8d64: ready, mode full, serves default mode: yes Lease lse_9d2e7b14-6c3a-4f81-a0e5-7b1c9d4e2f36: claude-code:5f0e8a3c-1b2d-4c6e-9f7a-0d3b8e1c4a92 since 1761036720000, last renewed 1761037320000 @@ -48,7 +48,7 @@ What each line means: | `Running global` | Devices running now, plus slots held for devices that are booting, out of the most that may run at once, and how many of the running ones are warm. | | `Capacity ios` / `Capacity android` | Per platform: `managed` is devices that exist out of the device limit; `running` is as above. `(over limit)` means more devices exist than the limit allows, for example after you lowered it. `(at RAM budget)` means no more devices fit in the memory set aside for them. | | `RAM budget` | Memory the running devices use out of the budget. Shown only with the `resource` capacity strategy. | -| `warm pool` | Whether the warm pool is on, the running slots it keeps free per platform, and one row per target: how many devices you want ready, how many are ready, how many are booting, and why a target is short. | +| `warm pool` | Whether the warm pool is on, the running slots it keeps free per platform, and one row per target and learned kind, with where it came from (`configured` or `learned`): how many devices you want ready, how many are ready, how many are booting, and why a target is short. | | `Device` | One line per device: its id, state, and its device mode, or `physical` and its class for an enrolled physical device. Markers in brackets flag a problem, such as `quarantined (purge retry 2, ...)` or `stalled`. | | `Lease` | One line per lease: its id, the requester holding it, and when it was granted and last renewed, in milliseconds since 1970. | | `Install` | A runtime or system image being downloaded, how long for, and how many requests wait on it. | From b6c5f141cb796f3fac6607ca5332edf1f8380a33 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:41:22 +0200 Subject: [PATCH 14/16] refactor(contract): keep WARM_POOL_ENTRIES_MAX private to the schema (#777) --- src/contract/schemas.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contract/schemas.ts b/src/contract/schemas.ts index c9682bdde..37d0629cd 100644 --- a/src/contract/schemas.ts +++ b/src/contract/schemas.ts @@ -521,7 +521,7 @@ export const statusCapacitySchema = z.object({ export const WARM_POOL_TARGETS_MAX = 256; export const WARM_POOL_NAME_MAX = 256; /** why: the configured targets plus the learned kinds, 32 per platform, the pool keeps. */ -export const WARM_POOL_ENTRIES_MAX = WARM_POOL_TARGETS_MAX + 64; +const WARM_POOL_ENTRIES_MAX = WARM_POOL_TARGETS_MAX + 64; /** Why a warm target is short, in the order the first that applies is the one reported. */ const warmPoolShortSchema = z.enum([ From 2bc8e10b75c4f73f2f548efe9c2cf4dcdad7b80c Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:44:41 +0200 Subject: [PATCH 15/16] test: the worker page's rows keep the image tag in their key (#777) --- ui/src/model/worker-page.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/src/model/worker-page.test.ts b/ui/src/model/worker-page.test.ts index 03f1412e7..3b6bc1d63 100644 --- a/ui/src/model/worker-page.test.ts +++ b/ui/src/model/worker-page.test.ts @@ -621,7 +621,12 @@ describe("a worker's warm pool tab", () => { ["Pixel 8 / google_apis", "configured", "27.0", 1, 0, 0, "runtime-missing"], ["Pixel 8 / google_apis_playstore", "configured", "27.0", 1, 0, 0, "runtime-missing"], ]); - expect(new Set(warm?.targets.map((row) => row.key)).size).toBe(4); + expect(warm?.targets.map((row) => row.key)).toEqual([ + "ios-iPhone 17-26.0-full#0", + "ios-iPhone 17-undefined-full#0", + "android-Pixel 8-27.0-full-google_apis#0", + "android-Pixel 8-27.0-full-google_apis_playstore#0", + ]); }); it("says the pool is off when the worker reports it so, and keeps two refused targets of one kind as two rows", () => { From 95bece8a5ffa7fe03321b290160368289fb1d80d Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 21 Oct 2026 19:53:19 +0200 Subject: [PATCH 16/16] test: no learned kind announces target-missed, with a short learned kind in the rig; fix the targets bound comment (#777) --- src/contract/schemas.ts | 2 +- src/core/warm-pool/converger.test.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/contract/schemas.ts b/src/contract/schemas.ts index 37d0629cd..c469c5069 100644 --- a/src/contract/schemas.ts +++ b/src/contract/schemas.ts @@ -517,7 +517,7 @@ export const statusCapacitySchema = z.object({ }); /** Bounds on the warm pool block: a gateway parses it off the wire from every worker. */ -/** The most targets the block carries, and the longest model or OS version it names. The config load enforces the same. */ +/** why: the most configured targets the config load accepts (the block itself takes `WARM_POOL_ENTRIES_MAX`), and the longest model or OS version the block names. */ export const WARM_POOL_TARGETS_MAX = 256; export const WARM_POOL_NAME_MAX = 256; /** why: the configured targets plus the learned kinds, 32 per platform, the pool keeps. */ diff --git a/src/core/warm-pool/converger.test.ts b/src/core/warm-pool/converger.test.ts index d57b4d6c3..e2bbacc56 100644 --- a/src/core/warm-pool/converger.test.ts +++ b/src/core/warm-pool/converger.test.ts @@ -2665,11 +2665,22 @@ describe("warm pool learned kinds", () => { const metPayloads = payloads(met); await met.pool.pass(); await met.pool.settle(); - const empty = harness([], { limit: 0, state: await withLearned([1, 2]), targets: [phone] }); + const empty = harness([], { + catalog: async () => [iosListing], + limit: 0, + state: await withLearned([1, 2]), + targets: [phone], + }); const emptyPayloads = payloads(empty); await empty.pool.pass(); await empty.pool.settle(); + expect( + empty.pool + .figures() + .targets.filter((target) => target.origin === "learned") + .map((target) => [target.model, target.short]), + ).toEqual([["iPad Pro", "running-limit"]]); expect(metPayloads).toEqual([]); expect(emptyPayloads).toEqual([ {