You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Console fleet totals count a starting worker's leases and devices as zero #406
src/gateway/aggregate.ts (leasesHeld, workersStats, busiestWorkers) counts a starting worker's unread leases and devices as 0. During a worker restart, the console's fleet totals can say nothing is leased while gateway-issued leases are live, and the "Leases, last hour" chart counts back from the low number (it can go negative).
Location on main: the counting is in ui/src/views/workers-model.ts:74-99 (leasesHeld, workersStats, busiestWorkers, each worker.leases?.length ?? 0), not src/gateway/aggregate.ts. Still unfixed. #421 reloads a worker's full view only after its startup ends.
Confirmed on main (5a7693b) at the console's model level, on bug/406-repro: ui/src/model/overview.test.ts — "leaves the fleet's lease and device figures and the lease chart unknown, not zero, while a connected worker is starting".
pnpm exec vitest run --project unit ui/src/model/overview.test.ts
AssertionError: expected [ [ 'Utilisation', '0' ], …(4) ] to deeply equal [ [ 'Utilisation', '—' ], …(4) ]
Given the view a starting worker's gateway actually sends (connected, health: "starting", no leases/devices/capacity — pinned by the gateway test "lists no device or lease for a worker that is starting" in src/gateway/dispatcher.test.ts), the overview claims Utilisation 0%, Leases 0 of 0, a chart drawing every minute at 0 ("Now 0"), 0 of 0 running capacity, and a 0 lease count and "No devices" on the worker's row — while three lease.granted events inside the hour, unreleased, say leases are live. A second case pins that a reporting worker beside an unread one must not make the fleet total definite either.
Root cause
Defect (console only).ui/src/model/workers.ts:41-42 (leasesHeld) and ui/src/model/overview.ts:83-101 (platformUse), :119 (row), :143-152 (tiles), :179 (chart basis) all read an absent leases/devices as 0. Absent is spec'd to mean "not known" (ADR 0005, #365: the gateway deliberately drops these fields, withoutReadFields in src/gateway/worker-registry.ts, and says "absent says 'not known', where an empty value would say 'nothing is leased'"). #365's console clause — "the console shows the daemon as starting and no device, lease or capacity view while it is" — is honored on the worker page (ui/src/model/worker-page.ts:507-527 omits those views while starting) but not on the overview, which renders the unread view as zero. Correcting the report and the 2026-10-09 status note: src/gateway/aggregate.ts is not the user-visible path; the chart cannot go negative on current main (ui/src/model/history.ts:54 clamps at 0), but it plunges to 0 and recovers; #421 only guarantees the full view returns once startup ends — the window during startup is exactly what this bug is about.
Simplest fix
One PR in ui/: in model/overview.ts, treat an absent leases/devices on a connected worker as unknown — tiles show — and the chart returns no minutes while any connected worker is unread; the worker row omits its lease count and says "Not reported" without devices; platform bars say unknown. The test pins the shape (—, empty minutes, "Not reported" — the word the worker page already uses); the maintainer may pick another unknown shape (e.g. a ≥ lower bound) and keep the reproduction's claim: totals must not name a count that treats the unknown as none. Verified: a fix doing only the tiles fails on the chart clause, one doing tiles+row fails on the slots clause; only the whole set passes.
Activity
feat(contract): status answers only health and host while the daemon …
V3RON commentedon Oct 9, 2026
Location on main: the counting is in
ui/src/views/workers-model.ts:74-99(leasesHeld,workersStats,busiestWorkers, eachworker.leases?.length ?? 0), notsrc/gateway/aggregate.ts. Still unfixed. #421 reloads a worker's full view only after its startup ends.Written by an agent.
V3RON commentedon Oct 17, 2026
Reproduction
Confirmed on
main(5a7693b) at the console's model level, onbug/406-repro:ui/src/model/overview.test.ts— "leaves the fleet's lease and device figures and the lease chart unknown, not zero, while a connected worker is starting".Given the view a starting worker's gateway actually sends (
connected,health: "starting", noleases/devices/capacity— pinned by the gateway test "lists no device or lease for a worker that is starting" insrc/gateway/dispatcher.test.ts), the overview claimsUtilisation 0%,Leases 0 of 0, a chart drawing every minute at 0 ("Now 0"),0 of 0 runningcapacity, and a0lease count and "No devices" on the worker's row — while threelease.grantedevents inside the hour, unreleased, say leases are live. A second case pins that a reporting worker beside an unread one must not make the fleet total definite either.Root cause
Defect (console only).
ui/src/model/workers.ts:41-42(leasesHeld) andui/src/model/overview.ts:83-101(platformUse),:119(row),:143-152(tiles),:179(chart basis) all read an absentleases/devicesas0. Absent is spec'd to mean "not known" (ADR 0005, #365: the gateway deliberately drops these fields,withoutReadFieldsinsrc/gateway/worker-registry.ts, and says "absent says 'not known', where an empty value would say 'nothing is leased'"). #365's console clause — "the console shows the daemon as starting and no device, lease or capacity view while it is" — is honored on the worker page (ui/src/model/worker-page.ts:507-527omits those views whilestarting) but not on the overview, which renders the unread view as zero. Correcting the report and the 2026-10-09 status note:src/gateway/aggregate.tsis not the user-visible path; the chart cannot go negative on current main (ui/src/model/history.ts:54clamps at 0), but it plunges to 0 and recovers; #421 only guarantees the full view returns once startup ends — the window during startup is exactly what this bug is about.Simplest fix
One PR in
ui/: inmodel/overview.ts, treat an absentleases/deviceson a connected worker as unknown — tiles show—and the chart returns no minutes while any connected worker is unread; the worker row omits its lease count and says "Not reported" without devices; platform bars say unknown. The test pins the shape (—, empty minutes, "Not reported" — the word the worker page already uses); the maintainer may pick another unknown shape (e.g. a≥lower bound) and keep the reproduction's claim: totals must not name a count that treats the unknown as none. Verified: a fix doing only the tiles fails on the chart clause, one doing tiles+row fails on the slots clause; only the whole set passes.Alternatives rejected
#lastLeases) — precisely what Status answers only health and host while the daemon is starting #365 removed: stale data shown as current.Risk
connected, so the unknown must key off the absent fields, nothealth/connectionalone.chartSummary).ui/changes; console lane (e2e/console/fixtures.tsalready tolerates starting views) must stay green.Written by an agent.
test: pin the overview's not-known renders; docs: say what the consol…
fix(ui): unknown overview figures name no unit and draw no bar (#406)
test(ui): trim overview test comments to the comment lint (#406)
fix(console): show fleet lease and device figures as unknown while a …
V3RON commentedon Oct 17, 2026
Delivery run
Merged: #651 (#406)
Parked: none
Waiting: none
Written by an agent.