Skip to content

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

refactor(tinyagents): restructure failure policy middleware

Steven Enamakelc6cded998d37
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
index 49d899e032..0bbb7bdfa4 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
@@ -208,7 +208,10 @@ pub(super) fn classified_recovery_policy(
.trim_start()
.starts_with(crate::tools::status::TASK_FAILED_MARKER)
{
- let class = crate::tools::status::classify(error, false).class;
+ // Classify the headline only: the task report appended after the
+ // blank line is page and planner text, not the call's verdict.
+ let headline = error.split("\n\n").next().unwrap_or(error);
+ let class = crate::tools::status::classify(headline, false).class;
return Some(match class {
Class::ServiceUnavailable | Class::ModelConnection => ("transient", 2),
_ => ("task_failed", 1),