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 identification logic

Steven Enamakel5dfe3fccdbf1
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index b37470343e..d0b1479828 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -14,11 +14,10 @@ fn provider_descriptors(config: &crate::config::Config) -> Vec<ProviderDescripto
.iter()
.map(|provider| ProviderDescriptor {
name: provider.slug.clone(),
- aliases: if provider.slug == crate::inference::provider::factory::PROVIDER_OPENHUMAN
- || crate::config::schema::cloud_providers::is_hosted_cloud_provider(
- &provider.slug,
- provider.auth_style,
- ) {
+ aliases: if crate::config::schema::cloud_providers::is_hosted_cloud_identity(
+ &provider.slug,
+ ) || crate::config::schema::cloud_providers::is_hosted_auth_style(provider.auth_style)
+ {
vec!["backend".to_string(), "openhuman-backend".to_string()]
} else {
Vec::new()
diff --git a/crates/openhuman-core/src/config/ops/primary_cloud.rs b/crates/openhuman-core/src/config/ops/primary_cloud.rs
index d77c862d4a..348aef6cef 100644
--- a/crates/openhuman-core/src/config/ops/primary_cloud.rs
+++ b/crates/openhuman-core/src/config/ops/primary_cloud.rs
@@ -1,6 +1,6 @@
//! Primary cloud-provider selection and legacy direct-inference compatibility.
-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
+use crate::config::schema::cloud_providers::CloudProviderCreds;
use crate::config::Config;
use crate::inference::provider::factory::{BYOK_INCOMPLETE_SENTINEL, PROVIDER_OPENHUMAN};
@@ -147,7 +147,8 @@ fn cloud_entry_provider_string(entry: &CloudProviderCreds, config: &Config) -> S
}
fn is_openhuman_cloud_entry(config: &Config, entry: &CloudProviderCreds) -> bool {
- crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, entry.auth_style)
+ crate::config::schema::cloud_providers::is_hosted_cloud_identity(&entry.slug)
+ || crate::config::schema::cloud_providers::is_hosted_auth_style(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 1d6c1e88b4..b397a46230 100644
--- a/crates/openhuman-core/src/config/schema/load/migrate.rs
+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs
@@ -66,7 +66,7 @@ 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::{builtin_cloud_provider, AuthStyle};
+ use super::super::cloud_providers::builtin_cloud_provider;
for entry in &mut config.cloud_providers {
if entry.label.is_empty() {
@@ -89,11 +89,8 @@ 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_cloud_provider(
- &entry.slug,
- entry.auth_style,
- )
+ crate::config::schema::cloud_providers::is_hosted_cloud_identity(&entry.slug)
+ || crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style)
|| looks_like_openhuman_provider_endpoint(&entry.endpoint)
};
diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rs
index fc964803d1..c8bb157efa 100644
--- a/crates/openhuman-core/src/core/observability.rs
+++ b/crates/openhuman-core/src/core/observability.rs
@@ -2297,10 +2297,12 @@ fn report_expected_message(kind: ExpectedErrorKind, message: &str, domain: &str,
ExpectedErrorKind::BackendErrorCodeOwned => {
// The classifier's canonical token aids triage without re-parsing
// provider-specific strings in this generic module.
- let code = crate::inference::registry::classify_backend_error(None, message)
+ let classification = crate::inference::registry::classify_backend_error(None, message);
+ let code = classification
.as_ref()
.and_then(|classification| classification.token.as_deref())
- .unwrap_or_default();
+ .unwrap_or_default()
+ .to_string();
tracing::warn!(
domain = domain,
operation = operation,
diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run.rs b/crates/openhuman-core/src/cron/scheduler/agent_run.rs
index 43d8d43b04..7c90fe24f6 100644
--- a/crates/openhuman-core/src/cron/scheduler/agent_run.rs
+++ b/crates/openhuman-core/src/cron/scheduler/agent_run.rs
@@ -122,7 +122,7 @@ pub(super) async fn run_agent_job_for_run(
agent_id = %agent_id,
workload = %workload,
error = %e,
- fallback = %fallback_model,
+ fallback = ?fallback_model,
"[cron] workload factory failed; using fallback model"
);
fallback_model.clone()
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 52cc817497..1ae9766002 100644
--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
@@ -142,10 +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_cloud_provider(
- &entry.slug,
- entry.auth_style,
- ) {
+ if crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style) {
return match crate::inference::registry::catalog(
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
) {
@@ -251,14 +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_cloud_provider(
- &entry.slug,
- style,
- ) =>
- {
- request
- }
+ AuthStyle::OpenhumanJwt => request,
AuthStyle::None => request,
};