Skip to content

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

test(inference): add test for comprehensive legacy model field coverage

Steven Enamakelc26f7be920ab
diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
index 102fecd3bd..1e15331c90 100644
--- a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
@@ -25,6 +25,66 @@ fn hosted_normalizer_rewrites_legacy_tiers_and_preserves_concrete_pins() {
assert!(!normalize_config(&mut config));
}
+#[test]
+fn hosted_normalizer_covers_all_legacy_model_fields_and_preserves_non_tiers() {
+ let mut config = Config::default();
+ config.default_model = Some(" reasoning-v1 ".to_string());
+ config.orchestrator.model = Some("reasoning-quick-v1".to_string());
+ config.teams.insert(
+ "team".to_string(),
+ openhuman_embed::__host::config::schema::TeamConfig {
+ lead_model: Some("chat-v1".to_string()),
+ agent_model: Some("burst-v1".to_string()),
+ ..Default::default()
+ },
+ );
+ config.agents.insert(
+ "legacy".to_string(),
+ openhuman_embed::__host::config::schema::DelegateAgentConfig {
+ model: "coding-v1".to_string(),
+ system_prompt: None,
+ temperature: None,
+ max_depth: 3,
+ },
+ );
+ config.model_routes.push(
+ openhuman_embed::__host::config::schema::ModelRoute {
+ model: "summarization-v1".to_string(),
+ ..Default::default()
+ },
+ );
+ config.model_routes.extend([
+ openhuman_embed::__host::config::schema::ModelRoute {
+ model: "vendor/pinned".to_string(),
+ ..Default::default()
+ },
+ openhuman_embed::__host::config::schema::ModelRoute {
+ model: "hint:unknown".to_string(),
+ ..Default::default()
+ },
+ openhuman_embed::__host::config::schema::ModelRoute {
+ model: String::new(),
+ ..Default::default()
+ },
+ ]);
+
+ assert!(normalize_config(&mut config));
+ assert_eq!(config.default_model.as_deref(), Some(MODEL_MANAGED_DEFAULT));
+ assert_eq!(config.orchestrator.model.as_deref(), Some(MODEL_MANAGED_DEFAULT));
+ assert_eq!(config.teams["team"].lead_model.as_deref(), Some(MODEL_MANAGED_DEFAULT));
+ assert_eq!(config.teams["team"].agent_model.as_deref(), Some(MODEL_MANAGED_DEFAULT));
+ assert_eq!(config.agents["legacy"].model, MODEL_MANAGED_DEFAULT);
+ assert_eq!(config.model_routes[0].model, MODEL_MANAGED_DEFAULT);
+ assert_eq!(config.model_routes[1].model, "vendor/pinned");
+ assert_eq!(config.model_routes[2].model, "hint:unknown");
+ assert_eq!(config.model_routes[3].model, "");
+ assert!(!normalize_config(&mut config));
+
+ let mut absent = Config::default();
+ assert!(!normalize_config(&mut absent));
+ assert_eq!(absent.default_model, None);
+}
+
#[test]
fn managed_tier_vocabulary_maps_aliases_and_leaves_concrete_ids_raw() {
for (model, role) in [