Skip to content

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

fix(observability): suppress repeated module-load failure reports

Steven Enamakel530c62723b58
diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rs
index e5782b22cc..722ce23d5c 100644
--- a/crates/openhuman-core/src/core/observability.rs
+++ b/crates/openhuman-core/src/core/observability.rs
@@ -202,6 +202,19 @@ pub enum ExpectedErrorKind {
/// backend-touching surface degrades to this typed error. Messages carry
/// the [`BACKEND_UNAVAILABLE_PREFIX`] sentinel.
BackendUnavailable,
+ /// A native module failed to load, and the failure is being handed back
+ /// again. tinybus never unloads a library, so `modules::ops` caches a load
+ /// failure for the life of the process and returns it instantly to every
+ /// later caller; only a restart can change the outcome. The failure itself
+ /// is reported **once**, at resolution time
+ /// (`modules::ops::report_resolution_failure`, tagged with the module id).
+ /// Every per-call re-report after that — composio ops, the `/rpc`
+ /// boundary, memory calls — carries no new signal, and was a few hundred
+ /// broken installs producing ~1M events (TAURI-RUST-117K / -118J / -117Y /
+ /// -113J / -113T / -113D / -113N / -113Q / -113X). Matched on the shared
+ /// [`crate::tools::status::MODULE_FAULT_MARKER`] and the module-load
+ /// wordings; see [`is_module_unavailable_message`].
+ ModuleUnavailable,
/// Channel supervisor (`channels::runtime::supervision::spawn_supervised_listener`)
/// caught a transient error from a channel listener and restarted it. The
/// wrapper shape `"Channel <name> error: <inner>; restarting"` is the
@@ -2068,6 +2081,21 @@ fn report_expected_message(kind: ExpectedErrorKind, message: &str, domain: &str,
"[observability] {domain}.{operation} skipped expected budget-exhausted error: {message}"
);
}
+ ExpectedErrorKind::ModuleUnavailable => {
+ // A cached module-load failure handed back to another caller. The
+ // load failure was already reported once when the module resolved
+ // (`modules::ops::report_resolution_failure`); re-reporting it per
+ // call is the flood this kind exists to stop. Warn so the
+ // breadcrumb survives and a sustained spike still shows in logs.
+ tracing::warn!(
+ domain = domain,
+ operation = operation,
+ kind = "module_unavailable",
+ error = %message,
+ "[observability] {domain}.{operation} skipped expected module-unavailable error \
+ (reported once at resolution): {message}"
+ );
+ }
ExpectedErrorKind::BackendUnavailable => {
// Build-state condition: no backend transport is installed, so
// the hosted backend is unreachable by construction. Nothing to
diff --git a/crates/openhuman-core/src/threads/ops/edit_tests.rs b/crates/openhuman-core/src/threads/ops/edit_tests.rs
index df08e8a385..76efc26a0a 100644
--- a/crates/openhuman-core/src/threads/ops/edit_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_tests.rs
@@ -217,3 +217,15 @@ fn truncate_transcript_for_regenerate_returns_none_when_no_turn_exists() {
let result = truncate_transcript_for_regenerate(dir.path(), thread_id, None).expect("truncate");
assert_eq!(result, None, "no user/assistant turn to regenerate");
}
+
+/// Sentry TAURI-REACT-AK: regenerating on a thread that never wrote a session
+/// transcript surfaced "thread <id> has no session transcript" instead of the
+/// friendly "has no turn to regenerate" the caller maps `Ok(None)` to.
+#[test]
+fn truncate_transcript_for_regenerate_returns_none_when_thread_has_no_transcript() {
+ let dir = TempDir::new().expect("tempdir");
+
+ let result = truncate_transcript_for_regenerate(dir.path(), "thread-without-transcript", None)
+ .expect("a thread with no transcript has no turn to regenerate, not an error");
+ assert_eq!(result, None);
+}