Repository navigation
fix(ui): use the shared cloud catalog for status, preload and local-only - #6972
Conversation
…catalog System status and the startup preload called cloud_model_provider() with no metadata, so a cloud model GAIA only learns about at runtime counted as local: Settings offered to download or load it, and the preload tried to load it. They now use _ui_cloud_provider, as the chat helpers do.
|
Verdict: Approve with suggestions A cloud default model that GAIA only learns about at runtime (such as One related path still uses the old check, and it's worth a follow-up issue: switching Settings to Local AI only clears a saved cloud model, but it still won't recognise one of these runtime-discovered models. Settings would keep pointing at it. This PR didn't cause that, and it doesn't block the merge. Real-world evidenceN/A: no evidence bundle was produced for this run. The PR description shows a unit test that reads 🔍 Technical detailsIssues 🟡 Follow-up: "Local AI only doesn't clear a runtime-discovered cloud custom model" ( (It needs 🟢 The test resets the shared catalog to empty rather than to its previous state ( Checks
Strengths
|
From review. Turning on Local AI only cleared a cloud custom model only when its prefix gave it away, so a runtime-discovered one such as opencode.* stayed selected. It now uses _ui_cloud_provider too. The tests seed the shared catalog through a helper that restores it afterwards.
Summary
When the default chat model is a cloud model GAIA learns about at runtime, such as
opencode.*, Settings no longer treats it as a local model. Before,/api/system/statusreported it as local, so Settings › Advanced could offer to download or load it and warn about its context size, and the tray showed the local model server's state as if it mattered. The startup preload also tried to load it locally, and turning on Local AI only didn't clear it, so Settings kept pointing at a cloud model the policy forbids.Why
The review on #6926 listed these call sites. #6962 has since fixed profile inference and Retry with… using
_runs_on_this_pc. These three only need to classify the model, with no network call, so they use_ui_cloud_provider, as the chat helpers do since #6926. All three still calledcloud_model_provider(model)with no metadata, which only recognizes thefireworksandamdprefixes. The review on this PR found the Local AI only one.Still on the prefix-only check, for a follow-up: the Model server panel (
system.py, which should read the loaded entry's recipe throughis_cloud_model_entry) and the setup code (setup_runner.py,setup_plan.py).Linked issue
Refs #4784. Follows #6907, #6926 and #6962.
Test plan
Run in a
python:3.12-slimcontainer with.[ui]and the test tools installed, on currentmain:pytest tests/unit/chat/ui/test_server.py tests/unit/test_ui_warmup.py tests/unit/chat/ui/test_chat_helpers.py tests/unit/test_memory_router.py tests/unit/chat/ui/test_answer_retry.py: 577 passed, 5 skipped.pytest tests/unit/chat/ui/test_server.py tests/unit/test_ui_warmup.py: 199 passed, 3 skipped. The tests now snapshot and restore the shared catalog instead of emptying it.python util/lint.py --all: Black, isort, Flake8, Bandit and the MyPy ratchet pass. Pylint crashed in a parallel worker on my machine, and the same Pylint command passes when run alone.With the source change reverted, both new tests fail:
Evidence
Each new test registers
opencode.big-modelwithrecipe: cloudin the shared catalog, the way/modelsreports it, and sets it as the custom model./api/system/statusnow reportsdefault_model_is_cloud: true, andPUT /api/settingswithnetwork_policy: local_ai_onlynow clears it.The preload skip has no new test: it is an inner function of
create_app, and its existing tests pass. Both checks only recognize a runtime cloud model once this process has read Lemonade's model list, the same limit_ui_cloud_providerhas everywhere. Not tested against a real cloud provider./api/system/status, covered by the test above.Checklist
Closes #N/Fixes #N/Refs #N).python util/lint.py --all,pytest tests/unit/). Targeted tests only for this change.