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(session_host): abstract model name setting in tests
Steven Enamakelb4e0a0bc4e2f
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_model_source_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_model_source_tests.rsindex 9bdcb4faca..608ad8391f 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_model_source_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_model_source_tests.rs@@ -4,12 +4,7 @@ use std::sync::Arc;#[test]fn builder_requires_a_model_when_no_host_policy_is_installed() {let tmp = tempfile::TempDir::new().unwrap();- let config = crate::config::Config {- workspace_dir: tmp.path().join("workspace"),- action_dir: tmp.path().join("workspace"),- config_path: tmp.path().join("config.toml"),- ..crate::config::Config::default()- };+ let config = test_config_without_inference(&tmp);assert!(config.default_model.is_none());let model: Arc<dyn tinyinference_llm::model::ChatModel<()>> =Arc::new(tinyagents_harness::testkit::ScriptedModel::new(Vec::new()));diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_spec_views_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_spec_views_tests.rsindex 7c9a191b55..6f6257ce44 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_spec_views_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_spec_views_tests.rs@@ -160,13 +160,13 @@ fn dedup_keeps_the_original_allocation_of_the_winning_spec() {fn spec_views_stay_consistent_for_a_tool_less_agent() {let model: std::sync::Arc<dyn tinyinference_llm::model::ChatModel<()>> =std::sync::Arc::new(tinyagents_harness::testkit::ScriptedModel::new(Vec::new()));- let agent = crate::agent::SessionHostBuilder::new()- .chat_model(model)- .model_name("test/session-fixture".to_string())- .tools(Vec::new())- .tool_dispatcher(Box::new(tinytools_agent::dialect::XmlDialect))- .build()- .expect("a tool-less agent is a legal build");+ let agent = crate::agent::session_host::test_support::with_fixture_model_name(+ crate::agent::SessionHostBuilder::new().chat_model(model),+ )+ .tools(Vec::new())+ .tool_dispatcher(Box::new(tinytools_agent::dialect::XmlDialect))+ .build()+ .expect("a tool-less agent is a legal build");assert!(agent.tool_specs().is_empty());assert!(agent.durable_tool_specs_arc().is_empty());diff --git a/crates/openhuman-core/src/agent/session_host/test_support.rs b/crates/openhuman-core/src/agent/session_host/test_support.rsindex 337aeee6e1..965b81d79c 100644--- a/crates/openhuman-core/src/agent/session_host/test_support.rs+++ b/crates/openhuman-core/src/agent/session_host/test_support.rs@@ -18,6 +18,10 @@ impl ChatModel<()> for SessionFixtureModel {}}+pub(crate) fn with_fixture_model_name(builder: SessionHostBuilder) -> SessionHostBuilder {+ builder.model_name("test/session-fixture".to_string())+}+/// Installs an explicit generic model fixture for tests that construct a/// session through the managed-provider factory. HookSlot test registrations/// are thread-local, so each test opts in on the thread that builds its host.@@ -84,4 +88,3 @@ pub(crate) fn install_model_fixture_in(extensions: &crate::core::slots::Extensiomodel_fixture_entry(),);}-