Skip to content

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

test(tinyagents): add failure policy class middleware tests

Steven Enamakel076bda67fef9
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs
index 4dc08dfd34..eb4ce9f34b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs
@@ -284,6 +284,22 @@ fn a_failed_browser_task_gets_one_changed_attempt_not_a_credential_halt() {
);
}
+#[test]
+fn a_failed_task_is_classified_by_its_headline_not_its_attached_report() {
+ // The tool error carries the task view as a report after the headline.
+ // Words in that report (a page that said "authentication failed") must
+ // not override the headline's gateway 504.
+ let error = format!(
+ "{} Browser task failed at step 3: the rescuer gave up: rescue model returned HTTP 504\n\n{}",
+ crate::tools::status::TASK_FAILED_MARKER,
+ serde_json::json!({"summary": "the site said authentication failed on the login page"})
+ );
+ assert_eq!(
+ recovery_policy("browser", &error, false),
+ Some(("transient", 2))
+ );
+}
+
#[tokio::test]
async fn a_failed_browser_task_nudges_toward_its_hint_then_stops_on_a_repeat() {
let (mw, handle, slot) = breaker();