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
test(tests): add model fixture setup to tests
Steven Enamakel63055f8c123f
diff --git a/crates/openhuman-core/src/triage/escalation_tests.rs b/crates/openhuman-core/src/triage/escalation_tests.rsindex 047c27ac91..3b7fdfd26a 100644--- a/crates/openhuman-core/src/triage/escalation_tests.rs+++ b/crates/openhuman-core/src/triage/escalation_tests.rs@@ -10,6 +10,7 @@ use tokio::time::{sleep, timeout, Duration};#[tokio::test]async fn build_triage_parent_scopes_allowed_subagents_to_target() {let dir = tempfile::tempdir().expect("tempdir");+ crate::agent::session_host::test_support::install_model_fixture();let config = Config {workspace_dir: dir.path().to_path_buf(),..Config::default()diff --git a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_tests.rsindex a87bbe1a8b..ec76f00be4 100644--- a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs+++ b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs@@ -23,6 +23,7 @@ use tinyagents_session::transcript::TranscriptMessage;use tinytools_agent::dialect::TranscriptEntry;pub(super) fn test_config(tmp: &tempfile::TempDir) -> Config {+ crate::agent::session_host::test_support::install_model_fixture();let config = Config {workspace_dir: tmp.path().join("workspace"),action_dir: tmp.path().join("workspace"),diff --git a/crates/openhuman-core/src/web_chat/session_routing_tests.rs b/crates/openhuman-core/src/web_chat/session_routing_tests.rsindex 379fd13dcc..b2dfb74f6b 100644--- a/crates/openhuman-core/src/web_chat/session_routing_tests.rs+++ b/crates/openhuman-core/src/web_chat/session_routing_tests.rs@@ -227,6 +227,7 @@ fn unknown_qualified_models_keep_the_existing_route() {fn selected_managed_route_constructs_with_the_picker_model() {// Wait out any test that has a mock chat model installed process-wide.let _serial = crate::inference::provider::factory::test_provider_override::exclusive();+ crate::agent::session_host::test_support::install_model_fixture();let config = Config::default();let selection = "openrouter/author/picked-model:free";let effective = effective_session_config(&config, Some(selection), None);@@ -324,6 +325,7 @@ fn temperature_override_is_turn_local_and_changes_the_cache_fingerprint() {/// sends no model override and the provider binding stays managed.#[test]fn persisted_managed_model_changes_invalidate_the_session_fingerprint() {+ crate::agent::session_host::test_support::install_model_fixture();let mut config = Config::default();config.chat_provider = Some("openhuman".to_string());config.default_model = Some("openrouter/author/first-model:free".to_string());diff --git a/crates/openhuman-core/src/web_chat/suggestions_tests.rs b/crates/openhuman-core/src/web_chat/suggestions_tests.rsindex 55d55e23bf..a7b4c5d900 100644--- a/crates/openhuman-core/src/web_chat/suggestions_tests.rs+++ b/crates/openhuman-core/src/web_chat/suggestions_tests.rs@@ -6,6 +6,8 @@ use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};use super::*;use crate::inference::provider::factory::test_provider_override;+use crate::inference::provider::factory::PROVIDER_OPENHUMAN;+use crate::inference::registry::{ChatModelEntry, ChatModelRequest, ProviderModelHooks};use crate::web_chat::subscribe_web_channel_events;// ── parse_suggestions / strip_markdown_fence: pure unit tests ──────────────@@ -85,6 +87,46 @@ struct ScriptedTextModel {calls: Arc<AtomicUsize>,}+fn install_suggestions_model_fixture() {+ crate::inference::registry::register_chat_model(+ PROVIDER_OPENHUMAN,+ ChatModelEntry {+ build: Arc::new(|_request: &ChatModelRequest<'_>| {+ Ok((+ Arc::new(ScriptedTextModel {+ text: "[]".to_string(),+ calls: Arc::new(AtomicUsize::new(0)),+ }) as Arc<dyn ChatModel<()>>,+ "fixture/suggestions".to_string(),+ ))+ }),+ probe: None,+ models: Some(ProviderModelHooks {+ default_model: Arc::new(|| Some("fixture/suggestions".to_string())),+ role_for_model: Arc::new(|_| None),+ is_alias: Arc::new(|_| false),+ is_raw_model: Arc::new(|_| true),+ supports_vision: Arc::new(|_| false),+ resolve_model: Arc::new(|_, config, model| {+ model+ .map(str::to_string)+ .or_else(|| config.default_model.clone())+ .or_else(|| Some("fixture/suggestions".to_string()))+ }),+ context_window: Arc::new(|_| None),+ default_pricing: Arc::new(|| None),+ without_reasoning: Arc::new(|mut request| {+ request.metadata.insert(+ "fixture.no_reasoning".to_string(),+ serde_json::Value::Bool(true),+ );+ request+ }),+ }),+ },+ );+}+#[async_trait]impl ChatModel<()> for ScriptedTextModel {async fn invoke(@@ -193,13 +235,14 @@ async fn skips_when_the_user_message_is_too_short() {#[test]fn suggestions_request_asks_for_no_reasoning() {+ install_suggestions_model_fixture();let request = build_suggestions_request("what is the weather in Paris", "Sunny, 21°C.");assert_eq!(- request.metadata.get("openhuman_reasoning_off"),+ request.metadata.get("fixture.no_reasoning"),Some(&serde_json::Value::Bool(true)),- "follow-up suggestions must opt out of reasoning"+ "suggestion calls must apply the registered provider's no-reasoning transform");- // The hint is metadata only; nothing provider-specific is set here, so a- // BYOK or local provider receives an unchanged body.+ // The generic provider hook adds metadata only, leaving provider options+ // untouched. The hosted wire key is covered by TinyHumans' own tests.assert!(request.provider_options.is_null());}