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
feat(turn_models): add test module declaration
Steven Enamakel613ad694a6ed
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs b/crates/openhuman-core/src/agent/tinyagents/turn_models.rsindex 053e4b5a3f..744b73b503 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_models.rs@@ -596,3 +596,7 @@ impl TurnModelSource {Err(anyhow::anyhow!("turn model source is missing a model"))}}++#[cfg(test)]+#[path = "turn_models_tests.rs"]+mod tests;diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_models_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_models_tests.rsnew file mode 100644index 0000000000..98092567bd--- /dev/null+++ b/crates/openhuman-core/src/agent/tinyagents/turn_models_tests.rs@@ -0,0 +1,73 @@+use std::collections::HashMap;+use std::sync::Arc;++use async_trait::async_trait;+use tinyagents_harness::host::{ModelResolveRequest, ModelResolver};+use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};++use super::TurnModelResolver;++/// A stub that answers with its own name so a test can tell which model the+/// resolver handed back.+struct NamedModel(&'static str);++#[async_trait]+impl ChatModel<()> for NamedModel {+ async fn invoke(+ &self,+ _state: &(),+ _request: ModelRequest,+ ) -> tinyinference_llm::Result<ModelResponse> {+ Ok(ModelResponse::assistant(self.0))+ }+}++async fn name_of(model: &Arc<dyn ChatModel<()>>) -> String {+ model+ .invoke(&(), ModelRequest::default())+ .await+ .expect("stub model never fails")+ .text()+ .unwrap_or_default()+}++fn resolver() -> TurnModelResolver {+ let primary: Arc<dyn ChatModel<()>> = Arc::new(NamedModel("openrouter/deepseek/deepseek-v4.1-flash"));+ let mut routes: HashMap<String, Arc<dyn ChatModel<()>>> = HashMap::new();+ routes.insert("coding-v1".to_string(), Arc::new(NamedModel("coding-v1")));+ routes.insert("burst-v1".to_string(), Arc::new(NamedModel("burst-v1")));+ TurnModelResolver::new(primary, routes)+}++/// Regression for the orchestrator's `hint = "coding"` overriding the user's+/// UI model pick: the turn lead must get the selected primary even when its+/// definition pin names a built tier route.+#[tokio::test]+async fn lead_keeps_selected_primary_over_definition_pin() {+ let request = ModelResolveRequest::new("orchestrator")+ .as_team_lead()+ .with_model_pin("coding-v1");+ let model = resolver().resolve(&request).await.expect("resolves");+ assert_eq!(name_of(&model).await, "openrouter/deepseek/deepseek-v4.1-flash");+}++#[tokio::test]+async fn lead_without_pin_gets_primary() {+ let request = ModelResolveRequest::new("orchestrator").as_team_lead();+ let model = resolver().resolve(&request).await.expect("resolves");+ assert_eq!(name_of(&model).await, "openrouter/deepseek/deepseek-v4.1-flash");+}++#[tokio::test]+async fn subagent_pin_resolves_to_its_tier_route() {+ let request = ModelResolveRequest::new("integrations_agent").with_model_pin("burst-v1");+ let model = resolver().resolve(&request).await.expect("resolves");+ assert_eq!(name_of(&model).await, "burst-v1");+}++#[tokio::test]+async fn subagent_pin_without_route_falls_back_to_primary() {+ let request = ModelResolveRequest::new("worker").with_model_pin("vision-v1");+ let model = resolver().resolve(&request).await.expect("resolves");+ assert_eq!(name_of(&model).await, "openrouter/deepseek/deepseek-v4.1-flash");+}