Repository navigation
feat(ui): model picker shows real device, fit and live status - #5244
Conversation
The Agent UI's model picker offered a CPU/GPU/NPU switch no model can honour, went silently dead during a reply, named Gemma on PCs whose default is another model, and showed raw GGUF ids. Each local model now shows where it runs (Lemonade's report once loaded, its recipe's target before, with a warning when they differ), only models this PC can run are offered, a pick made mid-reply applies to the next message, and the chip names the model a new chat starts on. Settings > Model adds friendly names, a fits-this-PC badge, download size, speed measured here, a "Not available on this PC" section, and a context size choice up to the largest window that fits. The size is saved per model in config.json and used on every load; one that stops fitting is refused at load. The sidebar's "Local · model" pill opens a live status popover with Restart. Closes amd#5214, amd#5209, amd#5213, amd#4823.
…nced The source-text check still asserted Advanced's old 4K-32K presets, which this branch replaced with a size chosen in Settings > Model up to what fits.
test_cli_config reloads gaia.config, so a class imported at module load is a different object from the one load() raises, and pytest.raises missed it on CI's Linux and macOS runs.
With "Use mine", the status popover's Restart force-reloaded the model on the user's own Lemonade, and could start that server, though setup says GAIA never unloads their models. Restart now asks first and explains what it interrupts, and never starts a server GAIA doesn't run; a context-size change saves without reloading there. Before the first chat the chip said GAIA couldn't tell where chats run. The active-model view now carries the backend's answer for a new chat, so the chip says Local as soon as setup finishes. The popover's free memory no longer exceeds the pool setup reports: used plus free adds up. Also from amd#5260: downloaded models say "on disk", user-registered model ids read cleanly ("Qwen38 27B"), and the Settings nav focus follows the tab you pick, so only one looks selected. Fixes amd#5253
The status popover disabled Restart with "GAIA is answering with this model" while only the new-chat warm-up was running. The status now says why the model is busy, a warm-up or a request, and Restart's tooltip and the route's refusal word each case; a request may come from another app on the user's own Lemonade, so it no longer claims GAIA is answering.
Screen readers heard twenty buttons all called "Use" in Settings > Model.
…oud models Each turn recorded its model as stats.model for the speed list, but a kept "Retry with..." answer (amd#5241) uses that same key to name the model it was kept from, so in a merged build every answer footer claimed a retry. The speed sample is now stats.measured_model, which no other code reads. Settings > Advanced's Model server panel showed a cloud chat model as its raw routing id (fireworks.deepseek-v4p1-flash); it now shows the name, with the id in the tooltip.
Once turns record their model (amd#5244), the footer's "kept from Retry with…" label would show on every answer. A kept retry now carries retried: true and the footer keys on that.
Keeps both new Model server panel tests (cloud model names, and main's embedding-model note) and regenerates api.gen.ts / api.schemas.json from the merged backend models.
|
Verdict: Approve with suggestions This makes the model picker tell the truth: where a model actually runs, whether it fits this PC, and which model a new chat will start on. Picks made mid-reply now apply to the next message, and the context-size choice is checked against this PC's memory. The backend is careful about refusing on someone else's Lemonade, about busy models, and about saved sizes that no longer fit. Unit coverage is solid on both the Python and the UI side. I found no blocking bugs. 🟡 No screenshots on the PR for an Agent UI change. The description says the app was exercised on a Strix Halo, but no before→after images are embedded. That leaves the new Settings › Model rows, the chip and the sidebar status popover unseen by reviewers. Three test-plan items are also still open, including the headline "pick a model while GAIA is answering". Please embed Playwright screenshots of the picker and popover, and tick or explain the open items before merge. 🟢 Nits:
🔍 Technical details
|
…r loads unchecked From review on amd#5244: picking the size a model is already loaded at (including Automatic) no longer reloads it; a size change waits for the new-chat warm-up as Restart does; and a saved size is refused, with the fix, when this PC's memory can't be read, instead of loading unchecked.
|
All three nits are fixed in 2772c5f, and the description now has screenshots of Settings › Model, the picker and the status popover.
🔍 Technical details
|
The line under an answer showed developer stats ("1012ms TTFT · 68 → 510
tokens · 38.1 tok/s"), and permission prompts named internal tools
("Always allow `write_file on prompt-test.txt` in this chat", "ran
'write_file' without asking"). Now the footer reads "Answered in 40 s on
your GPU · first word in 1 s" (or "via Fireworks AI" for a cloud turn),
with the exact numbers one click away. Prompts read "Allow writing
file?" and "Always allow writing prompt-test.txt in this chat", and the
full-access notice says what ran: "Full access is on, so GAIA didn't ask
first. Writing file: prompt-test.txt".
Part of amd#5260. The suggestion-card item (cards wrapping 3 + 1) is
already fixed in amd#5240, which lays the cards out as a 2-column grid, so
this PR leaves it alone. On merges: this PR and amd#5241 both edit the
stats row under an answer, so expect a small conflict there. It also
touches the permission-request handling in the chat view next to code
that amd#5241, amd#5242, amd#5244 and amd#5245 change. It lands after v0.25.0.
## Screenshots
Footer (expanded by a click) and permission card, before → after:
| | Before | After |
|---|---|---|
| Light |

|

|
| Dark |

|

|
Footer before the click:

## Test plan
- [x] `npx vitest run`: 860 passed. `npx tsc --noEmit` is clean
- [x] `pytest` on the Agent UI, permission, stdio, shell-prompt and
agent suites plus the flagship package tests: 6798 passed. The 3
failures are tool-count checks in `hub/agents/gaia` (87 tools found vs
95 declared). Optional dependencies are missing from the local venv, and
this PR doesn't touch tool registration
- [x] `python util/lint.py --black --isort --pylint` passes
- [x] Checked in the running app, in light and dark, before and after
(screenshots above). The footer shows plain words and expands on click,
and the permission card shows no tool ids
- [ ] Reviewer: run a turn on a local model and check that the footer
names the right device. Then run one on a cloud model and check that it
says "via …"
<details>
<summary>🔍 Technical details</summary>
- Each turn's stats gain `place`, set by `_turn_place`. For a cloud
model it is the provider's name. For a local model it is the `device`
that Lemonade's `/health` reports for that model. Older messages have no
`place`, so their footer makes no claim about where they ran. The cloud
provider is resolved from the model before any Lemonade call, so a cloud
turn names it even with Lemonade stopped.
- `permission_request` gains `tool_label` (from `tool_phrase`, built on
`derive_narration`) and `always_label` (from `grant_phrase`, which uses
the same `_VERB_FORMS`). `always_scope` is unchanged because
`agent_ui_control` matches it exactly. Shell scopes get no label because
they are already the command itself.
- `GrantScope` gains an optional `subject` (the file or skill), so the
label can be worded without parsing it.
- The MCP `turn_view` footer still returns the raw numbers. Only its
docstring and the guide line about it changed.
</details>
…ter (amd#5290) The Agent UI looked developer-built: copper on cool blue-grey, 19 font sizes, labels in spaced-out monospace capitals, and buttons in three different shapes. This lands the foundation of the approved redesign (amd#1001). It brings warm gray neutrals and muted brass for actions and focus only. Inter replaces DM Sans and Space Mono. Controls are soft tinted, rise slightly on hover and settle on press, and dialogs use calm sentence-case titles. Every token keeps its name, so the open feature PRs pick up the new look without edits. With no saved theme, the app now follows the OS instead of defaulting to dark, so a light-mode user who never picked a theme opens it in light. **Decided: brass on both the Agent UI and the TUI.** This PR moves the Agent UI first. The TUI keeps copper only until amd#5291 lands a terminal-safe brass, because the light brass `#7A5A22` rounds to `#875F00` on a 256-colour terminal, which is the TUI's Warning and Selected entry. Until then the cross-surface test pins the TUI's copper on its own, and amd#5291 restores the shared-accent assertion. The commit marked `[decision pending]` predates the decision. **Stacked on amd#5266.** This branch includes amd#5266's motion commit, because its tokens are the motion base; review the commits after it. Lands after v0.25.0. | Before (`main`) | After | |---|---| |  |  | |  |  | |  |  | |  |  | **Defaulted, easy to change.** The four round-3 design questions went unanswered, so the recommended answers stand: a green tick for a finished step, neutral markers for the selected chat and current chapter, a small dark dot for an unread answer, and an icon shadow that falls only outside each shape. They apply in the follow-ups below, which own those components. ## Test plan - [ ] `npm test` in `src/gaia/apps/webui`: 899 pass, including new contrast cases for the raw brass and the switch knob on it - [ ] `npx tsc --noEmit -p .` and `npx tsc --noEmit -p visual` in `src/gaia/apps/webui` are clean - [ ] `npx vitest run` in `website/`: 236 pass - [ ] `go test ./internal/ui/theme/...` in `tui/` passes against the updated spec - [ ] `npm run test:visual` in `src/gaia/apps/webui`: 12 snapshots, six screens in light and dark, match on Windows (set `GAIA_VISUAL_CHROMIUM` to a local Chromium if `npx playwright install chromium` can't download) - [ ] `gaia chat --ui`: switch Light, Dark and Match system in Settings › General. The composer shows a brass focus ring, buttons lift on hover, the warning notice shows its icon, and Settings switches are brass when on. <details> <summary>🔍 Technical details</summary> **What moved** - `index.css` tokens: warm-gray palette in both themes; brass `--accent` (`#7A5A22` / `#D4B47E`); soft-tinted `--accent-fill`; new `--accent-solid`, `--accent-ring`, `--shadow-press`, `--ease-spring`, `--duration-spring`, `--duration-press` and `--fs-*`. The layered `--shadow-sm/md/lg` carry a light top rim. None of them is a glow, and the no-glow guard passes. - Each place that used `--accent-fill` as a solid mark moved to a role that stays visible on the new pale wash: switch tracks, native checkboxes and progress bars, the suggested permission button, and the count badges in `Sidebar.css` and `NotificationCenter.css`. - `ScheduleManager.css` redefined `.btn-primary` and `.btn-secondary` unscoped. Once its lazy chunk loaded, every button in the app changed shape. Those rules are removed. - Labels that were uppercase or monospace in stylesheets no other open PR touches are now sentence-case Inter. Paths, keys and code stay monospace. - `--bg-active` rejoins the contrast matrix. The pinned copper used to fail on it; the brass clears every floor. - The Electron mirrors (`main.cjs`, the installer dialog), `index.html` `theme-color` and `utils/theme.ts` follow the new canvas. **Visual suite** (`src/gaia/apps/webui/visual/`): `vite preview` of the production build, every `/api` call answered from fixtures, a frozen clock, animations off, and at most 50 differing pixels. An API call without a fixture fails the test by name. Baselines are Windows-only and no CI job runs the suite yet; follow-up below. **Follow-ups once these PRs merge** (each restyle goes through tokens; no code here depends on them) - amd#5242: sidebar rich rows (status, preview line, time), titles that fade instead of truncating, borderless search. - amd#5240: 28px greeting, raised suggestion cards that lift, first-run stepper. `SetupScreen.css` gets a one-line change here, outside amd#5240's hunks. - amd#5243: Memory with neutral stat figures, brass switches instead of green, and no per-tile hues. - amd#5245: live checklist with each step's time, a shimmering live step, and sans labels. - amd#5269 / amd#5266: a raised user bubble, 15px answer prose, path chips and the answer footer. - amd#5244: AdvancedSettings headings in sentence case, and warning status text with its icon. - amd#5246, amd#5241, amd#5275, amd#5283, amd#5239: side rail, queue rows, context panel, session panel and turn changes adopt the type and elevation tokens. - New behaviour, each its own PR: resizable panes, chapter bars (amd#5271), the outer-only icon shadow wrapper, and Linux baselines plus a CI job for `test:visual`. - TUI: brass that survives 256-colour rounding, re-unifying the accent (amd#5291). </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
… limit (#5270) Choosing Fireworks AI or the AMD LLM Gateway said only "Usage may incur charges", and you found out what a chat cost only after spending it. Now setup and Settings › Model show each cloud model's list price per million tokens before you pick it, from the same rate card the per-turn cost estimate reads, and a model with no known price says "price unknown", never $0. Settings › Model also shows this month's cloud spending with an optional monthly limit: it warns near the limit, and once it's reached GAIA stops before sending a chat to the cloud and says how to go on. Lands after v0.25.0. Closes #5258 - **Overlap:** #5244 also edits Settings › Model, the composer's model chip and the providers router; expect small conflicts in those files, nothing structural. #5246 estimates each turn's cost from the same `gaia.eval.bench.metering` rate card, so the price before a pick and the cost after a turn agree; this PR adds no second price table. - **Limits of the estimate:** the total counts Agent UI chats at list price without cache discounts, so it can read higher than the bill; turns that fail or are stopped before a reply aren't counted, so it can also read lower. Both are stated in Settings and the docs. The AMD LLM Gateway's prices are set by the organization that runs it, so its turns are counted apart rather than as $0; they are still stopped once the limit is reached. ## Screenshots From the running app (a throwaway GAIA home with a seeded $0.50 spend, so nothing went to a cloud provider). | Fireworks prices, before connecting | Gateway: price unknown, and why | |---|---| | <img src="https://raw.githubusercontent.com/kovtcharov/gaia/pr-5270-screenshots/prices-before-connecting.png" width="460"> | <img src="https://raw.githubusercontent.com/kovtcharov/gaia/pr-5270-screenshots/gateway-price-unknown.png" width="460"> | | Limit reached in Settings › Model | A cloud chat stopped at the limit | |---|---| | <img src="https://raw.githubusercontent.com/kovtcharov/gaia/pr-5270-screenshots/settings-limit-reached.png" width="460"> | <img src="https://raw.githubusercontent.com/kovtcharov/gaia/pr-5270-screenshots/chat-stopped-at-limit.png" width="460"> | ## Test plan - [x] `python -m pytest tests/unit/chat/ui` (1,581 passed, including the new `test_spending.py`: prices from the shared rate card, unknown prices never $0, the monthly total, the limit states, and both chat paths stopping before a cloud turn) - [x] `npx vitest run` and `npx tsc --noEmit` in `src/gaia/apps/webui` (859 passed); Electron `npx jest` in `tests/electron` (847 passed) - [x] `python util/lint.py --black --isort --flake8 --pylint` - [x] Running app (fresh GAIA home, backend on 4305): Fireworks prices shown before connecting; with $0.50 spent against a $0.50 limit, a chat on a Fireworks model is answered with the stop message and nothing is sent; Settings shows the total, the stopped state and "Allow more this month"; the gateway tab says "Price unknown" and why - [ ] A real paid Fireworks turn records its cost in the month's total (not run; the recording path is unit-tested) - [ ] Setup's cloud step shows prices before the key (covered by vitest; the running app's setup check could not run in this test setup) <details> <summary>🔍 Technical details</summary> - `src/gaia/ui/spending.py`: `price_card` / `price_list` read `gaia.eval.bench.metering.rate_card`/`RATES`; `record_turn` writes a `cloud_spend` row (new table in the chat DB, `usd` NULL when unpriced) after each streamed turn; `limit_refusal` runs right after the turn's model is resolved, in both `_stream_chat_impl` and `_get_chat_response`. A refused streamed turn is saved as the assistant's reply and closes with the normal `answer` and `done` events. - Limit and the allowed month live in the Agent UI settings table; a non-numeric saved limit is a 500 that names the fix. - New routes: `GET /api/spending`, `PUT /api/spending/limit`, `POST /api/spending/allow-month`, `GET /api/spending/prices/{provider}`. Cloud models from `GET /api/providers/{provider}/models` carry `price`. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
…ing up (amd#5317) Before: on a busy machine the Agent UI's 5 s status poll stacked a new request behind every slow one, and the banner then said the model server had stopped, or that the connection to GAIA was lost, when both were only busy. After: one status request runs at a time and the poll backs off while answers are slow. A backend that keeps answering late reads "GAIA is slow to answer". A model server that is listening but slow reads "not answering, may be busy", keeps the reason, and offers the restart command only for if it stays that way. "Stopped responding" and "Lost the connection" now mean nothing is listening. Check again shows "Checking…" until it answers. Lands after v0.25.0. Reproduced by `src/__tests__/App.statusPoll.test.tsx`: on main, 5 status requests are in flight at once, 13 probes run in 60 s against a busy server, and the busy wording never appears. All pass here. ## Test plan - [x] `npx vitest run` in `src/gaia/apps/webui`: 872 passed; `npx tsc --noEmit` clean - [x] `App.statusPoll.test.tsx` (6), `ConnectionBanner.test.tsx` and `statusPoll.test.ts`: three timeouts in a row read as slow, not lost; a 45 s answer is accepted; stopping the poll aborts the request in flight and reports nothing; Check again shows progress - [x] Live, Vite :5319 against a fake backend: with a busy model server the probes ran at 0, 11 and 32 s, and the banner read "The model server is not answering (Lemonade health query failed)... If it stays this way, restart it: ...". With 45 s status answers there was never more than one request in flight. <details> <summary>🔍 Technical details</summary> - `services/statusPoll.ts`: single-flight `check()`, a `setTimeout` chain, a 60 s `AbortSignal` per request (the status handler's sequential probes, health 10 + models 10 + catalog 5 + stats 3 + system-info 3, already exceed 30 s), backoff 5→10→20→30 s while slow. A generation counter keeps a StrictMode double start from making two chains. - "Unresponsive" is `lemonade_running: false` with `lemonade_error` set. The backend sets that for a probe timeout as well as for a non-200 answer or an `httpx.ConnectTimeout`, so the banner keeps the remedy. A backend field telling these apart, and a bound on the handler's total time, are with the UI-backend reliability session. - Outcomes: a refused request, or a 502 from a proxy or tunnel with nothing behind it, is unreachable; a 500/503 is "answered with an error"; a timeout or a gateway 504 is slow (five minutes of it is lost). - Merge note: amd#5244 removes the `setDetectedDevices` line that moved into `applyStatus`, a one-line conflict in App.tsx. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
The model picker's context-size and status routes push api.ts past the 50 KB ceiling shared with the store, types and App. It is the single client for every backend route, so it gets 64 KB; the other three stay at 50 KB.
# Conflicts: # src/gaia/apps/webui/src/types/api.gen.ts # src/gaia/apps/webui/src/types/api.schemas.json
Saving a per-model context size now goes through the same locked, atomic config write main adopted in amd#5388, so it can no longer clobber a key another GAIA process saved at the same moment, or overwrite a corrupt config.json. GaiaConfig.edit_doc does the locked read-modify-write and validates the result before writing.
|
Verdict: Request changes (one small fix) This PR makes the model picker report where each model really runs, offers only models this PC can run, adds a per-model context-size choice, and turns the sidebar pill into a live status view with Restart. The design is careful: your own Lemonade is never started or reloaded without confirmation, and a saved context size that no longer fits is refused at load with a fix. One thing needs fixing before merge.
Real-world evidenceN/A here. No evidence bundle was produced for this run. The PR description includes rendered screenshots from a Strix Halo of Settings › Model, the composer picker, and the status popover (stopped, and the Restart confirmation on your own Lemonade), which covers the Agent UI surface. Two items are still unchecked: a confirmed Restart against a live server, and picking a model mid-reply. For those, this verdict rests on the unit tests and static review. 🔍 Technical details🟡 Restart ignores a failed server start ( 🟢 "Automatic" can trigger a reload that changes nothing ( 🟢 Cloud model passed to Strengths
|
Resolving the load's context size now reads the saved per-model size, and that read takes the config file lock, whose timeout clock consumed the test's fake monotonic values. Stub the saved-size lookup so the test measures only the load.
|
Verdict: Approve with suggestions The model picker now shows where each model really runs, offers only models this PC can run, names the model a new chat actually starts on, and adds a saved per-model context size plus a live status popover with Restart. The backend is careful: a saved size that no longer fits is refused at load, not loaded into an out-of-memory crash, and GAIA never starts or silently reloads a Lemonade server the user runs themselves. Tests are thorough. One edge case is worth fixing before merge:
Real-world evidenceN/A: no evidence bundle was produced for this run. The PR description embeds screenshots from a running Strix Halo app: Settings › Model, the composer picker, the status popover in the stopped state and in the confirm-before-restart state on the user's own Lemonade, and the chip before the first chat. That covers the Agent UI surface. Three items are still unchecked in the test plan: a confirmed live Restart, the no-NPU PC, and a mid-reply model pick. For those, the verdict rests on static review and the unit and vitest coverage. 🔍 Technical details🟡 Restart ignores a warm-up when no chat model is loaded yet ( Add a test like 🟢 Corrupt config in the model list falls back quietly ( 🟢 Strengths
|
…start Restart could race the new-chat warm-up while that first load had not listed a model yet, starting a second forced load of the same model; it now refuses the same way it does once the model is listed, and the status popover disables the button then. A Restart whose server never came up returned to "stopped" with no explanation; it now shows the failure. A context-size change for a cloud model is refused before anything is written to config.json.
…upport Main's model picker (amd#5244) and default-ladder offers now sit alongside the gpt-oss fit-filtered offers. The local list offers the ladder, the configured default and the optional models that fit; an unregistered gpt-oss row carries its recipe and size so the picker can show fit and download size; and /api/providers/active stays a single /models read instead of also sizing optional models.
The Agent UI's model picker offered a CPU/GPU/NPU switch no model can honour, went silently dead while GAIA was answering, named Gemma as the active model on PCs whose default is something else, and showed raw GGUF file names. Now each model shows where it really runs (Lemonade's report once loaded, with a plain warning if a GPU model fell back to the CPU), only models this PC can run are offered, a pick made mid-reply applies to the next message, and the chip names the model a new chat actually starts on. Settings › Model adds friendly names, a "Fits this PC" badge, download size and speed measured here, plus a Context size choice up to the most that fits. The sidebar's "Local · model" pill now opens a live status: loaded / warming / stopped, device, memory used vs free, context window, and Restart. Lands after v0.25.0.
Closes #5214
Closes #5209
Closes #5213
Closes #4823
Closes #5253
context_sizesin~/.gaia/config.json) and used on every load, including the reload after an idle unload. A saved size that no longer fits is refused at load, with how to fix it (GAIA_CTX_SIZEstill overrides it). Changing it, like Restart, reloads through GAIA's normal load path with its free-memory check, and never under a reply that is still running. It replaces the 4K–32K presets in Settings › Advanced.Screenshots
From the running app on a Strix Halo (fresh GAIA home on an existing Lemonade, so no personal chats are shown).
Test plan
python -m pytest tests/unit/test_model_device_and_context.py tests/unit/chat/ui/test_model_picker_routes.py tests/unit/chat/ui/test_providers_router.pypython -m pytest tests/unit/(full suite)npx vitest runandnpx tsc --noEmitinsrc/gaia/apps/webuipython util/lint.py --all/system-infobodies and by vitest)🔍 Technical details
gaia.llm.model_devicereads/healthall_models_loaded[].deviceplus the llama-server path for a loaded model, and the recipe (llamacpp→ GPU via the default or chosen backend,flm→ NPU) before load.default_deviceno longer comes from the UI; the NPU context cap already follows the model (runs_on_npu)./system-info, ormodel_fit.check_fitagainst the model's size at its floor window. A loaded model is never hidden.gaia.llm.context_choicebuilds options frommin_ctx_sizetolargest_context;resolve_ctx_sizetakes a saved size through_chosen_ctx_sizeand skips the free-memory shrink for it (the load's own free-memory check still refuses).inference_statsnow carriesmodel; the list reports the median tokens/s over that model's last 20 turns.GET/PUT /api/providers/local/context,GET /api/providers/local/status,POST /api/providers/local/restart. Builds on fix(ui): list chat models that are also labeled audio in the model picker #5140's_is_chat_modelwithout touching it.