Repository navigation
The console colours each load gauge over its own thresholds #580
Description
Why
#569 gives the Load panel's CPU, memory and disk figures each a bar, and only the memory gauge takes a colour — from the worker's own pressure word. CPU and disk stay grey whatever they show: a machine at 97% busy across twelve cores looked no different from one idling at 5%, and the operator cannot scan a worker's page and spot an overloaded host at a glance, which is the point of the bars.
The worker sends no threshold for CPU or disk (busyPercent, cores, totalBytes, availableBytes, freeBytes, limited — no level), and teaching it one is a wire change with its own protocol bump (ADR 0013, #567 is the precedent). This task does not do that. The console holds its own opinion instead, in one file, and says whose it is.
In short
ui/src/load-thresholds.ts owns the numbers and the comparison. LOAD_THRESHOLDS = { warnPercent: 85, errorPercent: 95 }; levelOf(percent) answers a tone: error at or over 95, warn at or over 85, idle below, idle for a figure the reading does not carry. No earlier readings, no hold, no state carried between renders — the verdict is the current reading's, by decision, not by oversight: a hold needs history, history lives with the sampler in the daemon, and a page reload would otherwise change the verdict. The trade is accepted: a build spike colours the CPU bar for one 15-second cycle.
- CPU and disk take
levelOfof their gauge's percent. - Memory takes the worker's pressure word where it sends one (
normal/warn/critical→ ok/warn/error) — the worker's judgement of the same fact outranks ours — and falls back tolevelOfwhere it sends none, which is every Linux worker. - The colour is the bar's alone: the figures stay numbers, the card's one-line summary does not colour, and
simlock statusreports the same figures with no verdict.CONSOLE.mdandDESIGN.mdsay the rule and say it is the console's.
Done when
- Unit (
ui/src/load-thresholds.test.ts,ui/src/views/worker-detail.test.tsx): each threshold at and just below its value; order and bounds of the two numbers;undefined→ idle; the detail colours CPU and disk by the table across both edges; memory falls back at 97% and stays neutral at 6%; the pressure word wins at 50%. - Lane (
e2e/console/workers.spec.ts): the colour test answers the page's own read of/v1/workerswith the memory figures and the word set per case, and expects the same colour on a CI machine of any free-memory level — including the case where the word and the threshold disagree. Both themes. docs/CONSOLE.mdnames the numbers and says where memory's word wins;docs/internal/DESIGN.mdbounds the one place in the console where a colour says what no word does to the gauge.pnpm test:console --project=chromiumgreen.
Out of scope
- A wire or protocol change: the daemon sending a level, or thresholds reaching the worker view.
queueDepth, load history, graphs.- A CPU or disk threshold in the daemon (what this would grow into if the console's opinion earns its keep; the CLI verdicts and the agent surfaces need the daemon-side number, which the UI constants cannot give them — see the parent thread).
Activity
feat(ui): the CPU, memory and disk gauges colour over a threshold
docs: the gauge's colour is the console's, and the docs say whose
feat(ui): the CPU, memory and disk gauges colour over a threshold
docs: the gauge's colour is the console's, and the docs say whose
feat(ui): the load gauges colour over the console's own thresholds (#586