Skip to content

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

refactor(tools): centralise module fault marker in status types

Steven Enamakelf77b2f63a5d7
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
index 94272bc1d1..9121045206 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
@@ -289,7 +289,7 @@ fn classified_recovery_policy(
// so retrying the same tool cannot help. Steer the model off it once
// rather than halting the run on the first call or spending a transient
// budget on it (`restart the app to try again` read as recoverable).
- if error.contains(crate::modules::MODULE_FAULT_IS_TERMINAL) {
+ if error.contains(crate::tools::status::MODULE_FAULT_MARKER) {
return Some(("unavailable", 1));
}
// A tool-owned JSON error contract is less ambiguous than rendered prose.
diff --git a/crates/openhuman-core/src/modules/ops.rs b/crates/openhuman-core/src/modules/ops.rs
index e7ee6d0ef3..0dfd6be5d9 100644
--- a/crates/openhuman-core/src/modules/ops.rs
+++ b/crates/openhuman-core/src/modules/ops.rs
@@ -318,7 +318,8 @@ where
.await
.map_err(|error| {
format!(
- "{error}. This is terminal for the running process; restart the app to try again"
+ "{error}. {}; restart the app to try again",
+ crate::tools::status::MODULE_FAULT_MARKER
)
})
}
diff --git a/crates/openhuman-core/src/tools/status/mod.rs b/crates/openhuman-core/src/tools/status/mod.rs
index 6a1218144e..76bc7a363e 100644
--- a/crates/openhuman-core/src/tools/status/mod.rs
+++ b/crates/openhuman-core/src/tools/status/mod.rs
@@ -18,6 +18,6 @@ mod types;
pub use ops::{classify, describe, tool_execution_error};
pub use types::{
- ClassifiedFailure, FailureCategory, ToolFailureClass, ToolLifecycleState, NOT_FOUND_MARKER,
- UNSUPPORTED_MARKER,
+ ClassifiedFailure, FailureCategory, ToolFailureClass, ToolLifecycleState, MODULE_FAULT_MARKER,
+ NOT_FOUND_MARKER, UNSUPPORTED_MARKER,
};
diff --git a/crates/openhuman-core/src/tools/status/types.rs b/crates/openhuman-core/src/tools/status/types.rs
index 4a34a45420..1ff243fe32 100644
--- a/crates/openhuman-core/src/tools/status/types.rs
+++ b/crates/openhuman-core/src/tools/status/types.rs
@@ -86,6 +86,12 @@ pub const NOT_FOUND_MARKER: &str = "[not-found]";
/// ([`ToolFailureClass::Unsupported`]). Same contract as [`NOT_FOUND_MARKER`].
pub const UNSUPPORTED_MARKER: &str = "[unsupported]";
+/// Phrase a module fault carries (`modules::ops`): a module that failed to
+/// load stays unloaded until the app restarts, so any call that needs it fails
+/// the same way for the rest of the process. Shared so the recovery policy
+/// matches the producer's wording instead of a copy of it.
+pub const MODULE_FAULT_MARKER: &str = "This is terminal for the running process";
+
/// The three top-level states the UI separates, per the #4254 acceptance
/// criterion "clear separation between recoverable failure, blocked-by-policy,
/// and action-needs-user-confirmation states".