Skip to content

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

refactor(config): update ai provider settings migration logic

Steven Enamakel7840161cfce4
diff --git a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs
index ae36f40941..5704c047f8 100644
--- a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs
+++ b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs
@@ -120,9 +120,8 @@ fn seed_legacy_custom_provider(config: &mut Config, stats: &mut MigrationStats)
}
/// Default `primary_cloud` to the legacy custom inference entry when one was
-/// present; otherwise use the OpenHuman entry. This preserves pre-migration
-/// behavior where a configured `inference_url` handled chat instead of the
-/// hosted OpenHuman budget.
+/// present. Hosted fallback selection belongs to the installed host
+/// normalizer, which can supply its own provider identity and endpoint policy.
fn set_primary_cloud(config: &mut Config, stats: &mut MigrationStats) {
if config.primary_cloud.is_some() {
return;
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 ffcab79adc..00b9139539 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
@@ -21,23 +21,21 @@ fn make_legacy_config_local_on() -> Config {
}
#[test]
-fn empty_config_seeds_openhuman_entry() {
+fn empty_config_does_not_seed_a_hosted_entry_in_core() {
let mut c = Config::default();
let stats = run(&mut c).expect("migration must succeed");
- assert_eq!(stats.cloud_providers_seeded, 1);
- assert_eq!(c.cloud_providers.len(), 1);
- assert_eq!(c.cloud_providers[0].slug, "openhuman");
- assert!(c.cloud_providers[0].id.starts_with("p_openhuman_"));
+ assert_eq!(stats.cloud_providers_seeded, 0);
+ assert!(c.cloud_providers.is_empty());
}
#[test]
-fn primary_cloud_defaults_to_openhuman_id() {
+fn core_migration_leaves_primary_cloud_unset_without_a_hosted_entry() {
let mut c = Config::default();
let stats = run(&mut c).expect("migration must succeed");
- assert!(stats.primary_cloud_set);
- assert_eq!(c.primary_cloud, Some(c.cloud_providers[0].id.clone()));
+ assert!(!stats.primary_cloud_set);
+ assert_eq!(c.primary_cloud, None);
}
#[test]
@@ -149,7 +147,8 @@ fn idempotent_second_run_is_noop() {
assert_eq!(c.primary_cloud, primary_after_first);
// Sanity: stats from the first run say we did do work.
- assert!(first.cloud_providers_seeded >= 1);
+ assert_eq!(first.cloud_providers_seeded, 0);
+ assert!(!first.primary_cloud_set);
assert!(first.workload_fields_filled >= 1);
}
diff --git a/crates/openhuman-core/src/config/mod_tests.rs b/crates/openhuman-core/src/config/mod_tests.rs
index 6f5e286509..22082ae550 100644
--- a/crates/openhuman-core/src/config/mod_tests.rs
+++ b/crates/openhuman-core/src/config/mod_tests.rs
@@ -4,7 +4,7 @@ use super::*;
fn reexported_config_default_is_constructible() {
let config = Config::default();
- assert!(config.default_model.is_some());
+ assert_eq!(config.default_model, None);
assert!(config.default_temperature > 0.0);
}
diff --git a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
index 53557ac004..a2640a9fdb 100644
--- a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
+++ b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
@@ -336,13 +336,11 @@ fn generated_provider_ids_sanitize_and_bound_the_slug_prefix() {
}
#[test]
-fn builtin_table_is_the_upstream_catalog_plus_the_managed_route() {
+fn builtin_table_is_only_the_upstream_provider_catalog() {
use tinyinference_providers::builtin::BUILTIN_CLOUD_PROVIDERS as UPSTREAM;
let host = builtin_cloud_providers();
- assert_eq!(host.len(), UPSTREAM.len() + 1);
- assert_eq!(host[0].slug, "openhuman");
- assert_eq!(host[0].auth_style, AuthStyle::OpenhumanJwt);
- for (mapped, upstream) in host[1..].iter().zip(UPSTREAM) {
+ assert_eq!(host.len(), UPSTREAM.len());
+ for (mapped, upstream) in host.iter().zip(UPSTREAM) {
assert_eq!(mapped.slug, upstream.slug);
assert_eq!(mapped.label, upstream.label);
assert_eq!(mapped.endpoint, upstream.endpoint);
diff --git a/crates/openhuman-core/src/config/schema/identity_cost_tests.rs b/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
index 2f32568f84..452dc15e9e 100644
--- a/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
+++ b/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
@@ -5,7 +5,7 @@ fn cost_config_defaults() {
let c = CostConfig::default();
assert!(c.enabled);
assert_eq!(c.monthly_limit_usd, 100.0);
- assert!(!c.prices.is_empty());
+ assert!(c.prices.is_empty());
assert!(c.dashboard.enabled);
assert_eq!(c.dashboard.currency, "USD");
assert!((c.dashboard.warn_threshold - 0.8).abs() < f64::EPSILON);