commit c6caeb87fef1d679d407c9ae435469c532b0e8d0
parent 456e0b8dbb93bc4f766da807a10c4e6aefd10af5
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 19 Oct 2026 14:19:52 -0400
workers: the pool summary marks a worker the pause alone switched off (`pauseHeld: true`)
So `pnpm ops get workers` (and the Workers page's data) say which worker a
whilePaused job may take. Absent outside a pause and for every other worker.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/common/jobs/workerPool.ts b/common/jobs/workerPool.ts
@@ -73,6 +73,10 @@ export type WorkerSummary = {
// GPU worker beside two explicitly CPU-pinned ones, and treating those as GPU
// contention stopped the digest lane dead for work that used no shaders at all.
device?: string;
+ // During a pause-all: this worker was switched off by the pause ALONE, so a
+ // `whilePaused` acquire may take it (release 36 lane A; see pauseHeld).
+ // Absent outside a pause and for every other worker.
+ pauseHeld?: true;
};
type PoolEntry = {
@@ -747,6 +751,7 @@ export class WorkerPool {
? { tags: [...e.config.tags] }
: {}),
device: e.config.config?.device,
+ ...(this.pauseHeld(e.config.id, e) && !e.degraded ? { pauseHeld: true as const } : {}),
}))
.sort((a, b) => a.priority - b.priority || a.id.localeCompare(b.id));
}
diff --git a/common/jobs/workerPool.whilePaused.test.ts b/common/jobs/workerPool.whilePaused.test.ts
@@ -36,6 +36,7 @@ test("a paused pool + whilePaused leases a pause-disabled worker; the snapshot i
pool.pauseAll();
const before = snapshotOf(pool);
assert.deepEqual(pool.pauseHeldIds().sort(), ["cpu", "gpu"]);
+ assert.deepEqual(pool.summary().map((w) => [w.id, w.pauseHeld ?? false]), [["gpu", true], ["cpu", true]]);
const lease = (await settledWithin(pool.acquire(undefined, { whilePaused: true }))) as Lease | null;
assert.ok(lease, "granted at once");
@@ -78,6 +79,7 @@ test("hand-disabled, drained or degraded workers are never leased, even with the
pool.markDegraded("c");
const before = snapshotOf(pool);
assert.deepEqual(pool.pauseHeldIds(), [], "'off' was disabled in settings, not by the pause");
+ assert.ok(pool.summary().every((w) => !("pauseHeld" in w)), "the summary marks none");
const ac = new AbortController();
const p = pool.acquire(ac.signal, { whilePaused: true });