Skip to content

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

fix(tinyagents): stop repeated-failure middleware from tripping on transient errors

Steven Enamakel989552c018db
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 012cc2cf45..3e7014a0b0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
@@ -2,7 +2,7 @@
//! ([`recovery_policy_with_effect`]), split out of `repeated_failure.rs` so the breaker
//! stays readable: the ladder driver lives there, the classification here.
-use super::call_effect::{call_effect, CallEffect};
+use tinyagents_harness::middleware::{call_effect, CallEffect};
use super::fetched_site::fetched_site_policy;
use tinyinference_llm::failure::is_recoverable_failure_text as is_recoverable_tool_failure;
@@ -23,7 +23,7 @@ pub(super) fn recovery_policy(
}
/// [`recovery_policy`] for a call whose side effect is already known
-/// ([`super::call_effect::call_effect`]). `CallEffect::Unknown` falls back to
+/// ([`tinyagents_harness::middleware::call_effect`]). `CallEffect::Unknown` falls back to
/// reading `tool`'s name.
pub(super) fn recovery_policy_with_effect(
tool: &str,
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 4cb9727b74..dfb4cd9414 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
@@ -8,7 +8,11 @@ use async_trait::async_trait;
use tinyagents_harness::context::RunContext;
use tinyagents_harness::error::Result as TaResult;
-use tinyagents_harness::middleware::{repeat_guard_marker, Middleware, ToolInvocationIdentity};
+use tinyagents_harness::middleware::{
+ call_effect, dispatch_target, is_repeat_call_exempt, repeat_guard_marker, CallEffect, Middleware,
+ StopLatch, ToolFactsLookup, ToolInvocationIdentity, RECOVERABLE_NO_PROGRESS_FAILURE_THRESHOLD,
+ RECOVERABLE_REPEAT_FAILURE_THRESHOLD,
+};
use tinyagents_harness::no_progress::{
ClassifiedFailure, ClassifiedFailureTracker, NoProgress, NoProgressTracker, ToolAttempt,
};
@@ -16,13 +20,7 @@ use tinyagents_harness::steering::SteeringHandle;
use tinyinference_llm::tool::ToolCall as TaToolCall;
use tinytools::ToolResult as TaToolResult;
-use super::call_effect::{call_effect, dispatch_target, CallEffect, ToolFactsLookup};
use super::fetched_site::{fetch_host_scope, heuristic_text};
-use super::loop_guards::{
- is_repeat_call_exempt, RECOVERABLE_NO_PROGRESS_FAILURE_THRESHOLD,
- RECOVERABLE_REPEAT_FAILURE_THRESHOLD,
-};
-use super::stop_latch::StopLatch;
pub(crate) use crate::inference::failure_copy::user_actionable_escalation;
use crate::inference::failure_copy::{
recoverable_identical_halt_summary, recoverable_no_progress_halt_summary,
@@ -132,7 +130,7 @@ impl RepeatedToolFailureMiddleware {
}
/// Judge each call's side effect from the registered tools' own
- /// declarations ([`super::call_effect::tool_sets_lookup`]) rather than
+ /// declarations ([`tinyagents_harness::middleware::tool_sets_lookup`]) rather than
/// from tool names alone.
pub(crate) fn with_tool_facts(mut self, lookup: ToolFactsLookup) -> Self {
self.tool_facts = Some(lookup);
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
index 3570c94284..7a56fef3ec 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
@@ -370,7 +370,7 @@ fn a_web_search_tool_timeout_is_transient_not_an_uncertain_action() {
))) as Box<dyn tinytools::Tool>
})
.collect();
- let lookup = super::super::call_effect::tool_sets_lookup(vec![std::sync::Arc::new(tools)]);
+ let lookup = tinyagents_harness::middleware::tool_sets_lookup(vec![std::sync::Arc::new(tools)]);
for name in ["web_answer_tool", "web_search_tool", "web_contents_tool"] {
let args = serde_json::json!({"query": "what changed in the release"});
let effect = call_effect(Some(&lookup), name, &args);
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs
index 4cf4fc3fe9..c61c253f85 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs
@@ -407,9 +407,6 @@ mod memory_budget_tests;
#[path = "middleware_stop_cause_tests.rs"]
mod stop_cause_tests;
-#[path = "middleware_research_budget_tests.rs"]
-mod research_budget_tests;
-
#[path = "middleware_memory_and_hooks_tests.rs"]
mod memory_and_hooks_tests;
#[path = "middleware_tool_output_artifact_tests.rs"]