The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(tests): clean up model fixture setup in tests
Steven Enamakelda7ac9b8abcb
diff --git a/crates/openhuman-core/src/agent/session_host/test_support.rs b/crates/openhuman-core/src/agent/session_host/test_support.rsindex 40c193b854..932037d271 100644--- a/crates/openhuman-core/src/agent/session_host/test_support.rs+++ b/crates/openhuman-core/src/agent/session_host/test_support.rs@@ -24,53 +24,53 @@ impl ChatModel<()> for SessionFixtureModel {/// are thread-local, so each test opts in on the thread that builds its host.fn model_fixture_entry() -> ChatModelEntry {ChatModelEntry {- build: Arc::new(|request: ChatModelRequest<'_>| {- let model = request- .model_override- .or(request.default_model)- .or(request.config.default_model.as_deref())- .unwrap_or("test/session-fixture");- Ok((Arc::new(SessionFixtureModel), model.to_string()))+ build: Arc::new(|request: ChatModelRequest<'_>| {+ let model = request+ .model_override+ .or(request.default_model)+ .or(request.config.default_model.as_deref())+ .unwrap_or("test/session-fixture");+ Ok((Arc::new(SessionFixtureModel), model.to_string()))+ }),+ probe: None,+ models: Some(ProviderModelHooks {+ default_model: Arc::new(|| Some("test/session-fixture".into())),+ role_for_model: Arc::new(|model| {+ if model == "fixture-reasoning" {+ Some("reasoning".to_string())+ } else {+ model+ .strip_prefix("hint:")+ .filter(|role| crate::config::WORKLOAD_ROLES.contains(role))+ .map(str::to_string)+ }}),- probe: None,- models: Some(ProviderModelHooks {- default_model: Arc::new(|| Some("test/session-fixture".into())),- role_for_model: Arc::new(|model| {- if model == "fixture-reasoning" {- Some("reasoning".to_string())- } else {- model- .strip_prefix("hint:")- .filter(|role| crate::config::WORKLOAD_ROLES.contains(role))- .map(str::to_string)- }- }),- is_alias: Arc::new(|model| {- model == "fixture-reasoning"- || model+ is_alias: Arc::new(|model| {+ model == "fixture-reasoning"+ || model.strip_prefix("hint:").is_some_and(|role| crate::config::WORKLOAD_ROLES.contains(&role))- }),- is_raw_model: Arc::new(|model| {- !model.starts_with("hint:") && model != "fixture-reasoning"- }),- supports_vision: Arc::new(|_| false),- resolve_model: Arc::new(|_, config, model| match model {- Some("fixture-reasoning") => Some("test/selected-reasoning".to_string()),- Some(model) if !model.starts_with("hint:") => Some(model.to_string()),- Some(model) => model- .strip_prefix("hint:")- .filter(|role| crate::config::WORKLOAD_ROLES.contains(role))- .map(|_| "test/session-fixture".to_string()),- None => config- .default_model- .clone()- .or_else(|| Some("test/session-fixture".into())),- }),- context_window: Arc::new(|_| None),- default_pricing: Arc::new(|| None),- without_reasoning: Arc::new(|request| request),}),+ is_raw_model: Arc::new(|model| {+ !model.starts_with("hint:") && model != "fixture-reasoning"+ }),+ supports_vision: Arc::new(|_| false),+ resolve_model: Arc::new(|_, config, model| match model {+ Some("fixture-reasoning") => Some("test/selected-reasoning".to_string()),+ Some(model) if !model.starts_with("hint:") => Some(model.to_string()),+ Some(model) => model+ .strip_prefix("hint:")+ .filter(|role| crate::config::WORKLOAD_ROLES.contains(role))+ .map(|_| "test/session-fixture".to_string()),+ None => config+ .default_model+ .clone()+ .or_else(|| Some("test/session-fixture".into())),+ }),+ context_window: Arc::new(|_| None),+ default_pricing: Arc::new(|| None),+ without_reasoning: Arc::new(|request| request),+ }),}}diff --git a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rsindex 83d4beb7b1..484d3268b2 100644--- a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs@@ -43,13 +43,9 @@ impl HostAgentResolver for Host {.unwrap();definition.id = agent_id.to_string();let builds = Arc::clone(&self.belt_builds);- let context = CoreContext::for_test(- DomainSet::full(),- Some(self.config.workspace_dir.clone()),- );- crate::agent::session_host::test_support::install_model_fixture_in(- context.extensions(),- );+ let context =+ CoreContext::for_test(DomainSet::full(), Some(self.config.workspace_dir.clone()));+ crate::agent::session_host::test_support::install_model_fixture_in(context.extensions());Some(HostAgent {definition,config: self.config.clone(),diff --git a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rsindex 99cce81462..787354b13f 100644--- a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs+++ b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs@@ -440,7 +440,10 @@ async fn preflight_invoker_gates_the_mock_tool_path() {fn harness_model_default_override_preserves_unowned_model_ids() {// Bare hosted model aliases are interpreted only when TinyHumans has// registered its provider policy. Bare core preserves arbitrary IDs.- assert_eq!(harness_model_default_override("reasoning-v1"), "reasoning-v1");+ assert_eq!(+ harness_model_default_override("reasoning-v1"),+ "reasoning-v1"+ );assert_eq!(harness_model_default_override("chat-v1"), "chat-v1");crate::agent::session_host::test_support::install_model_fixture();assert_eq!(