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): a failed credential lookup no longer echoes its error to the user
M3gA-Mind37d2f176890c
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex e29d4a46e0..846587e144 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@ -224,17 +224,13 @@ pub(super) fn resolve_cloud_slug_with_access<'a>(// invoke. Its hosted construction callback is config-only and offline.(String::new(), false, None)} else if credential_access == CredentialAccess::Inspection {- let credential =- super::credentials::lookup_key_for_slug_read_only(slug, config).map_err(|error| {- anyhow::anyhow!("{} (underlying error: {error})", missing_credentials())- })?;+ let credential = super::credentials::lookup_key_for_slug_read_only(slug, config)+ .map_err(|_| anyhow::anyhow!("{}", missing_credentials()))?;(credential.key, credential.is_oauth, credential.account_id)} else {let key = credential_access.lookup_key_for_slug(slug, config)- .map_err(|error| {- anyhow::anyhow!("{} (underlying error: {error})", missing_credentials())- })?;+ .map_err(|_| anyhow::anyhow!("{}", missing_credentials()))?;let is_oauth = slug == "openai" && credential_access.openai_bearer_is_oauth(config);(key, is_oauth, None)};diff --git a/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rs b/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rsindex 62150f782d..2655c83516 100644--- a/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rs@@ -214,6 +214,41 @@ fn a_readable_profile_with_no_stored_key_is_treated_as_missing_credentials() {);}+#[test]+fn a_failed_credential_lookup_does_not_echo_its_underlying_error() {+ // The lookup error can carry stored-credential content, so the user-facing+ // error is the guidance alone; the routing shape goes to the log. The+ // read-only (doctor) lookup fails on an unreadable profile store.+ let _guard = crate::inference::inference_test_guard();+ let tmp = TempDir::new().expect("tempdir");+ let mut config = config_with_providers_in_tempdir(&tmp, vec![openai_entry("p_oai", "openai")]);+ config.chat_provider = Some("openai:gpt-4o".to_string());+ std::fs::write(+ tmp.path().join("auth-profiles.json"),+ "{ not json sk-leak-marker",+ )+ .expect("corrupt profile store");++ let err = match super::super::inspection::create_chat_model_with_model_id_in_for_inspection(+ &crate::core::runtime::DispatchCtx::ambient(),+ "chat",+ &config,+ 0.0,+ ) {+ Ok(_) => panic!("an unreadable credential store must not build a client"),+ Err(err) => err,+ };+ let message = err.to_string();+ assert!(+ message.contains("No usable credentials for 'openai'"),+ "expected the actionable guidance, got: {message}"+ );+ assert!(+ !message.contains("underlying error") && !message.contains("leak-marker"),+ "the lookup error leaked into the user-facing message: {message}"+ );+}+#[test]fn implicit_cloud_fallback_is_claimed_only_when_the_role_has_no_route_of_its_own() {let mut config = Config::default();