Skip to content

fix(ui): warm the model the user set as Custom model ID - #7271

Merged
kovtcharov-amd merged 4 commits into
amd:mainfrom
kovtcharov:kalin/rc18-warmup-model
Nov 12, 2026
Merged

kovtcharov-amd merged 4 commits into
amd:mainfrom
kovtcharov:kalin/rc18-warmup-model

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

A custom model typed in Settings > Advanced was never seen by the flagship's
start-up warm-up, which loaded the remembered model instead: the local Gemma
on a cloud-only setup with no remembered model, or an older cloud pick when
one was saved. The next launch then also restored that older pick over the
custom model. Saving a custom model now makes it the remembered model, so
start-up warms and restores the model chats run on.

The sidecar warms resolve_chat_model() (last_model, then default_model, then
Gemma) from config.json, while the custom model lived only in the Agent UI's
database. PUT /api/settings now writes custom_model to last_model and
last_provider the way the model menu does, clears both with it, and fails the
save when config.json can't be written.

Closes #7217

Test plan

  • python -m pytest tests/unit/chat/ui (3534 pass; 2 new tests fail on main) and the flagship warm-up tests
  • Rebuilt app: set a cloud Custom model ID, restart, and check the agent log warms that model

A custom model typed in Settings > Advanced was never seen by the flagship's
start-up warm-up, which loaded the remembered model instead: the local Gemma
on a cloud-only setup with no remembered model, or an older cloud pick when
one was saved. The next launch then also restored that older pick over the
custom model. Saving a custom model now makes it the remembered model, so
start-up warms and restores the model chats run on.

The sidecar warms resolve_chat_model() (last_model, then default_model, then
Gemma) from config.json, while the custom model lived only in the Agent UI's
database. PUT /api/settings now writes custom_model to last_model and
last_provider the way the model menu does, clears both with it, and fails the
save when config.json can't be written.

Closes amd#7217
@github-actions github-actions Bot added documentation Documentation changes cli CLI changes tests Test changes labels Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

Saving a model in Settings > Advanced > Custom model ID now also makes it the remembered model. Start-up warms that model, and the next launch restores it instead of an older pick. The fix is small, follows what the model menu already does, and fails the save with an error if the config file can't be written. The unit tests cover set, clear, omit and the write failure.

  • Add proof from the real app before merging. The test plan's manual check ("rebuilt app: set a cloud Custom model ID, restart, check the agent log warms that model") is still unticked, and the PR shows no real request and response for the settings save. Tick that check and paste the agent-log line, or add the request and response.

Real-world evidence

N/A: no evidence bundle was produced for this run. The verdict rests on reading the code and the PR's unit tests. The settings save and the start-up warm-up were not run here.

🔍 Technical details

Issues

🟡 No real-world evidence for a changed HTTP route (src/gaia/ui/routers/system.py:1128). PUT /api/settings now writes last_model / last_provider, but the PR has no request and response and no agent-log proof of the warm-up. The manual item in the test plan covers exactly this. Tick it with the log line before merge.

🟢 The settings path skips two things the model menu does (system.py:1128 vs providers.py:1352-1393). select_model refuses a cloud model when Local only is on (409), and it resets _restore_result. The settings path does neither. So with Local only on, a typed fireworks.* id is now saved as last_model / last_provider=fireworks, and a stale "Couldn't restore your last model" notice can stay up after the user fixes it here. The Local-only gap existed for custom_model already, but this PR now persists it across launches. Consider applying the same cloud_blocked() guard and resetting _restore_result, or factoring the shared "remember this model" step out of select_model.

🟢 The PR body says Closes #7217 twice.

Checked, no issue

  • Ordering: the config write happens before db.set_setting, so a failed write leaves both stores unchanged. The read-only test confirms this.
  • Docs: cli.mdx, ai-providers.mdx and the agent-ui SDK page are all updated. The SDK page now correctly says null leaves the value unchanged, which matches the handler's docstring. A grep for other custom_model claims in docs/ found nothing stale (the only hits are the release notes, which are historical).
  • provider_of gives the same last_provider the model menu writes, so the TUI and the Agent UI's restore read a consistent pair.

Strengths

  • The fix reuses the existing config contract (save_keys, provider_of) rather than adding a second way to remember a model.
  • It fails loudly on an unwritable config, with a test proving the old model is kept.
  • The tests assert the outcome that matters, that resolve_chat_model() returns the custom model, not just that a write was called.

…estore notice

Saving the Custom model ID now remembers it across launches, so it has to
follow the model menu's rules: a cloud model is refused while Local only is
on, and a pick made now clears a stale "couldn't restore" notice. Both
routes share one helper for each.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Saving a Custom model ID now follows the same rules as the model menu: a cloud model is refused while Local only is on, and saving a model clears a stale "Couldn't restore your last model" notice. Both routes share one helper for each rule, so they can't drift apart.

  • Two new tests cover these cases (a 409 that leaves the remembered model and the custom model untouched, and the cleared notice). Both failed before the fix.
  • The Agent UI SDK page now notes the 409 under Local only.
  • The duplicate Closes #7217 is removed from the description.
  • Not done: the rebuilt-app check (set a cloud Custom model ID, restart, read the warm-up line in the agent log). It needs the packaged app and a running model server, which I couldn't use here, so that item stays unticked for a maintainer.

Merged current main. The server, providers and Local-only tests pass (484).

A cloud model from a provider GAIA has no tab for, saved as Custom model ID, showed "Couldn't restore your last model ... no longer listed" at every start although the chip was right and the model answered. It now restores silently, and stays off with the Local only reason when Local only is on.

The restore check looked for it in the local list, which leaves cloud entries out. A miss there now asks the model server's own list whether the id is a cloud model, through the same record the rest of the UI classifies by.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Round 2 of the release test found a regression from this fix: a cloud model from another cloud provider (one GAIA has no tab for), saved as Custom model ID, showed "Couldn't restore your last model … no longer listed" at every start, although the chip was right and the model answered.

The new commit makes the start-up check ask the model server's own list before giving up, so that model restores silently. With Local only on it stays off, with the Local only reason.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 12, 2026
Merged via the queue into amd:main with commit 059546a Nov 12, 2026
39 of 43 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/rc18-warmup-model branch November 12, 2026 07:41
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Nov 12, 2026
Both fixes are on main now, so the memory-inference and warm-up cells pass
and their expected-failure lines go, as the strict marker requires. The two
scheduled-run cells (amd#7329) are the ones left.
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Nov 12, 2026
…d#7331)

In rc18 a cloud-only user had a 5 GB local model downloaded and loaded
without being asked: by the start-up warm-up, by Memory > Run Inference,
and by a scheduled run. Each bug fired only from one starting state, and
every existing test started from a PC that was already set up, with the
client mocked. This adds a matrix that crosses five starting states with
three entry points, runs each against the installer journeys' stand-in
Lemonade over real HTTP, and asserts what actually reached that server.

A new starting state or entry point is one row; every combination is
then covered, and a combination with no rule is an error.

| | start-up warm-up | Memory > Run Inference | scheduled run |
|---|---|---|---|
| cloud model as `default_model` | ✅ | ✅ | ✅ |
| cloud model picked in the app | ✅ | ✅ (amd#7270) | ❌ **new: amd#7329** |
| cloud model as Custom model ID | ✅ (amd#7271) | ✅ | ❌ **new: amd#7329** |
| empty cache | ✅ | ✅ (amd#7270) | not asserted |
| local model on disk (control) | ✅ | ✅ | ✅ |

The two ❌ cells are strict expected failures naming the issue, so the
fix has to delete its line. Three more cells failed when this PR opened
(amd#7217, amd#7218); their fixes, amd#7270 and amd#7271, merged since, the strict
markers tripped as designed, and those lines are gone.

**New bug it found:** amd#7184 made `gaia schedule run` honour
`default_model`, but a cloud model picked in the desktop app is saved
elsewhere, so a scheduled run for that user still loads (and downloads)
local Gemma. Filed as amd#7329.

## Test plan

- [ ] `python -m pytest tests/unit/test_starting_state_matrix.py -q`
reports 14 passed, 2 xfailed
- [ ] Delete a line from `KNOWN_BUGS` and the failure prints the
requests the server saw, ending in `POST /api/v1/load
Gemma-4-E4B-it-GGUF`
- [ ] Runs in the unit job; the warm-up column needs the flagship
package, so it skips there and runs in `test_gaia_agent.yml`, which now
names this file

<details>
<summary>🔍 Technical details</summary>

- `tests/fixtures/fake_lemonade.py` starts
`installer/headless/fake_model_server.py` (the server the setup and
installer journeys already use) and reads its request log into `pulls`,
`loads`, `chats` and `downloads`. No second fake server. A load or chat
asked of a model that is not downloaded counts as a download, because
real Lemonade fetches it by itself.
- The matrix pins installed memory to 128 GB, because the warm-up is
skipped on a small PC and a CI runner would hide the bug, and stubs the
PC scan so profile inference never reads the machine it runs on.
- Not covered here: what the setup and model screens *say* from these
states (F1, F6, F43). Those are assertions on API payloads, not on
server requests.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI changes documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Startup can load the local Gemma on a cloud-only setup with a custom model

2 participants