Skip to content

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

refactor(tests): simplify model resolution logic in test support

Steven Enamakelffd65baec71f
diff --git a/crates/openhuman-core/src/agent/session_host/test_support.rs b/crates/openhuman-core/src/agent/session_host/test_support.rs
index 34cb09f5fb..34111735b4 100644
--- a/crates/openhuman-core/src/agent/session_host/test_support.rs
+++ b/crates/openhuman-core/src/agent/session_host/test_support.rs
@@ -58,21 +58,19 @@ fn model_fixture_entry() -> ChatModelEntry {
!model.starts_with("hint:") && model != "fixture-reasoning"
}),
supports_vision: Arc::new(|_| false),
- resolve_model: Arc::new(|role, 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 if role == "agentic" => Some("test/session-fixture".into()),
- None => match config.default_model.as_deref() {
- Some("fixture-reasoning") => Some("test/selected-reasoning".into()),
- Some(model) => Some(model.to_string()),
- None => Some("test/session-fixture".into()),
- },
- }
+ resolve_model: Arc::new(|role, 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 if role == "agentic" => Some("test/session-fixture".into()),
+ None => match config.default_model.as_deref() {
+ Some("fixture-reasoning") => Some("test/selected-reasoning".into()),
+ Some(model) => Some(model.to_string()),
+ None => Some("test/session-fixture".into()),
+ },
}),
context_window: Arc::new(|_| None),
default_pricing: Arc::new(|| None),
diff --git a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
index 87174bea30..1b5505faf2 100644
--- a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
@@ -14,7 +14,9 @@ async fn managed_factory_and_probe_use_the_explicit_provider_entry() {
ChatModelEntry {
build: Arc::new(move |_| {
Ok((
- Arc::new(tinyagents_harness::testkit::ScriptedModel::replies(vec![name])),
+ Arc::new(tinyagents_harness::testkit::ScriptedModel::replies(vec![
+ name,
+ ])),
name.to_string(),
))
}),