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
fix(inference): degrade the managed catalog gracefully when signed out
Ghost Scripterd4d45c7905fa
diff --git a/src/openhuman/inference/provider/ops/models.rs b/src/openhuman/inference/provider/ops/models.rsindex 8a321292ef..034f3f4ff1 100644--- a/src/openhuman/inference/provider/ops/models.rs+++ b/src/openhuman/inference/provider/ops/models.rs@@ -83,6 +83,7 @@ pub async fn list_configured_models_from_config(.find(|e| e.id == provider_id || e.slug == provider_id).cloned().or_else(|| synthesize_local_runtime_entry(&provider_id, config))+ .or_else(|| synthesize_managed_entry(&provider_id)).ok_or_else(|| format!("no cloud provider with id or slug '{}' found", provider_id))?;let looked_up =@@ -154,7 +155,19 @@ pub async fn list_configured_models_from_config(config,) {Ok(token) => managed_token = token,- Err(err) if api_key.is_empty() => return Err(err),+ // Signed out is not a provider failure. The managed catalog simply+ // has nothing to offer until there is a session, and the picker+ // still shows managed with its automatic routing — so return an+ // empty list rather than surfacing "could not load models".+ Err(err) if api_key.is_empty() => {+ log::info!(+ "[providers][list_models] managed catalog unavailable — no live session ({err}); returning an empty list"+ );+ return Ok(crate::rpc::RpcOutcome::new(+ serde_json::json!({ "models": Vec::<ModelInfo>::new() }),+ vec!["no live session; managed catalog is empty".to_string()],+ ));+ }Err(err) => {log::debug!("[providers][list_models] no live session ({err}); falling back to the provider-scoped key"@@ -463,6 +476,38 @@ fn json_value_kind(v: &serde_json::Value) -> &'static str {/// Returns `None` for any slug that is not a recognized local-runtime/// alias — callers continue down the normal "no cloud provider" error/// path for `openai` / `anthropic` / opaque ids / typos.+/// Synthesize the managed (`openhuman`) provider entry when `cloud_providers`+/// has no row for it.+///+/// The row is normally seeded by the `unify_ai_provider_settings` migration,+/// but it is absent in a freshly created profile — which is exactly what the+/// app falls back to when a stored session is rejected server-side. Managed is+/// the product's own backend, not user-supplied configuration, so requiring a+/// config row to list its models turned "signed out" into+/// "no cloud provider with id or slug 'openhuman' found".+///+/// Endpoint and auth style only have to identify the entry as managed: the+/// caller replaces the URL with `effective_backend_api_url` and the credential+/// with the live session token before the request goes out.+fn synthesize_managed_entry(+ slug: &str,+) -> Option<crate::openhuman::config::schema::cloud_providers::CloudProviderCreds> {+ use crate::openhuman::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};+ if slug != "openhuman" {+ return None;+ }+ Some(CloudProviderCreds {+ id: "openhuman".to_string(),+ slug: "openhuman".to_string(),+ label: "OpenHuman".to_string(),+ endpoint: crate::openhuman::config::schema::cloud_providers::CloudProviderType::Openhuman+ .default_endpoint()+ .to_string(),+ auth_style: AuthStyle::OpenhumanJwt,+ ..Default::default()+ })+}+pub fn synthesize_local_runtime_entry(slug: &str,config: &crate::openhuman::config::Config,diff --git a/src/openhuman/inference/provider/ops/models_tests.rs b/src/openhuman/inference/provider/ops/models_tests.rsindex b2d6d29d7c..13295f3100 100644--- a/src/openhuman/inference/provider/ops/models_tests.rs+++ b/src/openhuman/inference/provider/ops/models_tests.rs@@ -1,4 +1,4 @@-use super::{resolve_local_runtime_key, url_is_credential_safe};+use super::{resolve_local_runtime_key, synthesize_managed_entry, url_is_credential_safe};use crate::openhuman::config::Config;#[test]@@ -57,3 +57,26 @@ fn credentials_are_withheld_from_remote_plaintext_and_junk_urls() {assert!(!url_is_credential_safe(url), "{url}");}}++/// The managed row is normally seeded by a migration, but a freshly created+/// profile has none — which is what the app falls back to when a stored session+/// is rejected. Managed is the product's own backend, so it must not depend on a+/// user-config row; without this, being signed out surfaced+/// "no cloud provider with id or slug 'openhuman' found".+#[test]+fn managed_entry_is_synthesized_when_the_config_row_is_missing() {+ use crate::openhuman::config::schema::cloud_providers::AuthStyle;+ let entry = synthesize_managed_entry("openhuman").expect("managed entry");+ assert_eq!(entry.slug, "openhuman");+ assert_eq!(entry.auth_style, AuthStyle::OpenhumanJwt);+ assert!(!entry.endpoint.is_empty());+}++/// Only the managed slug synthesizes: anything else must keep reporting an+/// unknown provider rather than being silently treated as managed.+#[test]+fn other_slugs_do_not_synthesize_a_managed_entry() {+ for slug in ["openai", "openrouter", "ollama", "", "openhuman-x"] {+ assert!(synthesize_managed_entry(slug).is_none(), "{slug}");+ }+}