Skip to content

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

test(inference): update fixture backend usage in tests

Steven Enamakel36a254485577
diff --git a/crates/openhuman-core/src/inference/provider/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/http_error_tests.rs
index 8a9b91dc6d..2e2bd4a0f1 100644
--- a/crates/openhuman-core/src/inference/provider/http_error_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/http_error_tests.rs
@@ -444,21 +444,22 @@ mod provider_config_rejection_suppression {
// mean we sent it a bad request — a real regression that
// must still reach Sentry. (Mirror of the 401/403 backend
// rule.)
+ super::install_fixture_backend_classifier();
assert!(!config_rejection_demoted(
&tinyinference_llm::failure::http::classify_http_failure(
- "OpenHuman",
+ FIXTURE_BACKEND,
reqwest::StatusCode::BAD_REQUEST.as_u16(),
TIER_LEAK_BODY
),
- "OpenHuman"
+ FIXTURE_BACKEND
));
assert!(!config_rejection_demoted(
&tinyinference_llm::failure::http::classify_http_failure(
- "OpenHuman",
+ FIXTURE_BACKEND,
reqwest::StatusCode::BAD_REQUEST.as_u16(),
TEMP_BODY
),
- "OpenHuman"
+ FIXTURE_BACKEND
));
}
@@ -563,14 +564,15 @@ mod provider_config_rejection_suppression {
// and must still reach Sentry. The phrase does not appear in any
// expected backend body, so this is purely defensive.
let body = r#"{"error":"this model requires a subscription, upgrade for access: https://ollama.com/upgrade (ref: test)"}"#;
+ super::install_fixture_backend_classifier();
assert!(
!config_rejection_demoted(
&tinyinference_llm::failure::http::classify_http_failure(
- "OpenHuman",
+ FIXTURE_BACKEND,
reqwest::StatusCode::FORBIDDEN.as_u16(),
body
),
- "OpenHuman"
+ FIXTURE_BACKEND
),
"backend 403 subscription phrase must NOT be suppressed (polarity guard)"
);
diff --git a/crates/openhuman-core/src/inference/turn_models_tests.rs b/crates/openhuman-core/src/inference/turn_models_tests.rs
index 3138ba3249..72d0534124 100644
--- a/crates/openhuman-core/src/inference/turn_models_tests.rs
+++ b/crates/openhuman-core/src/inference/turn_models_tests.rs
@@ -15,6 +15,42 @@ async fn role_pins_apply_when_the_primary_uses_config_routing() {
use crate::agent::host_overrides::HostOverrides;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
let config = crate::config::Config::default();
+ let extensions = crate::core::slots::Extensions::new();
+ crate::inference::registry::register_chat_model_in(
+ &extensions,
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ crate::inference::registry::ChatModelEntry {
+ build: Arc::new(|_| {
+ Ok((
+ Arc::new(NamedModel("managed fixture")),
+ "fixture/managed-default".into(),
+ ))
+ }),
+ probe: None,
+ models: Some(crate::inference::registry::ProviderModelHooks {
+ default_model: Arc::new(|| Some("fixture/managed-default".into())),
+ role_for_model: Arc::new(|model| {
+ model
+ .strip_prefix("hint:")
+ .filter(|role| matches!(*role, "chat" | "coding" | "summarization"))
+ .map(str::to_string)
+ }),
+ is_alias: Arc::new(|model| model.starts_with("hint:")),
+ is_raw_model: Arc::new(|model| !model.starts_with("hint:")),
+ supports_vision: Arc::new(|_| false),
+ resolve_model: Arc::new(|_, config, model| {
+ model
+ .filter(|model| !model.starts_with("hint:"))
+ .map(str::to_string)
+ .or_else(|| config.default_model.clone())
+ .or_else(|| Some("fixture/managed-default".into()))
+ }),
+ context_window: Arc::new(|_| None),
+ default_pricing: Arc::new(|| None),
+ without_reasoning: Arc::new(|request| request),
+ }),
+ },
+ );
let mut overrides = HostOverrides::default();
overrides
.role_models
@@ -23,7 +59,7 @@ async fn role_pins_apply_when_the_primary_uses_config_routing() {
"summarization".into(),
Arc::new(NamedModel("pinned summary")),
);
- let root = CoreContext::for_test(DomainSet::full(), None);
+ let root = CoreContext::for_test_with_extensions(DomainSet::full(), None, extensions);
let context = root.derive_with(
ContextOverlay::new(config.clone(), DomainSet::full(), Default::default())
.host_overrides(Arc::new(overrides)),