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
feat(hosted): check for backend transport before constructing client
Steven Enamakel0b7fd4321cd9
diff --git a/crates/openhuman-tinyhumans/src/hosted/client.rs b/crates/openhuman-tinyhumans/src/hosted/client.rsindex c5443eb687..e1588b6733 100644--- a/crates/openhuman-tinyhumans/src/hosted/client.rs+++ b/crates/openhuman-tinyhumans/src/hosted/client.rs@@ -33,6 +33,7 @@ use openhuman_core::backend::transport::{resolve_backend_transport, TransportProuse openhuman_core::config::Config;use openhuman_core::core::observability::{contains_transient_transport_phrase, is_transient_http_status_code, API_KEY_REJECTED_PREFIX,+ BACKEND_UNAVAILABLE_PREFIX,};use openhuman_core::security::credentials::session_support::{resolve_backend_credential, BackendCredential,@@ -66,6 +67,10 @@ impl HostedClient {let credential = resolve_backend_credential(config).inspect_err(|err| {log::debug!("{LOG_PREFIX} no usable backend credential; skipping request: {err}");})?;+ resolve_backend_transport().map_err(|_| {+ log::debug!("{LOG_PREFIX} no backend transport installed; skipping request");+ format!("{BACKEND_UNAVAILABLE_PREFIX} no backend transport installed")+ })?;let base_url = backend_origin(&effective_backend_api_url(&config.api_url))?;Ok(Self::with_credential(&base_url, credential))}diff --git a/crates/openhuman-tinyhumans/src/hosted/client_tests.rs b/crates/openhuman-tinyhumans/src/hosted/client_tests.rsindex bdd06157ad..dcf4eb4160 100644--- a/crates/openhuman-tinyhumans/src/hosted/client_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted/client_tests.rs@@ -149,6 +149,15 @@ fn missing_credential_fails_before_any_request() {assert!(HostedClient::from_config(&config).is_err());}+#[test]+fn stored_session_cannot_bypass_missing_backend_transport() {+ let tmp = TempDir::new().unwrap();+ let config = test_config(&tmp, "http://127.0.0.1:9");+ store_session(&config, "jwt.a.b");+ let err = HostedClient::from_config(&config).err().expect("transport required");+ assert!(err.starts_with("BACKEND_UNAVAILABLE:"), "{err}");+}+#[tokio::test]async fn session_client_sends_bearer_and_product_identity() {let server = MockServer::start().await;@@ -167,7 +176,10 @@ async fn session_client_sends_bearer_and_product_identity() {let tmp = TempDir::new().unwrap();let config = test_config(&tmp, &server.uri());store_session(&config, "jwt.a.b");- let client = HostedClient::from_config(&config).unwrap();+ let client = HostedClient::with_credential(+ &server.uri(),+ BackendCredential::Session("jwt.a.b".into()),+ );assert_eq!(client.kind(), CredentialKind::Session);let value = client.finish_value(