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(agent): forward timeout_policy through the canonical tool adapter
M3gA-Mind7ab801148cda
diff --git a/crates/openhuman-core/src/agent/tinyagents/tools.rs b/crates/openhuman-core/src/agent/tinyagents/tools.rsindex 6f6884bd3c..1223eb7d41 100644--- a/crates/openhuman-core/src/agent/tinyagents/tools.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tools.rs@@ -173,6 +173,17 @@ impl Tool for CanonicalSharedToolAdapter {self.resolved_tool().and_then(Tool::family)}+ /// Forwarded so the harness bounds each call by the wrapped tool's own+ /// policy. Without it the trait default reported `Inherit` for every+ /// registered tool, so `shell` (Unbounded unless `timeout_secs`) and the+ /// tools sized to a human wait were all killed at the inherited 120s.+ fn timeout_policy(&self, arguments: &serde_json::Value) -> tinytools::ToolTimeout {+ self.resolved_tool()+ .map_or(tinytools::ToolTimeout::Inherit, |tool| {+ tool.timeout_policy(arguments)+ })+ }+async fn prepare_authorization(&self,arguments: &serde_json::Value,diff --git a/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rs b/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rsindex 5bd3b670b7..7a29baf710 100644--- a/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rs@@ -342,3 +342,70 @@ fn session_deferred_adapter_reports_deferred_but_never_surfaces_a_hidden_tool()assert_eq!(forced("hidden"), tinytools::ToolExposure::Hidden);assert_eq!(forced("deferred"), tinytools::ToolExposure::Deferred);}++/// Mirrors `ShellTool::timeout_policy`: unbounded unless the call passes+/// `timeout_secs`. Its default `policy()` reports an `Inherit` runtime, so a+/// policy derived from `policy()` alone would lose both answers.+struct ArgTimedTool;++#[async_trait]+impl Tool for ArgTimedTool {+ fn name(&self) -> &str {+ "arg_timed"+ }++ fn description(&self) -> &str {+ "Times itself from its arguments."+ }++ fn parameters_schema(&self) -> serde_json::Value {+ serde_json::json!({"type": "object"})+ }++ fn timeout_policy(&self, args: &serde_json::Value) -> tinytools::ToolTimeout {+ match args.get("timeout_secs").and_then(serde_json::Value::as_u64) {+ None | Some(0) => tinytools::ToolTimeout::Unbounded,+ Some(secs) => tinytools::ToolTimeout::Millis(secs * 1000),+ }+ }++ async fn execute(&self, _args: serde_json::Value) -> anyhow::Result<ToolResult> {+ Ok(ToolResult::default())+ }+}++/// The harness bounds a call by the *registered* tool's `timeout_policy`, and+/// every OpenHuman tool is registered through this adapter. Without forwarding,+/// a shell call was killed at the inherited 120s even with `timeout_secs=3493`+/// (#7712).+#[test]+fn adapter_forwards_the_wrapped_tools_timeout_policy() {+ let set: Arc<Vec<Box<dyn Tool>>> = Arc::new(vec![Box::new(ArgTimedTool)]);+ let adapter =+ CanonicalSharedToolAdapter::for_name(vec![set], "arg_timed").expect("registered tool");++ assert_eq!(+ adapter.timeout_policy(&serde_json::json!({})),+ tinytools::ToolTimeout::Unbounded+ );+ assert_eq!(+ adapter.timeout_policy(&serde_json::json!({"timeout_secs": 300})),+ tinytools::ToolTimeout::Millis(300_000)+ );+}++#[test]+fn adapter_for_a_missing_tool_inherits_the_default_timeout() {+ let adapter = CanonicalSharedToolAdapter {+ sets: Vec::new(),+ name: "missing".to_string(),+ description: "missing".to_string(),+ parameters_schema: serde_json::json!({"type": "object"}),+ early_exit: None,+ force_deferred: false,+ };+ assert_eq!(+ adapter.timeout_policy(&serde_json::json!({"timeout_secs": 300})),+ tinytools::ToolTimeout::Inherit+ );+}diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rsindex 3285c8d8e7..172420bfad 100644--- a/crates/openhuman-core/src/tools/impl/system/shell.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs@@ -211,7 +211,7 @@ impl Tool for ShellTool {"type": "integer","minimum": 1,"maximum": 3600,- "description": "Optional wall-clock timeout (seconds, 1..=3600) for this command before it is killed. Use a larger value for long-running work (builds, test suites, solvers). Omitted or out-of-range falls back to the configured tool timeout."+ "description": "Optional wall-clock timeout (seconds, 1..=3600) for this command before it is killed. Use a larger value for long-running work (builds, test suites, solvers). Omitted or 0 runs without a deadline; larger values are capped at 3600."}},"required": ["command"]