Skip to content

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

chore(config): add migration tests for unified ai provider settings

Steven Enamakel0a5f60f15348
diff --git a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rs b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rs
index e9b85cd586..903b26e073 100644
--- a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rs
+++ b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rs
@@ -68,15 +68,28 @@ fn legacy_inference_url_becomes_custom_entry() {
}
#[test]
-fn openhuman_inference_url_does_not_seed_custom() {
+fn managed_inference_url_does_not_seed_custom() {
let mut c = Config::default();
- c.inference_url = Some("https://api.openhuman.ai/v1".into());
+ // The installed host resolved its managed hosts onto the config.
+ c.resolved_endpoints.managed_hosts = vec![".managed.test".into()];
+ c.inference_url = Some("https://api.managed.test/v1".into());
let _ = run(&mut c).expect("migration must succeed");
// Only the openhuman entry should be seeded — no Custom entry.
assert_eq!(c.cloud_providers.len(), 1);
assert_eq!(c.cloud_providers[0].slug, "openhuman");
}
+#[test]
+fn without_managed_hosts_every_inference_url_is_custom() {
+ // With no host registered nothing is a managed endpoint, so the same URL
+ // is migrated as a user-supplied one.
+ let mut c = Config::default();
+ c.inference_url = Some("https://api.managed.test/v1".into());
+ let _ = run(&mut c).expect("migration must succeed");
+ assert_eq!(c.cloud_providers.len(), 2);
+ assert_eq!(c.cloud_providers[1].slug, "custom");
+}
+
#[test]
fn embeddings_provider_derived_from_legacy_usage() {
let mut c = make_legacy_config_local_on();
diff --git a/crates/openhuman-core/src/config/schema/load_migration_tests.rs b/crates/openhuman-core/src/config/schema/load_migration_tests.rs
index a00b7aca03..b9c8097ec1 100644
--- a/crates/openhuman-core/src/config/schema/load_migration_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load_migration_tests.rs
@@ -295,17 +295,33 @@ fn migrate_legacy_inference_url_moves_external_chat_completions() {
}
#[test]
-fn migrate_legacy_inference_url_clears_openhuman_backend_form() {
+fn migrate_legacy_inference_url_clears_managed_backend_form() {
let mut cfg = Config::default();
- cfg.api_url = Some("https://api.tinyhumans.ai/openai/v1/chat/completions".to_string());
+ cfg.resolved_endpoints.managed_hosts = vec!["api.managed.test".to_string()];
+ cfg.api_url = Some("https://api.managed.test/openai/v1/chat/completions".to_string());
cfg.inference_url = None;
migrate_legacy_inference_url(&mut cfg);
- // The OpenHuman host is the default backend — both fields end up None so
- // inference flows through the derived default `{backend}/openai/v1/...`.
+ // The managed host is the default backend — both fields end up None so
+ // inference flows through the derived default.
assert_eq!(cfg.api_url, None);
assert_eq!(cfg.inference_url, None);
}
+#[test]
+fn migrate_legacy_inference_url_keeps_a_managed_looking_url_without_managed_hosts() {
+ // With no host registered nothing is managed, so the URL is moved as an
+ // external one rather than silently dropped.
+ let mut cfg = Config::default();
+ cfg.api_url = Some("https://api.managed.test/openai/v1/chat/completions".to_string());
+ cfg.inference_url = None;
+ migrate_legacy_inference_url(&mut cfg);
+ assert_eq!(cfg.api_url, None);
+ assert_eq!(
+ cfg.inference_url.as_deref(),
+ Some("https://api.managed.test/openai/v1/chat/completions")
+ );
+}
+
#[test]
fn migrate_legacy_inference_url_is_noop_when_inference_url_set() {
let mut cfg = Config::default();
@@ -368,7 +384,7 @@ fn migrate_cloud_provider_slugs_keeps_cloud_on_openhuman_without_legacy_custom()
id: "p_oh".into(),
slug: "openhuman".into(),
label: "OpenHuman".into(),
- endpoint: "https://api.tinyhumans.ai/v1".into(),
+ endpoint: "https://api.managed.test/v1".into(),
auth_style: crate::config::schema::AuthStyle::OpenhumanJwt,
..Default::default()
}];