Skip to content

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

fix(install): reset cached transport on product-identity change

Steven Enamakelc95be4d39f02
diff --git a/crates/openhuman-tinyhumans/src/client/backend_client.rs b/crates/openhuman-tinyhumans/src/client/backend_client.rs
index 9a3787d421..6a2b4ab34c 100644
--- a/crates/openhuman-tinyhumans/src/client/backend_client.rs
+++ b/crates/openhuman-tinyhumans/src/client/backend_client.rs
@@ -39,6 +39,15 @@ pub fn shared_transport() -> Result<Arc<SdkBackendTransport>> {
Ok(transport)
}
+/// Drop the cached [`shared_transport`] so the next use rebuilds it. A
+/// transport captures its attribution headers once, so a product-identity
+/// change (see [`install`](crate::install)) must discard it.
+pub(crate) fn reset_shared_transport() {
+ *shared_slot()
+ .lock()
+ .unwrap_or_else(|poisoned| poisoned.into_inner()) = None;
+}
+
/// A client for authenticated hosted-backend routes.
///
/// Owns the routes and the error classification; the HTTP round-trip rides a
diff --git a/crates/openhuman-tinyhumans/src/client/mod.rs b/crates/openhuman-tinyhumans/src/client/mod.rs
index da79f545e6..d3a55ab0b4 100644
--- a/crates/openhuman-tinyhumans/src/client/mod.rs
+++ b/crates/openhuman-tinyhumans/src/client/mod.rs
@@ -23,6 +23,7 @@ pub mod enricher;
mod error;
mod integrations_http;
+pub(crate) use backend_client::reset_shared_transport;
pub use backend_client::{shared_transport, BackendClient};
pub use endpoint::{
is_managed_endpoint_for_api_key, is_safe_endpoint_for_managed_bearer,
diff --git a/crates/openhuman-tinyhumans/src/install.rs b/crates/openhuman-tinyhumans/src/install.rs
index b789dd379a..6e57dd7ae2 100644
--- a/crates/openhuman-tinyhumans/src/install.rs
+++ b/crates/openhuman-tinyhumans/src/install.rs
@@ -126,8 +126,13 @@ fn prepare(options: &InstallOptions) -> (Option<ControllerExtension>, Option<Arc
*slot()
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner()) = None;
+ // The hosted client's own transport captured the old headers too.
+ crate::client::reset_shared_transport();
}
+ // Plug every area into the core's generic registries (idempotent).
+ crate::register::register_all(options);
+
let controllers = options.hosted_controllers.then(crate::hosted::extension);
#[cfg(feature = "jev")]