Skip to content

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

refactor(config): update cloud provider style checks

Steven Enamakel0f0755e90fa4
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 72736e9918..33de402cbc 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -15,7 +15,8 @@ fn provider_descriptors(config: &crate::config::Config) -> Vec<ProviderDescripto
.map(|provider| ProviderDescriptor {
name: provider.slug.clone(),
aliases: if provider.slug == crate::inference::provider::factory::PROVIDER_OPENHUMAN
- || crate::config::schema::cloud_providers::is_hosted_auth_style(
+ || crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &provider.slug,
provider.auth_style,
)
{
diff --git a/crates/openhuman-core/src/config/ops/primary_cloud.rs b/crates/openhuman-core/src/config/ops/primary_cloud.rs
index eb46884c6b..a6e902f6f2 100644
--- a/crates/openhuman-core/src/config/ops/primary_cloud.rs
+++ b/crates/openhuman-core/src/config/ops/primary_cloud.rs
@@ -139,13 +139,16 @@ fn cloud_entry_provider_string(entry: &CloudProviderCreds, config: &Config) -> S
.map(str::trim)
.filter(|model| !model.is_empty())
})
- .unwrap_or("");
+ .unwrap_or(BYOK_INCOMPLETE_SENTINEL);
format!("{}:{model}", entry.slug)
}
fn is_openhuman_cloud_entry(config: &Config, entry: &CloudProviderCreds) -> bool {
- crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style)
+ crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &entry.slug,
+ entry.auth_style,
+ )
|| looks_like_openhuman_backend(config, &entry.endpoint)
}
diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs
index f694ce5f00..1d6c1e88b4 100644
--- a/crates/openhuman-core/src/config/schema/load/migrate.rs
+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs
@@ -90,7 +90,10 @@ pub(crate) fn migrate_cloud_provider_slugs(config: &mut Config) {
let is_openhuman_provider_entry =
|entry: &super::super::cloud_providers::CloudProviderCreds| {
entry.slug == "openhuman"
- || crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style)
+ || crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &entry.slug,
+ entry.auth_style,
+ )
|| looks_like_openhuman_provider_endpoint(&entry.endpoint)
};
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
index 969a4aeb98..b53f7f4600 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -64,7 +64,10 @@ pub(super) fn resolve_cloud_slug<'a>(
// OpenhumanJwt entries are exempt: they always delegate to
// make_openhuman_backend which derives the model from config.default_model,
// ignoring whatever effective_model we computed here.
- let hosted = crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style);
+ let hosted = crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &entry.slug,
+ entry.auth_style,
+ );
if !hosted && effective_model.trim().is_empty() {
log::warn!(
"[providers][chat-factory] role={} slug={} resolved to empty model — \
@@ -333,7 +336,7 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(
);
}
AuthStyle::Anthropic | AuthStyle::None => {}
- style if crate::config::schema::cloud_providers::is_hosted_auth_style(style) => {
+ style if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, style) => {
#[cfg(not(test))]
if let Err(error) = verify_backend_session_active(config) {
return Some(Err(error));
diff --git a/crates/openhuman-core/src/inference/provider/factory/discovery.rs b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
index e08d624cca..1cfef09edb 100644
--- a/crates/openhuman-core/src/inference/provider/factory/discovery.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
@@ -39,7 +39,7 @@ pub(crate) fn model_limits_request(
let (slug, raw) = p.split_once(':')?;
let slug = slug.trim();
let entry = config.cloud_providers.iter().find(|e| e.slug == slug)?;
- if crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style) {
+ if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, entry.auth_style) {
let (raw_model, _) = split_model_and_temperature(raw);
let model = if raw_model.trim().is_empty() {
model
diff --git a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
index 5cdf94bb6b..67e7465f5f 100644
--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
@@ -142,7 +142,7 @@ pub async fn list_configured_models_from_config(
// An entry that authenticates with the managed session is the managed
// catalog: the registered provider lists it, and with none registered
// there is nothing to list.
- if crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style) {
+ if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, entry.auth_style) {
return match crate::inference::registry::catalog(
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
) {
@@ -248,7 +248,7 @@ pub async fn list_configured_models_from_config(
r
}
// Handled above: the managed catalog is served by the registered provider.
- style if crate::config::schema::cloud_providers::is_hosted_auth_style(style) => request,
+ style if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, style) => request,
AuthStyle::None => request,
};
diff --git a/crates/openhuman-tinyhumans/src/hosted_config.rs b/crates/openhuman-tinyhumans/src/hosted_config.rs
index 128c1febc7..22b3972aa0 100644
--- a/crates/openhuman-tinyhumans/src/hosted_config.rs
+++ b/crates/openhuman-tinyhumans/src/hosted_config.rs
@@ -14,5 +14,7 @@ pub(crate) fn register() {
auth_style: AuthStyle::OpenhumanJwt,
},
);
- register_hosted_cloud_provider_policy(Arc::new(|style| style == AuthStyle::OpenhumanJwt));
+ register_hosted_cloud_provider_policy(Arc::new(|slug, style| {
+ slug == "openhuman" || style == AuthStyle::OpenhumanJwt
+ }));
}