The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(tinyagents): stop repeated-failure middleware from tripping on transient errors
Steven Enamakel9da1354ea697
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rsindex 5c49477db3..506ae8cb5c 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs@@ -474,3 +474,41 @@ fn the_repl_tools_join_a_belt_only_while_handle_mode_is_active() {super::ensure_repl_tools_visible(&mut none, true);assert_eq!(none.len(), 1);}++#[tokio::test]+async fn a_curated_orchestrator_sees_and_holds_every_juice_tool_in_handle_mode() {+ // Regression for the 0.64.x "unknown tool juice_*" cluster: with large+ // results stored behind a handle, the footer tells the model to call+ // `juice_find` / `juice_summarize` / `juice_retrieve`. A curated+ // (`ToolScope::Named`) belt that lacked them was told to call tools it+ // could not dispatch.+ use crate::agent::session_host::types::OpenHumanSessionHost;+ use crate::inference::tokenjuice::{RETRIEVE_TOOL_NAME, REPL_TOOL_NAMES};++ let _ = crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins();++ let tmp = tempfile::TempDir::new().unwrap();+ let mut config = test_config(&tmp);+ config.context.compaction_enabled = true;+ config.tokenjuice.router_enabled = true;+ config.tokenjuice.ccr_enabled = true;+ config.tokenjuice.repl_handle_enabled = true;+ assert!(crate::inference::tokenjuice::repl_handle_active(&config));++ let agent = OpenHumanSessionHost::from_config_for_agent(&config, "orchestrator")+ .expect("orchestrator is a shipped agent definition");+ let visible = agent.visible_tool_names_for_test();+ assert!(+ !visible.is_empty(),+ "the orchestrator's belt is curated; an empty set would make this test vacuous"+ );+ let registered: std::collections::HashSet<&str> =+ agent.tools().iter().map(|t| t.name()).collect();+ for name in REPL_TOOL_NAMES.iter().copied().chain([RETRIEVE_TOOL_NAME]) {+ assert!(visible.contains(name), "{name} must be visible to the orchestrator");+ assert!(+ registered.contains(name),+ "{name} must be registered so a call to it dispatches"+ );+ }+}diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rsindex 87953e7b32..468d319a8d 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs@@ -1,5 +1,5 @@//! Which recovery class and budget a failed tool call gets-//! ([`recovery_policy`]), split out of `repeated_failure.rs` so the breaker+//! ([`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};@@ -11,7 +11,9 @@ use tinyinference_llm::failure::is_recoverable_failure_text as is_recoverable_to////// Judges the call's side effect from `tool`'s name alone; the breaker, which/// sees the call's arguments and the registered tools, uses-/// [`recovery_policy_with_effect`].+/// [`recovery_policy_with_effect`]. Test-only: every production caller knows+/// the call's arguments.+#[cfg(test)]pub(super) fn recovery_policy(tool: &str,error: &str,diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rsindex 6202f6a9ee..487cfbdcd8 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs@@ -297,8 +297,10 @@ pub(super) fn failure_scope(tool: &str, arguments: &serde_json::Value) -> Stringscope}+#[cfg(test)]+pub(super) use super::failure_policy::recovery_policy;pub(super) use super::failure_policy::{- is_command_exit_report, missing_program_nudge, recovery_policy, recovery_policy_with_effect,+ is_command_exit_report, missing_program_nudge, recovery_policy_with_effect,};/// Detect a **body-level** failure from `validate_workflow` / `dry_run_workflow`diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rsindex 495ea8704b..884e097453 100644--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs@@ -398,3 +398,49 @@ async fn an_artifact_path_without_a_configured_dir_points_at_file_read() {assert!(res.is_error);assert!(result_text(&res).contains("file_read"));}++/// Every `juice_*` / `*_retrieve` identifier a footer mentions.+fn tool_names_in(text: &str) -> Vec<String> {+ text.split(|c: char| !(c.is_ascii_alphanumeric() || c == '_'))+ .filter(|w| w.starts_with("juice_") || w.ends_with("_retrieve") || w.contains("juice_"))+ .map(str::to_string)+ .collect()+}++#[tokio::test]+async fn compressed_output_footers_only_name_tools_that_exist() {+ // Regression for the "unknown tool juice_*" cluster: a footer naming a tool+ // the model is not offered (or a pre-rename alias like `tinyjuice_retrieve`)+ // burns the model's failure budget on a call that cannot dispatch.+ use crate::inference::tokenjuice::RETRIEVE_TOOL_NAME;+ let offered: Vec<&str> = REPL_TOOL_NAMES+ .iter()+ .copied()+ .chain([RETRIEVE_TOOL_NAME])+ .collect();++ let store = MemoryCcrStore::default();+ let (handle_footer, _) = store_behind_handle(&store, &log_body()).await;++ let ccr = tinyjuice::compress_content_with_store(+ &log_body(),+ None,+ &CompressOptions::default(),+ &MemoryCcrStore::default(),+ )+ .await;++ let mut seen = 0;+ for footer in [handle_footer, ccr.text] {+ assert!(!footer.contains("tinyjuice_retrieve"), "{footer}");+ assert!(!footer.contains("tokenjuice_retrieve"), "{footer}");+ for name in tool_names_in(&footer) {+ seen += 1;+ assert!(+ offered.contains(&name.as_str()),+ "footer names `{name}`, which is not an offered tool: {footer}"+ );+ }+ }+ assert!(seen > 0, "the footers must name at least one tool");+}