fix: use selected_model setting key to match /model command persistence

The dispatcher was reading "preferred_model" but the /model command
(merged from staging) persists to "selected_model". Since set_setting
is already per-user scoped, using the same key makes /model work as
the per-user model override in multi-tenant mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
2026-03-23 23:11:34 -07:00
co-authored by Claude Opus 4.6
parent 8db3638a42
commit af5daca0d9
+3 -1
View File
@@ -347,10 +347,12 @@ impl<'a> LoopDelegate for ChatDelegate<'a> {
// Apply per-user model override from settings (first iteration only
// to avoid repeated DB lookups within the same agentic loop).
// Uses "selected_model" — the same key the /model command persists to
// via SettingsStore (per-user scoped).
if iteration == 0
&& let Some(store) = self.agent.store()
&& let Ok(Some(value)) = store
.get_setting(&self.message.user_id, "preferred_model")
.get_setting(&self.message.user_id, "selected_model")
.await
&& let Some(model) = value.as_str()
{