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
refactor(config): retire legacy cloud provider type field
Steven Enamakel436734ef6284
diff --git a/crates/openhuman-core/src/config/migrations/README.md b/crates/openhuman-core/src/config/migrations/README.mdindex 0085152a4f..89bd837939 100644--- a/crates/openhuman-core/src/config/migrations/README.md+++ b/crates/openhuman-core/src/config/migrations/README.md@@ -65,7 +65,7 @@ Does not own a `store.rs`. Its effects are written through other layers:## Dependencies-- `crate::config` (`Config`, `HttpRequestConfig`, `schema::cloud_providers::{CloudProviderCreds, AuthStyle, CloudProviderType, generate_provider_id}`, `schema::LlmBackend`, `MODEL_CHAT_V1`, `MODEL_REASONING_V1`, `MODEL_REASONING_QUICK_V1`): the migrations read and mutate the config struct; `schema_version` is the gating field.+- `crate::config` (`Config`, `HttpRequestConfig`, `schema::cloud_providers::{CloudProviderCreds, AuthStyle, builtin_cloud_provider, generate_provider_id}`, `schema::LlmBackend`, `MODEL_CHAT_V1`, `MODEL_REASONING_V1`, `MODEL_REASONING_QUICK_V1`): the migrations read and mutate the config struct; `schema_version` is the gating field.- `tinyagents_session::transcript` (`transcript`, `SessionTranscript`, `write_transcript`): `phase_out_profile_md` parses and rewrites persisted session transcripts byte-compatibly.- `crate::inference::provider::factory`: `reconcile_orphaned_providers` mirrors the factory's exact, case-sensitive provider-string grammar so "resolvable here" matches "resolvable at inference time"; `unify_ai_provider_settings` references the factory's provider-string format.- `crate::inference::host_runtime::ollama_base_url_from_config`: the runner's Ollama reachability probe for the 6→7 step. That step and the 9→10 step mirror, by hand, the provider-string grammar of `embeddings::factory::create_embedding_provider` and `voice::factory::create_stt_provider` respectively (doc-linked, not imported), so keep them in sync when those factories change.diff --git a/crates/openhuman-core/src/config/migrations/mod.rs b/crates/openhuman-core/src/config/migrations/mod.rsindex a6bf7ea7f6..d9cdda640f 100644--- a/crates/openhuman-core/src/config/migrations/mod.rs+++ b/crates/openhuman-core/src/config/migrations/mod.rs@@ -32,12 +32,13 @@ mod reconcile_orphaned_providers;mod remove_write_auto_approve;mod repair_http_request_limits;mod retire_chat_v1_model;+pub(crate) mod retire_cloud_provider_type;mod retire_local_whisper_stt;mod retire_managed_tier_slugs;mod unify_ai_provider_settings;/// Current target schema version. Bumped alongside every new migration.-pub const CURRENT_SCHEMA_VERSION: u32 = 13;+pub const CURRENT_SCHEMA_VERSION: u32 = 14;/// Give a brand-new [`Config`] the managed `openhuman` cloud-provider entry.///@@ -650,6 +651,15 @@ pub async fn run_pending(config: &mut Config) {}}}+ // 13 -> 14: persist provider discriminators normalized before typed decode.+ // Saves also retain the provider-native default_model used by BYOK routing.+ if config.schema_version == 13 {+ config.schema_version = 14;+ if let Err(err) = config.save().await {+ config.schema_version = 13;+ log::warn!("[migrations] schema_version 14 save failed: {err:#}");+ }+ }}#[cfg(test)]diff --git a/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type.rs b/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type.rsindex f565abae59..8e56b2d68c 100644--- a/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type.rs+++ b/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type.rs@@ -8,19 +8,30 @@ use crate::config::schema::cloud_providers::builtin_cloud_provider;// keep until v0.66 (review after 2027-01-11): removal requires a documented// pre-schema-14 upgrade/import boundary, including offline workspace imports.pub(crate) fn rewrite_document(document: &mut toml::Value) -> anyhow::Result<()> {- let version = document.get("schema_version").and_then(toml::Value::as_integer).unwrap_or(0);+ let version = document+ .get("schema_version")+ .and_then(toml::Value::as_integer)+ .unwrap_or(0);if version >= 14 {return Ok(());}- let Some(providers) = document.get_mut("cloud_providers").and_then(toml::Value::as_array_mut) else {+ let Some(providers) = document+ .get_mut("cloud_providers")+ .and_then(toml::Value::as_array_mut)+ else {return Ok(());};for (index, value) in providers.iter_mut().enumerate() {- let Some(entry) = value.as_table_mut() else { continue; };- let Some(discriminator) = entry.remove("type") else { continue; };- let kind = discriminator.as_str().ok_or_else(|| anyhow::anyhow!(- "cloud_providers[{index}].type: expected a string"- ))?.trim();+ let Some(entry) = value.as_table_mut() else {+ continue;+ };+ let Some(discriminator) = entry.remove("type") else {+ continue;+ };+ let kind = discriminator+ .as_str()+ .ok_or_else(|| anyhow::anyhow!("cloud_providers[{index}].type: expected a string"))?+ .trim();let builtin = builtin_cloud_provider(kind);for (field, default) in [("slug", kind),@@ -28,7 +39,9 @@ pub(crate) fn rewrite_document(document: &mut toml::Value) -> anyhow::Result<()>("endpoint", builtin.map(|p| p.endpoint).unwrap_or("")),] {match entry.get(field) {- None => { entry.insert(field.into(), toml::Value::String(default.into())); }+ None => {+ entry.insert(field.into(), toml::Value::String(default.into()));+ }Some(toml::Value::String(current)) if current.is_empty() => {entry.insert(field.into(), toml::Value::String(default.into()));}@@ -37,14 +50,22 @@ pub(crate) fn rewrite_document(document: &mut toml::Value) -> anyhow::Result<()>}if !entry.contains_key("auth_style") {if let Some(provider) = builtin {- entry.insert("auth_style".into(), toml::Value::String(- match provider.auth_style {- crate::config::schema::cloud_providers::AuthStyle::Bearer => "bearer",- crate::config::schema::cloud_providers::AuthStyle::Anthropic => "anthropic",- crate::config::schema::cloud_providers::AuthStyle::OpenhumanJwt => "openhuman_jwt",- crate::config::schema::cloud_providers::AuthStyle::None => "none",- }.into()- ));+ entry.insert(+ "auth_style".into(),+ toml::Value::String(+ match provider.auth_style {+ crate::config::schema::cloud_providers::AuthStyle::Bearer => "bearer",+ crate::config::schema::cloud_providers::AuthStyle::Anthropic => {+ "anthropic"+ }+ crate::config::schema::cloud_providers::AuthStyle::OpenhumanJwt => {+ "openhuman_jwt"+ }+ crate::config::schema::cloud_providers::AuthStyle::None => "none",+ }+ .into(),+ ),+ );}}}diff --git a/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type_tests.rs b/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type_tests.rsindex 2fd7aa2f0a..f51260bdd2 100644--- a/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type_tests.rs+++ b/crates/openhuman-core/src/config/migrations/retire_cloud_provider_type_tests.rs@@ -2,7 +2,8 @@ use super::*;#[test]fn migration_preserves_explicit_values_and_unknown_provider_models() {- let mut document: toml::Value = toml::from_str(r#"+ let mut document: toml::Value = toml::from_str(+ r#"schema_version = 13[[cloud_providers]]type = "anthropic"@@ -14,14 +15,22 @@ default_model = "claude-sonnet-4"[[cloud_providers]]type = " custom-provider "default_model = "custom-model"-"#).unwrap();+"#,+ )+ .unwrap();rewrite_document(&mut document).unwrap();let providers = document["cloud_providers"].as_array().unwrap();assert_eq!(providers[0]["slug"].as_str(), Some("chosen"));assert_eq!(providers[0]["label"].as_str(), Some("Chosen Label"));- assert_eq!(providers[0]["endpoint"].as_str(), Some("https://proxy.example/v1"));+ assert_eq!(+ providers[0]["endpoint"].as_str(),+ Some("https://proxy.example/v1")+ );assert_eq!(providers[0]["auth_style"].as_str(), Some("bearer"));- assert_eq!(providers[0]["default_model"].as_str(), Some("claude-sonnet-4"));+ assert_eq!(+ providers[0]["default_model"].as_str(),+ Some("claude-sonnet-4")+ );assert_eq!(providers[1]["slug"].as_str(), Some("custom-provider"));assert_eq!(providers[1]["label"].as_str(), Some("Custom"));assert_eq!(providers[1]["default_model"].as_str(), Some("custom-model"));@@ -40,7 +49,8 @@ fn malformed_discriminator_is_not_silently_discarded() {#[test]fn current_schema_does_not_reapply_the_decoder_migration() {- let mut document: toml::Value = toml::from_str("schema_version = 14\n[[cloud_providers]]\ntype = \"old\"").unwrap();+ let mut document: toml::Value =+ toml::from_str("schema_version = 14\n[[cloud_providers]]\ntype = \"old\"").unwrap();let before = document.clone();rewrite_document(&mut document).unwrap();assert_eq!(document, before);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.rsindex 220cefc3cd..fca31dc045 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@@ -42,7 +42,7 @@//! URL doesn't look like the OpenHuman backend.use crate::config::schema::cloud_providers::{- generate_provider_id, AuthStyle, CloudProviderCreds, CloudProviderType,+ builtin_cloud_provider, generate_provider_id, AuthStyle, CloudProviderCreds,};use crate::config::Config;@@ -93,7 +93,12 @@ pub(super) fn seed_cloud_providers(config: &mut Config, stats: &mut MigrationSta.api_url.clone().filter(|s| !s.trim().is_empty())- .unwrap_or_else(|| CloudProviderType::Openhuman.default_endpoint().to_string());+ .unwrap_or_else(|| {+ builtin_cloud_provider("openhuman")+ .expect("managed builtin")+ .endpoint+ .to_string()+ });let oh_default_model = config.default_model.clone()@@ -183,7 +188,7 @@ fn set_primary_cloud(config: &mut Config, stats: &mut MigrationStats) {let oh = config.cloud_providers.iter()- .find(|e| e.slug == "openhuman" || e.legacy_type.as_deref() == Some("openhuman"));+ .find(|e| e.slug == "openhuman");if let Some(entry) = oh {config.primary_cloud = Some(entry.id.clone());stats.primary_cloud_set = true;diff --git a/crates/openhuman-core/src/config/ops/model.rs b/crates/openhuman-core/src/config/ops/model.rsindex c7a9663a63..a0bf801f8d 100644--- a/crates/openhuman-core/src/config/ops/model.rs+++ b/crates/openhuman-core/src/config/ops/model.rs@@ -214,7 +214,6 @@ fn complete_byok_route(config: &mut Config, explicit: &ExplicitRolePins) {label: "Custom inference endpoint".to_string(),endpoint: endpoint.clone(),auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: Some(model.clone()),});BYOK_INFERENCE_SLUG.to_string()diff --git a/crates/openhuman-core/src/config/ops/model_byok_tests.rs b/crates/openhuman-core/src/config/ops/model_byok_tests.rsindex 2faa1f3c51..4b20383637 100644--- a/crates/openhuman-core/src/config/ops/model_byok_tests.rs+++ b/crates/openhuman-core/src/config/ops/model_byok_tests.rs@@ -35,7 +35,6 @@ fn entry(slug: &str, endpoint: &str) -> CloudProviderCreds {label: slug.to_string(),endpoint: endpoint.to_string(),auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: None,}}diff --git a/crates/openhuman-core/src/config/schema/cloud_providers.rs b/crates/openhuman-core/src/config/schema/cloud_providers.rsindex 0d77e9da2b..a0b05b0923 100644--- a/crates/openhuman-core/src/config/schema/cloud_providers.rs+++ b/crates/openhuman-core/src/config/schema/cloud_providers.rs@@ -6,8 +6,7 @@//! resolves workload-to-provider strings against this list at runtime using//! the grammar `"<slug>:<model>"`.//!-//! Legacy configs that use `type`/`default_model` are migrated in-memory on-//! load via `migrate_legacy_fields()`.+//! Legacy provider discriminators are decoded by the schema-14 config migration.use schemars::JsonSchema;use serde::{Deserialize, Serialize};@@ -353,11 +352,6 @@ impl AuthStyle {/// entries). The factory looks up the token at call time via/// `inference::provider::factory::auth_key_for_slug`.///-/// ## Back-compat-///-/// Old configs may have `type` and `default_model` fields. These are-/// tolerated on read (via `legacy_type` / `default_model`) but never written.-/// Call `migrate_legacy_fields()` after deserialising.#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]#[serde(default)]pub struct CloudProviderCreds {@@ -376,14 +370,10 @@ pub struct CloudProviderCreds {/// Authentication header style.pub auth_style: AuthStyle,- // ── Back-compat: old `type` field ───────────────────────────────────────- /// Legacy discriminator written by older builds. Read-only; never emitted.- #[serde(rename = "type", default, skip_serializing)]- pub legacy_type: Option<String>,-- // ── Back-compat: old `default_model` field ──────────────────────────────- /// Legacy default model written by older builds. Read-only; never emitted.- #[serde(default, skip_serializing)]+ /// Default provider-native model used by BYOK routes without a model suffix.+ // keep until v0.66 (review after 2027-01-11): active BYOK routes and the+ // inference settings RPC depend on this field; replacement needs route migration.+ #[serde(default, skip_serializing_if = "Option::is_none")]pub default_model: Option<String>,}@@ -395,7 +385,6 @@ impl Default for CloudProviderCreds {label: String::new(),endpoint: String::new(),auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: None,}}@@ -420,70 +409,6 @@ pub fn is_slug_reserved(s: &str) -> bool {matches!(s.trim(), "" | "cloud" | "openhuman" | "pid")}-/// Apply legacy field migration in-place.-///-/// Idempotent: only fills in empty fields from the legacy `type`/`default_model`-/// values. Safe to call on already-migrated entries.-pub fn migrate_legacy_fields(entry: &mut CloudProviderCreds) {- let legacy_type = entry.legacy_type.clone().unwrap_or_default();- let lt = legacy_type.trim();-- // Slug from legacy type when missing.- if entry.slug.is_empty() && !lt.is_empty() {- entry.slug = lt.to_string();- log::debug!(- "[config][cloud_providers] migrated slug from legacy type='{}' id={}",- lt,- entry.id- );- }-- // Label from static map when missing.- if entry.label.is_empty() {- entry.label = legacy_label_for(if entry.slug.is_empty() {- lt- } else {- &entry.slug- })- .to_string();- log::debug!(- "[config][cloud_providers] migrated label='{}' for slug='{}' id={}",- entry.label,- entry.slug,- entry.id- );- }-- // Endpoint from legacy defaults when missing.- if entry.endpoint.is_empty() {- let ep = legacy_default_endpoint(lt);- if !ep.is_empty() {- entry.endpoint = ep.to_string();- }- }-- // Auth style from legacy type when still at default Bearer.- if entry.auth_style == AuthStyle::Bearer {- if let Some(provider) = builtin_cloud_provider(lt) {- entry.auth_style = provider.auth_style;- }- }-}--/// Map a legacy type string (or slug) to a human-readable label.-fn legacy_label_for(type_str: &str) -> &'static str {- builtin_cloud_provider(type_str)- .map(|provider| provider.label)- .unwrap_or("Custom")-}--/// Map a legacy type string to its well-known default endpoint.-fn legacy_default_endpoint(type_str: &str) -> &'static str {- builtin_cloud_provider(type_str)- .map(|provider| provider.endpoint)- .unwrap_or("")-}-/// Generate a short opaque id for a new provider entry.////// Format: `"p_<slug>_<5 random alphanumerics>"`, e.g. `"p_openai_a8c3f"`.@@ -522,72 +447,6 @@ pub fn generate_provider_id(slug: &str) -> String {format!("p_{}_{}", safe_slug, suffix)}-// ── Back-compat type alias ──────────────────────────────────────────────────-// Kept so existing code that imports `CloudProviderType` compiles without-// sweeping changes. New code should use `AuthStyle` directly.--/// Legacy discriminator enum. **Deprecated**: use `AuthStyle` on new entries.-/// Retained only to satisfy callers that still pattern-match on-/// `CloudProviderType` (e.g. the migration module). Will be removed once all-/// call sites are updated to slug-keyed lookups.-#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]-#[serde(rename_all = "lowercase")]-pub enum CloudProviderType {- Openhuman,- Openai,- Anthropic,- Openrouter,- Orcarouter,- Custom,-}--impl CloudProviderType {- /// Well-known default base URL for each provider type.- pub fn default_endpoint(&self) -> &'static str {- match self {- Self::Openhuman => "https://api.openhuman.ai/v1",- Self::Openai => "https://api.openai.com/v1",- Self::Anthropic => "https://api.anthropic.com/v1",- Self::Openrouter => "https://openrouter.ai/api/v1",- Self::Orcarouter => "https://api.orcarouter.ai/v1",- Self::Custom => "",- }- }-- /// Human-readable label used in logs and error messages.- pub fn label(&self) -> &'static str {- match self {- Self::Openhuman => "OpenHuman",- Self::Openai => "OpenAI",- Self::Anthropic => "Anthropic",- Self::Openrouter => "OpenRouter",- Self::Orcarouter => "OrcaRouter",- Self::Custom => "Custom",- }- }-- /// Lowercase wire-format string (matches JSON serialisation).- pub fn as_str(&self) -> &'static str {- match self {- Self::Openhuman => "openhuman",- Self::Openai => "openai",- Self::Anthropic => "anthropic",- Self::Openrouter => "openrouter",- Self::Orcarouter => "orcarouter",- Self::Custom => "custom",- }- }-- /// Corresponding `AuthStyle`.- pub fn auth_style(&self) -> AuthStyle {- match self {- Self::Openhuman => AuthStyle::OpenhumanJwt,- Self::Anthropic => AuthStyle::Anthropic,- _ => AuthStyle::Bearer,- }- }-}-#[cfg(test)]#[path = "cloud_providers_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rsindex b3ad190fc2..e381790b28 100644--- a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs+++ b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs@@ -2,8 +2,8 @@use super::{builtin_cloud_supports_responses_api, endpoint_host, endpoint_host_is_chat_completions_only,- host_is_builtin_cloud_provider, is_builtin_cloud_slug, is_slug_reserved, migrate_legacy_fields,- AuthStyle, CloudProviderCreds, CloudProviderType, BUILTIN_CLOUD_PROVIDERS,+ host_is_builtin_cloud_provider, is_builtin_cloud_slug, is_slug_reserved, AuthStyle,+ BUILTIN_CLOUD_PROVIDERS,};#[test]@@ -65,13 +65,7 @@ fn builtin_cloud_provider_defaults_cover_phase_one_presets() {AuthStyle::Bearer,),] {- let mut entry = CloudProviderCreds {- id: format!("p_{slug}"),- legacy_type: Some(slug.to_string()),- ..Default::default()- };- migrate_legacy_fields(&mut entry);-+ let entry = super::builtin_cloud_provider(slug).expect("builtin preset");assert_eq!(entry.slug, slug);assert_eq!(entry.label, label);assert_eq!(entry.endpoint, endpoint);@@ -263,7 +257,7 @@ fn host_gate_agrees_with_slug_capability_for_every_builtin() {}#[test]-fn auth_styles_and_legacy_provider_types_expose_stable_wire_properties() {+fn auth_styles_expose_stable_wire_properties() {let styles = [(AuthStyle::Bearer, "bearer"),(AuthStyle::Anthropic, "anthropic"),@@ -273,90 +267,6 @@ fn auth_styles_and_legacy_provider_types_expose_stable_wire_properties() {for (style, expected) in styles {assert_eq!(style.as_str(), expected);}-- let types = [- (- CloudProviderType::Openhuman,- "https://api.openhuman.ai/v1",- "OpenHuman",- "openhuman",- AuthStyle::OpenhumanJwt,- ),- (- CloudProviderType::Openai,- "https://api.openai.com/v1",- "OpenAI",- "openai",- AuthStyle::Bearer,- ),- (- CloudProviderType::Anthropic,- "https://api.anthropic.com/v1",- "Anthropic",- "anthropic",- AuthStyle::Anthropic,- ),- (- CloudProviderType::Openrouter,- "https://openrouter.ai/api/v1",- "OpenRouter",- "openrouter",- AuthStyle::Bearer,- ),- (- CloudProviderType::Orcarouter,- "https://api.orcarouter.ai/v1",- "OrcaRouter",- "orcarouter",- AuthStyle::Bearer,- ),- (- CloudProviderType::Custom,- "",- "Custom",- "custom",- AuthStyle::Bearer,- ),- ];- for (provider, endpoint, label, slug, auth) in types {- assert_eq!(provider.default_endpoint(), endpoint);- assert_eq!(provider.label(), label);- assert_eq!(provider.as_str(), slug);- assert_eq!(provider.auth_style(), auth);- }-}--#[test]-fn migration_is_idempotent_and_unknown_types_remain_custom() {- let mut custom = CloudProviderCreds {- id: "custom-id".into(),- legacy_type: Some("my-provider".into()),- ..Default::default()- };- migrate_legacy_fields(&mut custom);- assert_eq!(custom.slug, "my-provider");- assert_eq!(custom.label, "Custom");- assert!(custom.endpoint.is_empty());- assert_eq!(custom.auth_style, AuthStyle::Bearer);-- let once = custom.clone();- migrate_legacy_fields(&mut custom);- assert_eq!(custom, once);-- let mut preserved = CloudProviderCreds {- id: "preserved".into(),- slug: "chosen".into(),- label: "Chosen Label".into(),- endpoint: "https://proxy.example/v1".into(),- auth_style: AuthStyle::None,- legacy_type: Some("openai".into()),- default_model: Some("legacy-model".into()),- };- migrate_legacy_fields(&mut preserved);- assert_eq!(preserved.slug, "chosen");- assert_eq!(preserved.label, "Chosen Label");- assert_eq!(preserved.endpoint, "https://proxy.example/v1");- assert_eq!(preserved.auth_style, AuthStyle::None);}#[test]diff --git a/crates/openhuman-core/src/config/schema/ephemeral_route.rs b/crates/openhuman-core/src/config/schema/ephemeral_route.rsindex 311ddab324..cb595f9168 100644--- a/crates/openhuman-core/src/config/schema/ephemeral_route.rs+++ b/crates/openhuman-core/src/config/schema/ephemeral_route.rs@@ -131,7 +131,6 @@ pub fn apply(config: &mut crate::config::Config, route: EphemeralRoute) {label: "Per-call route".to_string(),endpoint: route.endpoint.clone(),auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: Some(model.clone()),});diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rsindex 6d073e25f1..48b05aea7d 100644--- a/crates/openhuman-core/src/config/schema/load/migrate.rs+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs@@ -63,10 +63,15 @@ pub fn redact_url_for_log(raw: &str) -> String {/// untouched. Routing fields that already contain a `:` are assumed to be/// in the new `<slug>:<model>` form.pub(crate) fn migrate_cloud_provider_slugs(config: &mut Config) {- use super::super::cloud_providers::{migrate_legacy_fields, AuthStyle};+ use super::super::cloud_providers::{builtin_cloud_provider, AuthStyle};for entry in &mut config.cloud_providers {- migrate_legacy_fields(entry);+ if entry.label.is_empty() {+ entry.label = builtin_cloud_provider(&entry.slug)+ .map(|provider| provider.label)+ .unwrap_or("Custom")+ .to_string();+ }}let slug_to_id: std::collections::HashMap<String, String> = configdiff --git a/crates/openhuman-core/src/config/schema/load/parse.rs b/crates/openhuman-core/src/config/schema/load/parse.rsindex b812a9630b..9f1693d41c 100644--- a/crates/openhuman-core/src/config/schema/load/parse.rs+++ b/crates/openhuman-core/src/config/schema/load/parse.rs@@ -13,7 +13,8 @@ use crate::config::Config;/// Parse a `config.toml` document into a [`Config`].#[inline(never)]pub(crate) fn config_from_toml_str(contents: &str) -> anyhow::Result<Config> {- let document: toml::Value = toml::from_str(contents)?;+ let mut document: toml::Value = toml::from_str(contents)?;+ crate::config::migrations::retire_cloud_provider_type::rewrite_document(&mut document)?;reject_non_finite_floats(&document, &mut String::new())?;let json = serde_json::to_value(document)?;serde_path_to_error::deserialize(json).map_err(|err| {diff --git a/crates/openhuman-core/src/inference/provider/ops/models/local_runtime.rs b/crates/openhuman-core/src/inference/provider/ops/models/local_runtime.rsindex 017927d0ea..5a17533a5e 100644--- a/crates/openhuman-core/src/inference/provider/ops/models/local_runtime.rs+++ b/crates/openhuman-core/src/inference/provider/ops/models/local_runtime.rs@@ -53,7 +53,6 @@ pub fn synthesize_local_runtime_entry(// header — `lookup_key_for_slug` may still return a key, but// `AuthStyle::None` ignores it (see auth-style match below).auth_style: AuthStyle::None,- legacy_type: None,default_model: None,})}diff --git a/crates/openhuman-core/src/inference/provider/ops/models/managed_provider.rs b/crates/openhuman-core/src/inference/provider/ops/models/managed_provider.rsindex 46276d8499..bf9b662403 100644--- a/crates/openhuman-core/src/inference/provider/ops/models/managed_provider.rs+++ b/crates/openhuman-core/src/inference/provider/ops/models/managed_provider.rs@@ -29,8 +29,9 @@ pub(super) fn synthesize_managed_entry(id: "openhuman".to_string(),slug: "openhuman".to_string(),label: "OpenHuman".to_string(),- endpoint: crate::config::schema::cloud_providers::CloudProviderType::Openhuman- .default_endpoint()+ endpoint: crate::config::schema::cloud_providers::builtin_cloud_provider("openhuman")+ .expect("managed builtin")+ .endpoint.to_string(),auth_style: AuthStyle::OpenhumanJwt,..Default::default()diff --git a/crates/openhuman-core/src/inference/provider/ops/models_tests.rs b/crates/openhuman-core/src/inference/provider/ops/models_tests.rsindex 74c93c1392..42874e035a 100644--- a/crates/openhuman-core/src/inference/provider/ops/models_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops/models_tests.rs@@ -196,7 +196,6 @@ fn workspace_with_provider(label: slug.to_string(),endpoint: endpoint.to_string(),auth_style,- legacy_type: None,default_model: None,});configdiff --git a/crates/openhuman-core/src/inference/provider/ops_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests.rsindex 75145384b9..dff71dede4 100644--- a/crates/openhuman-core/src/inference/provider/ops_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops_tests.rs@@ -118,7 +118,6 @@ async fn configure_openrouter_workspace(tmp: &TempDir, endpoint: String, token:label: "OpenRouter".to_string(),endpoint,auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: None,});config.save().await.expect("save config");@@ -184,7 +183,6 @@ async fn configure_generic_workspace(tmp: &TempDir, endpoint: String) -> Configlabel: "Generic".to_string(),endpoint,auth_style: AuthStyle::None,- legacy_type: None,default_model: None,});config.save().await.expect("save config");diff --git a/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rsindex c60c36e801..867b8dfc4e 100644--- a/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs@@ -16,7 +16,6 @@ fn list_configured_models_accepts_slug() {label: "OpenAI".to_string(),endpoint: "https://api.openai.com/v1".to_string(),auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: None,});@@ -47,7 +46,6 @@ fn openrouter_detection_matches_builtin_slug_or_host() {label: slug.to_string(),endpoint: endpoint.to_string(),auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: None,};diff --git a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rsindex 6622f4dc39..809881cd99 100644--- a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs@@ -403,7 +403,6 @@ fn cloud_providers_entry_takes_precedence_over_local_runtime_synthesis() {label: "Remote Ollama".to_string(),endpoint: "https://ollama.example.com/v1".to_string(),auth_style: AuthStyle::Bearer,- legacy_type: None,default_model: None,});diff --git a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs b/crates/openhuman-core/src/inference/schemas/settings_handlers.rsindex 91db3a10af..ceae43afe9 100644--- a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs+++ b/crates/openhuman-core/src/inference/schemas/settings_handlers.rs@@ -33,6 +33,8 @@ pub(super) struct InferenceCloudProviderUpdate {auth_style: Option<String>,#[serde(default)]ca_cert_pem: Option<String>,+ // keep until v0.66 (review after 2027-01-11): incoming RPC discriminator+ // remains accepted until shipped-client parameter coverage exists.#[serde(rename = "type", default)]legacy_type: Option<String>,#[serde(default)]@@ -145,7 +147,7 @@ pub(super) fn handle_inference_update_model_settings(.cloud_providers.map(|entries| {use crate::config::schema::cloud_providers::{- generate_provider_id, is_slug_reserved, migrate_legacy_fields, AuthStyle,+ generate_provider_id, is_slug_reserved, builtin_cloud_provider, AuthStyle,CloudProviderCreds,};let reserved_count = entries@@ -181,10 +183,14 @@ pub(super) fn handle_inference_update_model_settings(if slug.is_empty() {return Err("cloud provider slug must not be empty".to_string());}+ let legacy_auth = entry.legacy_type.as_deref()+ .and_then(builtin_cloud_provider)+ .map(|provider| provider.auth_style.as_str())+ .unwrap_or("bearer");let auth_style = match entry.auth_style.as_deref()- .unwrap_or("bearer")+ .unwrap_or(legacy_auth).to_ascii_lowercase().as_str(){@@ -207,16 +213,14 @@ pub(super) fn handle_inference_update_model_settings(.label.filter(|s| !s.trim().is_empty()).unwrap_or_else(|| slug.clone());- let mut provider = CloudProviderCreds {+ let provider = CloudProviderCreds {id,slug,label,endpoint: entry.endpoint,auth_style,- legacy_type: entry.legacy_type,default_model: entry.default_model,};- migrate_legacy_fields(&mut provider);Ok(provider)}).collect::<Result<Vec<_>, String>>()