Skip to content

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

fix(integrations): handle missing client ID in connection requests

Steven Enamakel47c44f13e771
diff --git a/crates/openhuman-core/src/integrations/client/construct.rs b/crates/openhuman-core/src/integrations/client/construct.rs
index 22acf9baea..5499d617f1 100644
--- a/crates/openhuman-core/src/integrations/client/construct.rs
+++ b/crates/openhuman-core/src/integrations/client/construct.rs
@@ -94,8 +94,9 @@ impl IntegrationClient {
/// The auth headers for a request built outside the backend transport
/// (binary download, raw DELETE): `Authorization: Bearer` for a session,
/// `x-api-key` for an API key.
- pub(crate) fn auth_headers(&self) -> reqwest::header::HeaderMap {
+ pub(crate) fn auth_headers(&self) -> anyhow::Result<reqwest::header::HeaderMap> {
crate::api::transport::credential_headers(&self.credential)
+ .map_err(|e| anyhow::anyhow!("invalid backend credential header: {e}"))
}
fn new_inner(
diff --git a/crates/openhuman-core/src/integrations/client/download.rs b/crates/openhuman-core/src/integrations/client/download.rs
index db69344634..41347a0cf5 100644
--- a/crates/openhuman-core/src/integrations/client/download.rs
+++ b/crates/openhuman-core/src/integrations/client/download.rs
@@ -70,7 +70,7 @@ impl IntegrationClient {
let resp = self
.download_client
.get(&url)
- .header("Authorization", format!("Bearer {}", self.auth_token))
+ .headers(self.auth_headers()?)
.send()
.await
.map_err(|error| Self::report_transport_error(error, "get_bytes", path, &url))?;
@@ -79,7 +79,7 @@ impl IntegrationClient {
let body_text = resp.text().await.unwrap_or_default();
let body =
serde_json::from_str(&body_text).unwrap_or(serde_json::Value::String(body_text));
- return Err(Self::map_transport_error(
+ return Err(self.map_transport_error(
BackendTransportError::Status {
status: status.as_u16(),
body,
diff --git a/crates/openhuman-core/src/integrations/client/requests.rs b/crates/openhuman-core/src/integrations/client/requests.rs
index 78ef1d6ece..f580f997f3 100644
--- a/crates/openhuman-core/src/integrations/client/requests.rs
+++ b/crates/openhuman-core/src/integrations/client/requests.rs
@@ -58,11 +58,11 @@ impl IntegrationClient {
url: &str,
) -> anyhow::Result<std::sync::Arc<dyn crate::api::transport::BackendTransport>> {
crate::api::transport::resolve_backend_transport()
- .map_err(|error| Self::map_transport_error(error, method, path, url))
+ .map_err(|error| self.map_transport_error(error, method, path, url))
}
/// Describe one `/agent-integrations/*` round-trip for the transport: the
- /// app-session JWT as bearer, no envelope unwrapping (this client parses
+ /// client's credential (session JWT as bearer, API key as `x-api-key`), no envelope unwrapping (this client parses
/// the `{success,data}` envelope itself so its error classification sees
/// the raw shape).
pub(super) fn backend_request<'a>(
@@ -129,7 +129,7 @@ impl IntegrationClient {
.transport(&method_name, path, &url)?
.send_json(self.backend_request(method, path, body))
.await
- .map_err(|error| Self::map_transport_error(error, &method_name, path, &url))?;
+ .map_err(|error| self.map_transport_error(error, &method_name, path, &url))?;
Self::parse_envelope(&method_name, path, &url, value)
}
@@ -175,7 +175,7 @@ impl IntegrationClient {
form,
)
.await
- .map_err(|error| Self::map_transport_error(error, "post_multipart", path, &url))?;
+ .map_err(|error| self.map_transport_error(error, "post_multipart", path, &url))?;
// The transport unwraps successful `{success,data}` responses. Preserve
// compatibility with endpoints that return their payload directly,
// while still recognizing a `success:false` envelope.
diff --git a/crates/openhuman-core/src/integrations/composio/client/connections.rs b/crates/openhuman-core/src/integrations/composio/client/connections.rs
index e83e63cdfc..62f2751c9f 100644
--- a/crates/openhuman-core/src/integrations/composio/client/connections.rs
+++ b/crates/openhuman-core/src/integrations/composio/client/connections.rs
@@ -157,7 +157,7 @@ impl ComposioClient {
let resp = http_client
.delete(&url)
- .header("Authorization", format!("Bearer {}", self.inner.auth_token))
+ .headers(self.inner.auth_headers()?)
.send()
.await?;