Skip to content

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

refactor(config): centralize profile provider model resolution

Steven Enamakel9b1050f90cac
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 2ee507fe15..2ea92c58f7 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -154,12 +154,6 @@ impl OpenHumanSessionHost {
host: Option<&super::HostTools>,
session_id: Option<&str>,
) -> Result<Self> {
- let profile_config = config.profile_providers.as_ref().map(|binding| {
- let mut direct = config.clone();
- binding.apply_chat(&mut direct);
- direct
- });
- let config = profile_config.as_ref().unwrap_or(config);
let workspace_descriptor = derive_turn_workspace_descriptor();
let runtime: Arc<dyn host_runtime::RuntimeAdapter> = Arc::from(
@@ -302,14 +296,6 @@ impl OpenHumanSessionHost {
model_name = pinned_model.to_string();
}
- if let Some(model) = config
- .profile_providers
- .as_ref()
- .and_then(|binding| binding.chat_model())
- {
- model_name = model.to_owned();
- }
-
// Resolve the user-configured vision flag for the (now-final) model while
// the full `Config` / `model_registry` is in scope — the turn engine only
// sees `MultimodalConfig`. Stored on the session and surfaced to the image
diff --git a/crates/openhuman-core/src/config/schema/types/resolvers.rs b/crates/openhuman-core/src/config/schema/types/resolvers.rs
index b3eff33ca9..2262e5b005 100644
--- a/crates/openhuman-core/src/config/schema/types/resolvers.rs
+++ b/crates/openhuman-core/src/config/schema/types/resolvers.rs
@@ -74,6 +74,14 @@ impl Config {
model.map(str::trim).filter(|value| !value.is_empty())
}
+ // A hosted profile's operator-fixed model outranks every per-agent pin.
+ if let Some(model) = self
+ .profile_providers
+ .as_ref()
+ .and_then(|binding| binding.chat_model())
+ {
+ return Some(model);
+ }
let agent_id = agent_id.trim();
if agent_id.is_empty() {
return None;