Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Route: count what starts still hold; each new agent's row says its machine's room (#2734)

0xken156e55dd74084c
diff --git a/cli/src/superTabs/machineFit.ts b/cli/src/superTabs/machineFit.ts
index 39aaa5d3a..bd3071940 100644
--- a/cli/src/superTabs/machineFit.ts
+++ b/cli/src/superTabs/machineFit.ts
@@ -49,7 +49,7 @@ export interface Placed { memoryBytes: number; diskBytes: number; agents: number
const finite = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v)
/** The heavy work a start declared in its own field (backend superTabs/model.ts AgentStartRequest.heavy), or none. Never read
* from the memory it asked: an ordinary Builder's start may ask as much as a heavy one (review of #2426). */
-function heavyOfStart(start: Json): Need | null {
+export function heavyOfStart(start: Json): Need | null {
const heavy = object(start.request).heavy
return Array.isArray(heavy) ? heavyNeed({ heavy: heavy.filter((k): k is HeavyWork => typeof k === 'string' && Object.hasOwn(HEAVY_NEEDS, k)) }) : null
}
diff --git a/cli/src/superTabs/route.spec.ts b/cli/src/superTabs/route.spec.ts
index 919a72a8f..ea9b7fd3d 100644
--- a/cli/src/superTabs/route.spec.ts
+++ b/cli/src/superTabs/route.spec.ts
@@ -1,6 +1,6 @@
// cli/src/superTabs/route.spec.ts
import { afterEach, describe, expect, it, vi } from 'vitest'
-import { API_BUILDERS, catalogFrom, catalogRow, choose, decide, gridStrength, LOCAL_NONE, OTHER_REPOSITORY, parseAssessment, quotaOf2, recordOf, repoMatch, repositoryKey, strengthOf,
+import { API_BUILDERS, catalogFrom, quotaBrief, catalogRow, choose, decide, gridStrength, LOCAL_NONE, OTHER_REPOSITORY, parseAssessment, quotaOf2, recordOf, repoMatch, repositoryKey, strengthOf,
type Assessment, type Catalog, type Commitment, type MemberFrame, type Probe, type RoutePlugin, type TaskFolder } from './route.js'
const object = (v: unknown) => v as Record<string, unknown>
@@ -284,6 +284,12 @@ describe('strength, fit and effective cost', () => {
expect(r.shown).toHaveLength(28)
for (const b of boxes) expect(r.shown.filter(s => s.machineName === b).map(s => [s.engine, s.fit.status]).sort()).toEqual([['claude', 'fits'], ['codex', 'short']])
})
+ // River, 2026-11-03: a Codex reading "unknown" did not say that its owner's machine must relay it.
+ it('says why an unknown quota is unknown', () => {
+ const why = 'This account runs on its owner\'s subscription; its allowance is read on the owner\'s machine.'
+ expect(quotaBrief({ quota: { known: false, leftPercent: null, resetsAt: null, why }, fit: { status: 'unknown' } }, NOW)).toBe(`unknown: ${why}`)
+ expect(quotaBrief({ quota: { known: false, leftPercent: null, resetsAt: null }, fit: { status: 'unknown' } }, NOW)).toBe('unknown: weekly unknown')
+ })
it('shows at most 64 rows, what the backend keeps of a decision, the best-ranked first', () => {
const boxes = Array.from({ length: 40 }, (_, i) => `box-${String(i).padStart(2, '0')}`)
const r = route(boxes.flatMap(b => [on(CODEX, b, windows(null, [50, 5 * D], `${b}-x`)), on(OPUS, b, windows(null, [99, D], `${b}-c`))]), { difficulty: 'high' })
diff --git a/cli/src/superTabs/route.ts b/cli/src/superTabs/route.ts
index 7a8207953..1233e04ab 100644
--- a/cli/src/superTabs/route.ts
+++ b/cli/src/superTabs/route.ts
@@ -46,7 +46,13 @@ export interface TaskFolder { cwd: string; kind: 'git' | 'none' | 'missing' | 'u
export interface MemberFrame { title: string | null; project: string | null; cwd: string | null; root: string | null; remote: string | null; branch: string | null; updatedAt: number | null }
/** What a machine offers an agent. Each field is null when it could not be read; `freeDiskBytes` (the project's disk) and
* `cpuPercent` are absent where the probe did not read them. */
-export interface MachineLoad { agents: number | null; freeMemoryBytes: number | null; hasFolder: boolean | null; freeDiskBytes?: number | null; cpuPercent?: number | null }
+/** What a new start on a machine can use, as its host admits it: the Swarm's free agent slots there, and free memory and disk
+ * less what starts still starting hold (routeCommand.ts heldByStarts). */
+export interface MachineRoom { slots: number | null; freeMemoryBytes: number | null; heldMemoryBytes: number; freeDiskBytes: number | null }
+/** `freeMemoryBytes` and `freeDiskBytes` leave heavy starts in, which the machine fit holds itself (machineFit.ts
+ * placedHeavyWork); `room` is what a start can use. */
+export interface MachineLoad { agents: number | null; freeMemoryBytes: number | null; hasFolder: boolean | null; freeDiskBytes?: number | null; cpuPercent?: number | null
+ room?: MachineRoom }
export interface Probe {
kind: 'member' | 'new'; agentId?: string; name?: string; machineId: string; machineName: string
/** `quality` is the catalog's strength, 1 for a model it does not rate (`unrated`). */
@@ -377,7 +383,7 @@ function quotaText(q: Quota, now: number): string {
if (q.resetsAt === null) return `quota ${Math.round(q.leftPercent)}% left`
return `quota ${Math.round(q.leftPercent)}% left, resets in ${resetsIn(q.resetsAt, now)}`
}
-const bytes = (n: number) => n >= 1e9 ? `${(n / 1e9).toFixed(1)} GB` : `${Math.round(n / 1e6)} MB`
+export const bytes = (n: number) => n >= 1e9 ? `${(n / 1e9).toFixed(1)} GB` : `${Math.round(n / 1e6)} MB`
/** What a member is doing and has done, or one phrase saying it is not known. */
function memberText(p: Probe, now: number): string[] {
const f = p.frame
@@ -488,6 +494,16 @@ function withEveryAccount<T extends Pick<Probe, 'machineId' | 'engine' | 'gridMo
return ranked.filter(p => keep.has(p))
}
+/** What the agent choosing reads of a row's machine: whether a start there would be admitted (River, 2026-11-03: starts
+ * failed on slots, memory and disk the rows did not show). */
+export function machineBrief(room: MachineRoom): string {
+ const slots = room.slots === null ? [] : [`${room.slots} ${room.slots === 1 ? 'slot' : 'slots'} free`]
+ const memory = room.freeMemoryBytes === null ? 'free memory unknown'
+ : `${bytes(Math.max(0, room.freeMemoryBytes))} memory free${room.heldMemoryBytes ? ` (${bytes(room.heldMemoryBytes)} held by starts)` : ''}`
+ const disk = room.freeDiskBytes === null ? [] : [`${bytes(Math.max(0, room.freeDiskBytes))} disk free`]
+ return [...slots, memory, ...disk].join(' · ')
+}
+
/** What the agent choosing reads of a row's quota: its fit and its weekly window, the one the project's order compares. */
export function quotaBrief(p: Pick<Probe, 'quota' | 'gridModel'> & { fit: Pick<Fit, 'status'> }, now: number): string {
if (p.gridModel) return 'local model, no subscription'
@@ -495,7 +511,8 @@ export function quotaBrief(p: Pick<Probe, 'quota' | 'gridModel'> & { fit: Pick<F
const week = p.quota.windows?.find(w => w.name === 'weekly')
const left = week ? week.leftPercent : p.quota.windows?.length ? null : p.quota.leftPercent
const resetsAt = week ? week.resetsAt : p.quota.resetsAt
- if (!p.quota.known || left === null) return `${p.fit.status}: weekly unknown`
+ // Why it is unknown says what would make it known (River, 2026-11-03): a Team account's reading its owner's machine relays.
+ if (!p.quota.known || left === null) return `${p.fit.status}: ${p.quota.why ? cut(p.quota.why, 200) : 'weekly unknown'}`
return `${p.fit.status}: weekly ${Math.round(left)}% left${resetsAt === null ? '' : `, resets in ${resetsIn(resetsAt, now)}`}`
}
diff --git a/cli/src/superTabs/routeCommand.spec.ts b/cli/src/superTabs/routeCommand.spec.ts
index 095208456..3c8df0775 100644
--- a/cli/src/superTabs/routeCommand.spec.ts
+++ b/cli/src/superTabs/routeCommand.spec.ts
@@ -3,7 +3,7 @@ import type { openDaemon } from '../agentClient/daemon.js'
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
-import { ELSEWHERE, heldLocalModels, leftOut, localProbes, NO_SWARM_AGENTS_ON, offlineModels, routeTask, servedModels, STALL_RETRY_MS, stalled } from './routeCommand.js'
+import { ELSEWHERE, heldByStarts, heldLocalModels, leftOut, localProbes, NO_SWARM_AGENTS_ON, offlineModels, routeTask, servedModels, STALL_RETRY_MS, stalled } from './routeCommand.js'
import type { describeScmProject } from '../scm/scmProjects.js'
import { admission, quotaOf, RELAYED_QUOTA, USED_UP_WINDOW } from './capacity.js'
import { OTHER_REPOSITORY, type Catalog, type Probe, type RoutePlugin } from './route.js'
@@ -1064,6 +1064,53 @@ describe('routing contributed capacity', () => {
expect(member.answer.ok).toBe(true)
})
// Scholes's goals, piece 5 (machineFit.ts): heavy work is judged by the machine's reading, for its members as for new agents.
+ // 2026-11-03: 9 of 25 failed starts in 10 hours were refused by their host for memory or disk set aside for agents still
+ // starting (cli superTabs/reservations.ts), which the route did not count, so it kept offering those machines.
+ const GiB = 2 ** 30
+ const starting = (now: number) => {
+ const req = (memoryBytes: number, diskBytes: number) => ({ machineId: 'm1', requirements: { memoryBytes, diskBytes } })
+ return [
+ // Being created: it holds what it asked for.
+ { id: 's1', request: req(2 * GiB, 1 * GiB), requestedAt: now - 60_000, error: null },
+ // Launched a minute ago: still in its start window.
+ { id: 's2', request: req(2 * GiB, 1 * GiB), requestedAt: now - 120_000, harnessId: 'h9', dispatchedAt: now - 60_000, error: null },
+ // Past the deadline of a start, failed, launched long ago, or on another machine: nothing held.
+ { id: 's3', request: req(8 * GiB, 8 * GiB), requestedAt: now - 30 * 60_000, error: null },
+ { id: 's4', request: req(8 * GiB, 8 * GiB), requestedAt: now - 60_000, error: 'Cloning took too long.' },
+ { id: 's5', request: req(8 * GiB, 8 * GiB), requestedAt: now - 20 * 60_000, harnessId: 'h8', dispatchedAt: now - 10 * 60_000, error: null },
+ { id: 's6', request: { ...req(8 * GiB, 8 * GiB), machineId: 'm2' }, requestedAt: now - 60_000, error: null },
+ // Waited 20 minutes in the Swarm, handed to its host a minute ago: the host reserved it then (review).
+ { id: 's7', request: req(1 * GiB, 1 * GiB), requestedAt: now - 20 * 60_000, dispatchedAt: now - 60_000, error: null },
+ ]
+ }
+ it('counts what starts still starting on a machine hold of its memory and disk, as its host does', () => {
+ const now = Date.now()
+ expect(heldByStarts(starting(now), 'm1', now)).toEqual({ memoryBytes: 5 * GiB, diskBytes: 3 * GiB, heavyMemoryBytes: 0, heavyDiskBytes: 0 })
+ expect(heldByStarts([], 'm1', now)).toEqual({ memoryBytes: 0, diskBytes: 0, heavyMemoryBytes: 0, heavyDiskBytes: 0 })
+ // A heavy start's hold is told apart: the machine fit counts heavy work placed there itself (machineFit.ts placedHeavyWork).
+ const heavy = { id: 'h', request: { machineId: 'm1', heavy: ['build'], requirements: { memoryBytes: 4 * GiB, diskBytes: 15 * GiB } }, requestedAt: now - 60_000, error: null }
+ expect(heldByStarts([heavy], 'm1', now)).toEqual({ memoryBytes: 4 * GiB, diskBytes: 15 * GiB, heavyMemoryBytes: 4 * GiB, heavyDiskBytes: 15 * GiB })
+ })
+ it('leaves out new agents on a machine whose free memory is set aside for agents still starting', async () => {
+ const pool = healthy(); Object.assign(pool.observation.resources, { memoryUsedBytes: 26e9 })
+ expect((await runPool(pool)).answer.ok).toBe(true)
+ const { answer } = await runPool(pool, false, {}, undefined, { state: { starts: starting(Date.now()) } })
+ expect(answer.ok).not.toBe(true)
+ expect(JSON.stringify(answer)).toContain('Insufficient measured free memory, with 5.4 GB set aside for agents still starting.')
+ })
+ it('counts a heavy start once for heavy work: the machine fit holds it, the route\'s reading does not hold it again', async () => {
+ const now = Date.now(), pool = healthy(); Object.assign(pool.observation.resources, { projectDiskFreeBytes: 70e9 })
+ const heavy = { id: 'h', request: { machineId: 'm1', heavy: ['build'], requirements: { memoryBytes: 4 * GiB, diskBytes: 15 * GiB } }, requestedAt: now - 60_000, error: null }
+ const { answer } = await runPool(pool, false, { heavy: ['build'] }, undefined, { state: { starts: [heavy] } })
+ expect((answer.pick as { notes?: string[] }).notes ?? []).not.toEqual(expect.arrayContaining([expect.stringContaining('Machine fit')]))
+ })
+ it('says on each row what its machine has: free slots, free memory less what starts hold, and free disk', async () => {
+ const pool = { ...healthy(), availableSlots: 3 }
+ const { answer } = await runPool(pool, false, {}, undefined, { state: { starts: starting(Date.now()) } })
+ expect((answer.pick as { machine: string }).machine).toBe('3 slots free · 24.6 GB memory free (5.4 GB held by starts) · 196.8 GB disk free')
+ const plain = await runPool({ ...healthy(), availableSlots: 1 })
+ expect((plain.answer.pick as { machine: string }).machine).toBe('1 slot free · 30.0 GB memory free · 200.0 GB disk free')
+ })
it('judges heavy work by the contributed machine\'s free memory, disk and CPU, for members too, and its start says it is heavy', async () => {
const pool = healthy(); Object.assign(pool.observation.resources, { memoryUsedBytes: 26e9, cpuPercent: 92 })
const { answer } = await runPool(pool, true, { heavy: ['build'] })
diff --git a/cli/src/superTabs/routeCommand.ts b/cli/src/superTabs/routeCommand.ts
index 164d0ec83..0c4d21014 100644
--- a/cli/src/superTabs/routeCommand.ts
+++ b/cli/src/superTabs/routeCommand.ts
@@ -5,11 +5,12 @@
import { randomUUID } from 'node:crypto'
import { openDaemon, type Daemon, type Where } from '../agentClient/daemon.js'
import { RELAYED_QUOTA, requiredToolReason, startRequirements, USED_UP_WINDOW } from './capacity.js'
+import { START_DEADLINE_MS, START_WINDOW_MS } from './reservations.js'
import { inspectCapacity, type ScopedRequest } from './start.js'
import { ENDED_WORK, object, within } from './wire.js'
-import { accountOf, API_BUILDERS, catalogFrom, catalogRow, choose, decide, gridStrength, parseAssessment, OLD_RECORD_MAX, quotaBrief, quotaOf2, slotOf, recordOf, repoMatch, repositoryKey, type Assessment, type Catalog, type CatalogModel, type RecordShape, type Commitment, type Excluded, type HeldModel, type MemberFrame, type Probe, type TaskFolder } from './route.js'
+import { accountOf, API_BUILDERS, bytes, machineBrief, catalogFrom, catalogRow, choose, decide, gridStrength, parseAssessment, OLD_RECORD_MAX, quotaBrief, quotaOf2, slotOf, recordOf, repoMatch, repositoryKey, type Assessment, type Catalog, type CatalogModel, type RecordShape, type Commitment, type Excluded, type HeldModel, type MemberFrame, type Probe, type TaskFolder } from './route.js'
import { makePlugins, ROUTE_PLUGIN_MAKERS, type PluginMaker } from './routePlugins.js'
-import { CI_HOLD_OPENING, CI_RETRY_MINUTES, MACHINE_FIT_MAKER } from './machineFit.js'
+import { CI_HOLD_OPENING, CI_RETRY_MINUTES, heavyOfStart, MACHINE_FIT_MAKER } from './machineFit.js'
import { stat } from 'node:fs/promises'
import { describeScmProject } from '../scm/scmProjects.js'
@@ -70,6 +71,26 @@ const READY: Unready = { all: [], engines: {}, push: null }
* counting once they say nothing about the machine as it is: its daemon now runs another CLI version than the newer one
* was dispatched to ([pool] `clientVersion`, the backend's record of its last connection), or the newer one is
* [STALL_RETRY_MS] old. A start from before either was recorded counts as before. */
+/** What starts still starting on [machineId] hold of its memory and disk, as its host's reservations do (reservations.ts): one
+ * being created until a start's deadline, a launched one for its start window, a failed one nothing. 2026-11-03: 9 of 25 failed
+ * starts in 10 hours were refused for memory or disk set aside this way, which the route did not count. */
+export function heldByStarts(starts: Json[], machineId: string, now = Date.now()) {
+ const held = { memoryBytes: 0, diskBytes: 0, heavyMemoryBytes: 0, heavyDiskBytes: 0 }
+ for (const start of starts) {
+ const request = object(start.request)
+ if (request.machineId !== machineId || start.error) continue
+ // The host reserves when it is handed the start, which may be long after it was asked for (review).
+ const launched = typeof start.harnessId === 'string'
+ const times = [start.requestedAt, start.dispatchedAt].filter(finite)
+ if (!times.length || now - Math.max(...times) >= (launched ? START_WINDOW_MS : START_DEADLINE_MS)) continue
+ const wanted = object(request.requirements)
+ const memory = finite(wanted.memoryBytes) ? wanted.memoryBytes : 0, disk = finite(wanted.diskBytes) ? wanted.diskBytes : 0
+ held.memoryBytes += memory; held.diskBytes += disk
+ if (heavyOfStart(start)) { held.heavyMemoryBytes += memory; held.heavyDiskBytes += disk }
+ }
+ return held
+}
+
export function stalled(starts: Json[], machineId: string, pool: Json = {}, now = Date.now()): boolean {
const last = starts.filter(s => object(s.request).machineId === machineId && !MODEL_NOT_OFFERED.test(String(s.error ?? ''))).slice(-2)
if (last.length !== 2 || !last.every(s => !s.harnessId && (!!s.error || s.dispatched !== true))) return false
@@ -242,7 +263,7 @@ export async function routeTask(input: { tabId: string; conversationId: string;
// (production, 2026-10-21). A member may run on a machine only its collaborator can open; the route tries that machine
// too, but a member there is unknown, never offline.
const swarmMachines = new Set([where.machineId, ...list(state.machines).map(m => String(m.machineId)), ...agents.map(a => String(a.machineId))])
- const machines = new Map<string, { name: string; status: string; account: boolean; pool?: Json; folded?: boolean; unready?: Unready; stalled?: boolean }>()
+ const machines = new Map<string, { name: string; status: string; account: boolean; pool?: Json; folded?: boolean; unready?: Unready; stalled?: boolean; held?: ReturnType<typeof heldByStarts> }>()
for (const m of list(value.machines)) if (swarmMachines.has(String(m.machineId))) machines.set(String(m.machineId), { name: String(m.name), status: String(m.status ?? 'unknown'), account: true })
// The routing agent's own machine is the account's even when the list could not be read.
if (!machines.has(where.machineId)) machines.set(where.machineId, { name: where.machineId, status: 'unknown', account: true })
@@ -269,6 +290,7 @@ export async function routeTask(input: { tabId: string; conversationId: string;
}
for (const [machineId, machine] of machines) {
machine.stalled = stalled(list(state.starts), machineId, list(state.machines).find(m => m.machineId === machineId))
+ machine.held = heldByStarts(list(state.starts), machineId)
}
// One machine (docs/plans/2026-10-24-swarm-team-account.md): a Mac's Harness Team account is that Mac, under its name. A
// teammate's project starts only in the team account and the Mac's owner's own projects only with the owner, so only one
@@ -376,9 +398,11 @@ export async function routeTask(input: { tabId: string; conversationId: string;
const routeDecisionId = recorded.ok === true ? object(object(recorded.value).result).routeDecisionId : undefined
const decision = typeof routeDecisionId === 'string' ? `,"routeDecisionId":"${routeDecisionId}"` : ''
// What the agent choosing reads of a candidate: where it runs, and what the route knows of it beside the ranking.
+ // A new agent's row says what its machine has for a start; a member needs no new start, and a paused machine, which offers
+ // no new agent, shows no reading (review of #2426).
const publicOf = (s: typeof verdict.pick) => ({ id: s.id, kind: s.kind, ...(s.agentId ? { agentId: s.agentId } : {}), machineId: s.machineId,
engine: s.engine, model: s.model, effort: s.effort, title: s.title, ...(s.gridModel ? { gridModel: s.gridModel, gridName: s.gridName } : {}),
- ...(s.unrated ? { unrated: true } : {}), quota: quotaBrief(s, now), ...(s.notes.length ? { notes: s.notes } : {}) })
+ ...(s.unrated ? { unrated: true } : {}), quota: quotaBrief(s, now), ...(s.kind === 'new' && s.load?.room ? { machine: machineBrief(s.load.room) } : {}), ...(s.notes.length ? { notes: s.notes } : {}) })
return {
ok: true, ...(typeof routeDecisionId === 'string' ? { routeDecisionId } : { unrecorded: true }),
...(instructions ? { instructions } : { instructionsUnreadable: true }),
@@ -530,7 +554,7 @@ function loadOf(resources: Json, agents: number | null, cwd: string | undefined)
cpuPercent: finite(resources.cpuPercent) ? resources.cpuPercent : null }
}
-async function probeMachine(machineId: string, { name: machineName, status, account, pool, folded, unready = READY, stalled: stuck = false }: { name: string; status: string; account: boolean; pool?: Json; folded?: boolean; unready?: Unready; stalled?: boolean },
+async function probeMachine(machineId: string, { name: machineName, status, account, pool, folded, unready = READY, stalled: stuck = false, held = heldByStarts([], machineId) }: { name: string; status: string; account: boolean; pool?: Json; folded?: boolean; unready?: Unready; stalled?: boolean; held?: ReturnType<typeof heldByStarts> },
members: Json[], allModels: CatalogModel[], catalog: Catalog, a: Assessment, where: Where, open: typeof openDaemon): Promise<Probe[]> {
const listedEngines = Array.isArray(pool?.engines) ? pool.engines.filter((engine): engine is string => typeof engine === 'string') : []
const legacy = listedEngines.some(engine => !ENGINES.includes(engine))
@@ -566,6 +590,11 @@ async function probeMachine(machineId: string, { name: machineName, status, acco
if (typeof relayed.from === 'string') return { ...read(object(relayed.quota), { account: String(relayed.account) }), from: relayed.from }
return read(q, { why: text(object(observed.quotaReasons)[engine]) })
}
+ // What a new start can use, as its host admits it (reservations.ts): measured, less what starts still starting hold.
+ const measuredMemory = finite(resources.memoryTotalBytes) && finite(resources.memoryUsedBytes) ? resources.memoryTotalBytes - resources.memoryUsedBytes : null
+ const measuredDisk = finite(resources.projectDiskFreeBytes) ? resources.projectDiskFreeBytes : null
+ const freeMemory = measuredMemory === null ? null : measuredMemory - held.memoryBytes, freeDisk = measuredDisk === null ? null : measuredDisk - held.diskBytes
+ const setAside = (n: number) => n > 0 ? `, with ${bytes(n)} set aside for agents still starting` : ''
const blocked = [...(!fresh ? [OFFLINE] : []), ...(pool.paused ? ['New work is paused on this machine.'] : [])]
const tools = object(observed.tools)
/** Work for a project its owner does not run here: a new agent runs under the contribution, a member under its own grant. */
@@ -574,17 +603,19 @@ async function probeMachine(machineId: string, { name: machineName, status, acco
...(pool.projectUnavailable === true ? ['Its owner must add this machine to the swarm again to support other projects.'] : []),
...(pool.repositoryUnavailable === true ? ['Share a repository for this project before starting agents on this machine.'] : []),
...(pool.availableSlots === 0 ? ['This machine has no available agent slots.'] : []),
- ...(!finite(resources.projectDiskFreeBytes) || resources.projectDiskFreeBytes < needs.diskBytes ? ['The project has insufficient measured free disk.'] : []),
- ...(!finite(resources.memoryTotalBytes) || !finite(resources.memoryUsedBytes) || resources.memoryTotalBytes - resources.memoryUsedBytes < needs.memoryBytes ? ['Insufficient measured free memory.'] : []),
+ ...(freeDisk === null || freeDisk < needs.diskBytes ? [`The project has insufficient measured free disk${setAside(held.diskBytes)}.`] : []),
+ ...(freeMemory === null || freeMemory < needs.memoryBytes ? [`Insufficient measured free memory${setAside(held.memoryBytes)}.`] : []),
...needs.tools.map(t => requiredToolReason(t, tools[t], object(observed.toolProbeErrors)[t])).filter((reason): reason is string => reason !== null),
...(needs.devices.length ? ['Required devices have not been reported.'] : []),
...unready.all]
const pushNote = unready.push ? [unready.push] : []
// What the machine has, for new agents and members alike: heavy work runs on the machine whoever does it (machineFit.ts).
const load: Probe['load'] = { agents: Array.isArray(observed.runningHarnessIds) ? observed.runningHarnessIds.length : null,
- freeMemoryBytes: finite(resources.memoryTotalBytes) && finite(resources.memoryUsedBytes) ? resources.memoryTotalBytes - resources.memoryUsedBytes : null,
- hasFolder: finite(resources.projectDiskFreeBytes), freeDiskBytes: finite(resources.projectDiskFreeBytes) ? resources.projectDiskFreeBytes : null,
- cpuPercent: finite(resources.cpuPercent) ? resources.cpuPercent : null }
+ // Heavy starts stay in: the machine fit holds heavy work placed there itself (machineFit.ts placedHeavyWork, review).
+ freeMemoryBytes: measuredMemory === null ? null : measuredMemory - (held.memoryBytes - held.heavyMemoryBytes), hasFolder: finite(resources.projectDiskFreeBytes),
+ freeDiskBytes: measuredDisk === null ? null : measuredDisk - (held.diskBytes - held.heavyDiskBytes),
+ cpuPercent: finite(resources.cpuPercent) ? resources.cpuPercent : null,
+ room: { slots: finite(pool.availableSlots) ? pool.availableSlots : null, freeMemoryBytes: freeMemory, heldMemoryBytes: held.memoryBytes, freeDiskBytes: freeDisk } }
return [...members.map(m => {
const engine = String(object(m.configuration).engine), allowance = quota(engine)
const running = Array.isArray(observed.runningHarnessIds) ? observed.runningHarnessIds.includes(m.harnessId) : null