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: report connector bus failures once without changing provider messages
Steven Enamakela1aed472b322
diff --git a/crates/openhuman-core/src/core/observability_availability.rs b/crates/openhuman-core/src/core/observability_availability.rsindex 3e27c8f611..ba022a0dfe 100644--- a/crates/openhuman-core/src/core/observability_availability.rs+++ b/crates/openhuman-core/src/core/observability_availability.rs@@ -56,11 +56,32 @@ pub fn is_backend_unavailable_message(msg: &str) -> bool {/// - `the memory module failed to load` — the memory facade's rendering of the/// same cached failure.///+/// Connector presentation strings also identify already-reported bus failures;+/// they retain their established wording without an internal marker.+////// A bare `could not be loaded` is deliberately not enough: config, update/// policy and workflows use it for failures that must keep paging.pub fn is_module_unavailable_message(msg: &str) -> bool {let lower = msg.to_ascii_lowercase();- msg.contains("MODULE_CALL_REPORTED:")+ // Connector provider errors preserve their established product wording.+ // Recognize only Composio provenance; a generic Execute failure can belong+ // to another module whose adapter has not migrated to this reporting path.+ let connector_output = msg.starts_with("[composio:error:")+ || msg.starts_with("Composio v3 ")+ || msg.starts_with("Failed to decode Composio v3 ")+ || [+ tinyconnectors_bus::names::methods::LIST_CONNECTIONS_DIRECT,+ tinyconnectors_bus::names::methods::LIST_TOOLS_DIRECT,+ ]+ .iter()+ .any(|member| {+ msg.strip_prefix(member)+ .is_some_and(|tail| tail.starts_with(": ai.tinyhumans.tinybus.Error.Failed: "))+ })+ || (msg.starts_with("[composio] ")+ && msg.contains(": ai.tinyhumans.tinybus.Error.Failed: "));+ connector_output+ || msg.contains("MODULE_CALL_REPORTED:")|| msg.contains(crate::tools::status::MODULE_FAULT_MARKER)|| (lower.contains("module '") && lower.contains("could not be loaded"))|| (lower.contains("module '")diff --git a/crates/openhuman-core/src/core/observability_error_classification_user_state_tests.rs b/crates/openhuman-core/src/core/observability_error_classification_user_state_tests.rsindex 376b26933f..06a6b55641 100644--- a/crates/openhuman-core/src/core/observability_error_classification_user_state_tests.rs+++ b/crates/openhuman-core/src/core/observability_error_classification_user_state_tests.rs@@ -703,3 +703,23 @@ fn unrelated_could_not_be_loaded_errors_still_reach_sentry() {);}}++#[test]+fn connector_provider_output_is_already_reported_without_affecting_other_modules() {+ for message in [+ "[composio:error:auth] reconnect the provider",+ "Composio v3 connected_accounts failed: HTTP 401: Invalid API key",+ "ListConnectionsDirect: ai.tinyhumans.tinybus.Error.Failed: Composio v3 connected_accounts failed: HTTP 401: Invalid API key",+ ] {+ assert_eq!(expected_error_kind(message), Some(ExpectedErrorKind::ModuleUnavailable));+ }+ for message in [+ "Execute: ai.tinyhumans.tinybus.Error.Failed: private module failure",+ "unrelated operation mentioned [composio:error:auth] in its payload",+ ] {+ assert_ne!(+ expected_error_kind(message),+ Some(ExpectedErrorKind::ModuleUnavailable)+ );+ }+}diff --git a/crates/openhuman-core/src/integrations/composio/ops/error_utils.rs b/crates/openhuman-core/src/integrations/composio/ops/error_utils.rsindex e138c1bda3..9d58ef7fef 100644--- a/crates/openhuman-core/src/integrations/composio/ops/error_utils.rs+++ b/crates/openhuman-core/src/integrations/composio/ops/error_utils.rs@@ -119,27 +119,28 @@ pub(crate) fn backend_mode_without_session(config: &Config) -> bool {}}-/// Defense-in-depth Sentry funnel for composio op-layer errors.+/// Report host-side Composio faults without provider content or credentials.///-/// The shared [`crate::integrations::IntegrationClient`]-/// (which fronts every `client.list_*` / `client.execute_tool` /-/// `client.authorize` call) already reports its own failures under-/// `domain="integrations"` with `failure="non_2xx" | "transport"` tags,-/// and the Sentry `before_send` filter (`is_transient_integrations_failure`)-/// drops the transient subset. This helper re-classifies the same-/// anyhow chain at the **op layer** under `domain="composio"` so:-///-/// 1. Future call sites that bypass `IntegrationClient` still funnel through-/// the same classifier.-/// 2. Op-layer-specific failures get tagged consistently rather than-/// reaching Sentry as bare `Err(String)` returned via RPC.+/// Module failures have already emitted a sanitized terminal event at the bus+/// boundary. Recognize their established wire/presentation forms rather than+/// modifying user-visible messages or reporting them again. Host failures keep+/// only the existing failure/status classification and a static message.pub(crate) fn report_composio_op_error<E: std::fmt::Display + ?Sized>(operation: &str, err: &E) {let rendered = format!("{err:#}");+ let reported_member = tinyconnectors_bus::METHODS.iter().any(|member| {+ rendered+ .strip_prefix(member)+ .is_some_and(|tail| tail.starts_with(": ai.tinyhumans.tinybus.Error.Failed: "))+ });+ if reported_member || crate::core::observability::is_module_unavailable_message(&rendered) {+ // Bus failures are reported once, with sanitized module metadata.+ return;+ }let failure_tag = classify_composio_failure_tag(rendered.as_str());if failure_tag == "non_2xx" {if let Some(status) = extract_backend_returned_status(&rendered) {crate::core::observability::report_error_or_expected(- rendered.as_str(),+ "connector operation failed","composio",operation,&[("failure", failure_tag), ("status", status.as_str())],@@ -148,7 +149,7 @@ pub(crate) fn report_composio_op_error<E: std::fmt::Display + ?Sized>(operation:}}crate::core::observability::report_error_or_expected(- rendered.as_str(),+ "connector operation failed","composio",operation,&[("failure", failure_tag)],diff --git a/crates/openhuman-core/src/modules/client.rs b/crates/openhuman-core/src/modules/client.rsindex 2d537db5aa..83c8d5ecf1 100644--- a/crates/openhuman-core/src/modules/client.rs+++ b/crates/openhuman-core/src/modules/client.rs@@ -39,12 +39,26 @@ impl std::error::Error for ModuleCallError {}#[derive(Clone)]pub struct ModuleClient {config: Config,+ #[cfg(all(test, feature = "modules"))]+ fixture: Option<tinybus::Proxy>,}impl ModuleClient {#[must_use]pub fn new(config: Config) -> Self {- Self { config }+ Self {+ config,+ #[cfg(all(test, feature = "modules"))]+ fixture: None,+ }+ }++ #[cfg(all(test, feature = "modules"))]+ pub(crate) fn fixture(proxy: tinybus::Proxy) -> Self {+ Self {+ config: Config::default(),+ fixture: Some(proxy),+ }}/// Execute a contract member, retaining its existing argument tuple arity.@@ -88,6 +102,10 @@ impl ModuleClient {failure::report(record, failure::Reason::Disabled);return Err(ModuleCallError::Unavailable);}+ #[cfg(all(test, feature = "modules"))]+ if let Some(proxy) = self.fixture.as_ref() {+ return invoke_proxy(record, proxy, member, args, confidential).await;+ }#[cfg(not(feature = "modules"))]{let _ = (member, args, confidential);@@ -127,17 +145,23 @@ async fn invoke_proxy<R: DeserializeOwned>(} else {proxy.call(member, args).await};- result.map_err(|error| {- let (outcome, reason) = classify(&error);- if reason == failure::Reason::ModuleUnavailable {- // TinyBus emits this stable error for a module whose terminal- // lifecycle state is cached for the rest of the process.- failure::report(record, reason);- } else {- failure::report_invocation(record, reason);- }- outcome- })+ result.map_err(|error| report_proxy_failure(record, &error))+}++/// Report a bus failure without exposing its payload to telemetry. Product+/// adapters may separately decode a structured provider refusal for display.+#[cfg(feature = "modules")]+pub(super) fn report_proxy_failure(+ record: &'static super::types::ModuleRecord,+ error: &tinybus::Error,+) -> ModuleCallError {+ let (outcome, reason) = classify(error);+ if reason == failure::Reason::ModuleUnavailable {+ failure::report(record, reason);+ } else {+ failure::report_invocation(record, reason);+ }+ outcome}#[cfg(feature = "modules")]diff --git a/crates/openhuman-core/src/modules/connectors.rs b/crates/openhuman-core/src/modules/connectors.rsindex ad1d24a964..607724cb09 100644--- a/crates/openhuman-core/src/modules/connectors.rs+++ b/crates/openhuman-core/src/modules/connectors.rs@@ -210,9 +210,9 @@ async fn ensure_routed(config: &Config, proxy: &Proxy) -> Result<(), String> {}proxy- .call::<serde_json::Value>(methods::CONFIGURE, (route,))+ .call_confidential::<serde_json::Value>(methods::CONFIGURE, (route,)).await- .map_err(|error| format!("{}: {error}", methods::CONFIGURE))?;+ .map_err(|error| bus_failure(methods::CONFIGURE, &error))?;// Recorded only after the module accepted it, so a failed reconfiguration// is retried on the next call rather than remembered as done.@@ -233,7 +233,9 @@ async fn ensure_routed(config: &Config, proxy: &Proxy) -> Result<(), String> {/// the artifact missing or failing its digest check, or the bus refusing the/// proxy.pub async fn proxy(config: &Config) -> Result<Proxy, String> {- ops::ensure_loaded(config, MODULE_ID).await?;+ ops::ensure_loaded(config, MODULE_ID)+ .await+ .map_err(|_| super::client::ModuleCallError::Unavailable.to_string())?;let proxy = proxy_to_serving().await?;ensure_routed(config, &proxy).await?;Ok(proxy)@@ -244,12 +246,13 @@ pub async fn proxy(config: &Config) -> Result<Proxy, String> {async fn proxy_to_serving() -> Result<Proxy, String> {let record =registry::find(MODULE_ID).ok_or_else(|| format!("unknown module '{MODULE_ID}'"))?;- let runtime = super::host::runtime()- .await- .map_err(|error| format!("the module runtime is unavailable: {error}"))?;+ let runtime = super::host::runtime().await.map_err(|_| {+ super::failure::report(record, super::failure::Reason::TransportFailed);+ super::client::ModuleCallError::TransportFailed.to_string()+ })?;runtime.proxy(record.bus_name, record.object_path)- .map_err(|error| format!("could not reach '{MODULE_ID}': {error}"))+ .map_err(|error| bus_failure("Connect", &error))}/// Give an already-serving module the route the current configuration@@ -294,6 +297,26 @@ pub(crate) async fn proxy_without_reconcile() -> Result<Proxy, String> {proxy_to_serving().await}+fn bus_failure(member: &str, error: &tinybus::Error) -> String {+ let outcome = super::client::report_proxy_failure(+ registry::find(MODULE_ID).expect("registered connector module"),+ error,+ );+ if let tinybus::Error::MethodFailed { name, message } = error {+ if message.starts_with("[composio:error:") {+ // Preserve the existing provider presentation contract. This is+ // product output only; telemetry above contains no remote text.+ return message.clone();+ }+ if name == tinybus::Error::FAILED {+ // Keep provider presentation byte-for-byte. The Composio reporting+ // boundary recognizes this wire envelope without a visible marker.+ return format!("{member}: {error}");+ }+ }+ format!("{member}: {outcome}")+}+/// Call one member with an argument and decode its reply.////// # Errors@@ -317,7 +340,7 @@ whereproxy.call::<Reply>(member, (request,)).await- .map_err(|error| format!("{member}: {error}"))+ .map_err(|error| bus_failure(member, &error))}/// Call a member that carries its own credential, without touching the route.@@ -344,12 +367,14 @@ where// The module's own HTTP deadline is 30s; give the bus a little longer so a// slow Composio surfaces as the module's message, not a bus timeout.const STATELESS_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(45);- ops::ensure_loaded(config, MODULE_ID).await?;+ ops::ensure_loaded(config, MODULE_ID)+ .await+ .map_err(|_| super::client::ModuleCallError::Unavailable.to_string())?;let proxy = proxy_to_serving().await?.with_timeout(STATELESS_TIMEOUT);proxy- .call::<Reply>(member, (request,))+ .call_confidential::<Reply>(member, (request,)).await- .map_err(|error| format!("{member}: {error}"))+ .map_err(|error| bus_failure(member, &error))}/// Call a member that takes no arguments.@@ -365,7 +390,7 @@ pub async fn call_bare<Reply: DeserializeOwned>(proxy.call::<Reply>(member, ()).await- .map_err(|error| format!("{member}: {error}"))+ .map_err(|error| bus_failure(member, &error))}#[cfg(test)]diff --git a/crates/openhuman-core/src/modules/connectors_tests.rs b/crates/openhuman-core/src/modules/connectors_tests.rsindex 81e83663da..4c5175fb07 100644--- a/crates/openhuman-core/src/modules/connectors_tests.rs+++ b/crates/openhuman-core/src/modules/connectors_tests.rs@@ -196,3 +196,54 @@ async fn reconciling_the_route_of_a_module_that_is_not_serving_loads_nothing() {// one that was serving stays serving.assert_eq!(crate::modules::ops::state_of(MODULE_ID), before);}++#[test]+fn unclassified_connector_faults_do_not_expose_remote_content() {+ let error = tinybus::Error::MethodFailed {+ name: "private-provider".into(),+ message: "secret-token /home/private-user/document.txt".into(),+ };+ let message = super::bus_failure(methods::EXECUTE, &error);+ assert!(message.contains("MODULE_CALL_REPORTED: module execution failed"));+ assert!(!message.contains("secret-token"));+ assert!(!message.contains("/home/private-user"));+}++#[cfg(feature = "crash-reporting")]+#[test]+fn classified_provider_errors_remain_product_output_and_emit_one_sanitized_event() {+ let provider_message =+ "[composio:error:auth] private-test-token /home/private-user/document.txt";+ let error = tinybus::Error::MethodFailed {+ name: "ai.tinyhumans.tinybus.Error.Failed".into(),+ message: provider_message.into(),+ };+ let events = sentry::test::with_captured_events(|| {+ let message = super::bus_failure(methods::EXECUTE, &error);+ assert_eq!(message, provider_message);+ crate::core::observability::report_error_or_expected(&message, "rpc", "invoke_method", &[]);+ });+ assert_eq!(events.len(), 1);+ let captured = format!("{:?}", events[0]);+ assert!(!captured.contains("private-test-token"));+ assert!(!captured.contains("/home/private-user"));+ assert_eq!(+ events[0].tags.get("module").map(String::as_str),+ Some(MODULE_ID)+ );+ assert_eq!(+ events[0].tags.get("reason_code").map(String::as_str),+ Some("module_fault")+ );+}++#[test]+fn direct_auth_refusals_preserve_the_provider_status_and_prevent_duplicate_reports() {+ let error =+ tinybus::Error::failed("Composio v3 connected_accounts failed: HTTP 401: Invalid API key");+ let message = super::bus_failure(methods::LIST_CONNECTIONS_DIRECT, &error);+ assert!(message.contains("HTTP 401: Invalid API key"));+ assert!(crate::core::observability::is_module_unavailable_message(+ &message+ ));+}