Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(managed): honour pinned default model for chat hints

Steven Enamakel0e6d4e23ef05
diff --git a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs
index 8d41945193..0ed136c7e8 100644
--- a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs
@@ -191,7 +191,12 @@ pub(super) fn resolve_managed_backend_with_model_override(
// "deepseek-v4-pro", "claude-opus-4-7") fall back to the platform default.
let model = match model.strip_prefix("hint:") {
Some("reasoning") => crate::config::MODEL_REASONING_V1.to_string(),
- Some("chat") => crate::config::MODEL_CHAT_V1.to_string(),
+ // The app's chat turn always sends `hint:chat`, so the pinned default
+ // model (Routing → "Default model") has to be honoured here, not only
+ // when `default_model` reaches this function unhinted.
+ Some("chat") => pinned_managed_default_model(config).unwrap_or_else(|| {
+ crate::config::MODEL_CHAT_V1.to_string()
+ }),
Some("agentic") => crate::config::MODEL_AGENTIC_V1.to_string(),
Some("burst") => crate::config::MODEL_BURST_V1.to_string(),
Some("coding") => crate::config::MODEL_CODING_V1.to_string(),
diff --git a/crates/openhuman-core/src/inference/provider/factory/tiers.rs b/crates/openhuman-core/src/inference/provider/factory/tiers.rs
index 4fffb0e281..9a507ee389 100644
--- a/crates/openhuman-core/src/inference/provider/factory/tiers.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/tiers.rs
@@ -80,6 +80,19 @@ pub fn resolve_model_for_hint(hint_or_tier: &str, config: &Config) -> String {
let ps = provider_string.trim();
if ps.is_empty() || ps == "cloud" || ps == PROVIDER_OPENHUMAN || ps == BYOK_INCOMPLETE_SENTINEL
{
+ // A managed chat turn runs on the pinned default model when one is
+ // set; every other tier keeps its name. Mirrors the managed backend's
+ // own `hint:chat` translation so what the UI displays is what runs.
+ if role == "chat" && tier == crate::config::MODEL_CHAT_V1 {
+ if let Some(pinned) = pinned_managed_default_model(config) {
+ log::debug!(
+ "[providers][resolve-hint] hint={} managed chat resolves to pinned default model={}",
+ hint_or_tier,
+ pinned
+ );
+ return pinned;
+ }
+ }
tier.to_string()
} else if let Some(idx) = ps.find(':') {
let model_with_temp = &ps[idx + 1..];
@@ -145,6 +158,22 @@ pub fn role_for_model_tier(hint_or_tier: &str) -> &'static str {
/// unrecognized `hint:*` value is intentionally rejected so the factory falls
/// back to the platform default instead of forwarding an untranslated string
/// to the backend.
+/// The user's pinned managed **default model** — `config.default_model` when
+/// it names a concrete catalog model (e.g. `openrouter/deepseek/deepseek-v4-flash`)
+/// rather than a managed tier or a `hint:*` marker.
+///
+/// The Routing page writes a catalog id here as the "default model": the one a
+/// managed `chat` turn runs on instead of the anonymous `chat-v1` tier. Tier
+/// names and hints are not pins — they are the pre-existing "let the backend
+/// pick" contract — so they yield `None` and the caller keeps its tier.
+pub(crate) fn pinned_managed_default_model(config: &Config) -> Option<String> {
+ let model = config.default_model.as_deref()?.trim();
+ if model.is_empty() || model.starts_with("hint:") || is_known_openhuman_tier(model) {
+ return None;
+ }
+ Some(model.to_string())
+}
+
pub(crate) fn is_known_openhuman_tier(model: &str) -> bool {
use crate::config::{
MODEL_AGENTIC_V1, MODEL_BURST_V1, MODEL_CHAT_V1, MODEL_CODING_V1, MODEL_REASONING_QUICK_V1,