Learner chat has no model preselected unless the granted model is the admin's active model
Version: v1.7.1, same code on main.
What happens: A learner granted exactly one LLM model sees "Select model" with nothing selected in a new chat. They can start chats without choosing a model.
Cause: allowed_llm_options() (multi_user/model_access.py) sets is_active_default/active only when a granted option equals the admin catalog's active_profile_id/active_model_id. The frontend preselects only is_active_default. If the admin's active model is not in the learner's grant, nothing is preselected.
Suggested fix: when no granted option matches the admin's active model, fall back to the first granted option (or allow a per-grant default).
Tested workaround: setting the admin catalog's active LLM to the learner's granted model makes /api/settings/llm-options return active and the UI preselects it. That changes the admin's own default, though, so a fallback in allowed_llm_options() would be better:
if active is None and options:
options[0]["is_active_default"] = True
active = {"profile_id": options[0]["profile_id"], "model_id": options[0]["model_id"]}
The API-side fix from #2441 has merged into dev. I independently checked current dev (60fb3bdfd) through a running API with real password login and synthetic learner accounts:
- Grant only a model different from the admin's active model:
/api/settings/llm-optionsreturns that granted model inactive, withis_active_default: true. - Grant the admin's active model as well: it remains the selected default, even when listed second.
- Grant only a model that no longer exists:
options: [],active: null.
The admin's own default stays unchanged. I also reversed just #2441's implementation change locally: its regression tests give 1 failed / 2 passed; restoring current dev gives 3 passed.
This verifies the backend contract the picker consumes, rather than a browser/Docker test. On a build containing this fix, changing the admin's active model should no longer be needed for preselection. If it still happens there, the installed version/commit and a redacted active plus options[].is_active_default response would help distinguish stale backend code from a frontend selection problem.
Verified resolved in the released code: v1.7.2 (56cead81d2d0). Rechecked against the current local dev branch. Closing as fixed.