Skip to content

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

fix(tinyagents): skip repeat-guard results after scope cleanup

Steven Enamakeleec75797ac68
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 06f25ea532..b36d82d4da 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
@@ -450,17 +450,6 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
result: &mut TaToolResult,
) -> TaResult<()> {
let tool_name = invocation.tool_name();
- // A result the repeat guard answered itself (blocked/halted without
- // running the tool) is the guard's verdict, not the tool failing, so it
- // must not feed the failure ladder.
- if let Some(marker) = repeat_guard_marker(result) {
- tracing::debug!(
- tool = tool_name,
- marker,
- "[tinyagents::mw] skipping repeat-guard result in failure ladder"
- );
- return Ok(());
- }
let content = crate::agent::tinyagents::middleware::tool_result_text(result);
let arg_fp = self
.arg_sigs
@@ -474,6 +463,17 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
.ok()
.and_then(|mut scopes| scopes.remove(&invocation.call_id().to_string()))
.unwrap_or_else(|| tool_name.to_owned());
+ // A result the repeat guard answered itself (blocked/halted without
+ // running the tool) is the guard's verdict, not the tool failing, so it
+ // must not feed the failure ladder.
+ if let Some(marker) = repeat_guard_marker(result) {
+ tracing::debug!(
+ tool = tool_name,
+ marker,
+ "[tinyagents::mw] skipping repeat-guard result in failure ladder"
+ );
+ return Ok(());
+ }
let step = self.step.fetch_add(1, Ordering::SeqCst) + 1;
// Body-level failure signal: `validate_workflow` / `dry_run_workflow`