Skip to content

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

chore: files changed crates/openhuman-core/src/modules/ops.rs,crates/openhuman-core/src/modules/ops_

Steven Enamakeld36fdde3e009
diff --git a/crates/openhuman-core/src/modules/ops.rs b/crates/openhuman-core/src/modules/ops.rs
index 90ee3a8739..16a0440b59 100644
--- a/crates/openhuman-core/src/modules/ops.rs
+++ b/crates/openhuman-core/src/modules/ops.rs
@@ -321,6 +321,10 @@ async fn resolve(config: &Config, record: &'static ModuleRecord) -> Result<(), S
///
/// A panic in the loader is reported rather than propagated: it would otherwise
/// take down whichever task happened to be awaiting the load.
+///
+/// Every loader error is terminal for the process and says so once: tinybus'
+/// release-cache path and [`load_local`] already carry the marker, the rest
+/// get it appended here.
async fn blocking<F>(work: F) -> Result<(), String>
where
F: FnOnce() -> Result<(), String> + Send + 'static,
@@ -330,12 +334,16 @@ where
.map_err(|error| format!("the module bus could not start: {error}"))?
.blocking(work)
.await
- .map_err(|error| {
- format!(
- "{error}. {}; restart the app to try again",
- crate::tools::status::MODULE_FAULT_MARKER
- )
- })
+ .map_err(mark_terminal)
+}
+
+/// Append the terminal-fault sentence to `error` unless it already has it.
+fn mark_terminal(error: String) -> String {
+ let marker = crate::tools::status::MODULE_FAULT_MARKER;
+ if error.contains(marker) {
+ return error;
+ }
+ format!("{error}. {marker}; restart the app to try again")
}
/// Load the pinned release for this host through the release cache.
diff --git a/crates/openhuman-core/src/modules/ops_tests.rs b/crates/openhuman-core/src/modules/ops_tests.rs
index 1923a67285..946c7805ed 100644
--- a/crates/openhuman-core/src/modules/ops_tests.rs
+++ b/crates/openhuman-core/src/modules/ops_tests.rs
@@ -355,7 +355,10 @@ fn a_failed_resolution_is_reported_once_with_the_module_id() {
let tags = &events[0].tags;
assert_eq!(tags.get("domain").map(String::as_str), Some("modules"));
assert_eq!(tags.get("operation").map(String::as_str), Some("resolve"));
- assert_eq!(tags.get("module").map(String::as_str), Some("tinyconnectors"));
+ assert_eq!(
+ tags.get("module").map(String::as_str),
+ Some("tinyconnectors")
+ );
// The same reason re-reported by a caller is demoted.
let repeats = sentry::test::with_captured_events(|| {