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
Merge pull request #7269 from senamakel/fix-tool-call-errors
Steven Enamakel4d5a14388655
diff --cc crates/openhuman-core/src/web_chat/ops/turn_guards.rsindex 2858f63016,c754e3875a..cc1fd3a8ed--- a/crates/openhuman-core/src/web_chat/ops/turn_guards.rs+++ b/crates/openhuman-core/src/web_chat/ops/turn_guards.rs@@@ -8,54 -8,35 +8,59 @@@ use tokio_util::sync::CancellationTokenuse super::super::types::WebChatTaskResult;- /// Default wall-clock backstop for a single web chat turn, in seconds.- ///- /// This is the OUTER safety net (issue #4746). The primary, root-cause guard is- /// the harness policy's `max_wall_clock_ms` (`tinyagents::run_policy_for`,- /// default 600s), which interrupts a hung/slow model or tool/sub-agent call- /// mid-flight and returns a proper `Timeout` → `chat_error`. This channel-level- /// backstop sits ABOVE that (900s) and only fires if a turn wedges OUTSIDE the- /// harness run entirely (e.g. session assembly / persistence plumbing), so the- /// client still always gets a terminal event instead of an empty reply / an- /// endless `inference_heartbeat` stream. Deliberately generous — a hang- /// backstop, not a UX deadline. Override via `OPENHUMAN_WEB_TURN_TIMEOUT_SECS`;- /// set it to `0` to disable the backstop.- const DEFAULT_WEB_TURN_TIMEOUT_SECS: u64 = 900;-/// Resolve the per-turn wall-clock backstop. Returns `None` when disabled/// (env `OPENHUMAN_WEB_TURN_TIMEOUT_SECS=0`).+ ///+ /// This is the OUTER safety net (issue #4746), and the single source of truth+ /// for the turn's deadlines (`agent::turn_deadline`, default 900s). The+ /// harness derives two earlier points from it:+ ///+ /// * **wind-down** at backstop minus `min(120s, backstop/5)`, 780s by default.+ /// The harness pauses the run at its next safe point, and the session driver+ /// writes the grounded close from the work already done, so a long turn+ /// still delivers an answer.+ /// * **hard stop** at backstop minus `min(60s, backstop/10)`, 840s by default.+ /// The harness policy's `max_wall_clock_ms` (`tinyagents::run_policy_for`,+ /// 3600s on its own) is clamped to it, so a tool or sub-agent call that runs+ /// across the wind-down point ends in the harness's own typed `Timeout` →+ /// `chat_error`.+ ///+ /// So this backstop only fires if a turn wedges OUTSIDE the harness run, e.g.+ /// in session assembly, the grounded close or the persistence plumbing. The+ /// client then still gets a terminal `turn_timeout` event instead of an empty+ /// reply or an endless `inference_heartbeat` stream. Before the derived+ /// deadlines existed, the harness ceiling sat at 3600s, *after* this 900s+ /// backstop. Long orchestrator turns were then dropped here, mid-work, with+ /// nothing delivered. Override via `OPENHUMAN_WEB_TURN_TIMEOUT_SECS`; set it to+ /// `0` to disable the backstop and the derived deadlines with it.fn web_turn_deadline() -> Option<Duration> {- let secs = std::env::var("OPENHUMAN_WEB_TURN_TIMEOUT_SECS")- .ok()- .and_then(|v| v.trim().parse::<u64>().ok())- .unwrap_or(DEFAULT_WEB_TURN_TIMEOUT_SECS);- (secs > 0).then(|| Duration::from_secs(secs))+ crate::agent::turn_deadline::configured_backstop()}+/// The backstop for a turn that has to be allowed to run long: one on a local /+/// self-hosted provider (#6042), whose prefill alone can take many minutes. The+/// explicit `OPENHUMAN_WEB_TURN_TIMEOUT_SECS` override still wins; otherwise the+/// default is the local turn ceiling plus a grace period, never the hosted 900s,+/// which sat below the harness's own ceilings and pre-empted them.+async fn resolve_web_turn_deadline() -> Option<Duration> {+ if std::env::var("OPENHUMAN_WEB_TURN_TIMEOUT_SECS").is_ok() {+ return web_turn_deadline();+ }+ let local = match crate::config::rpc::load_config_with_timeout().await {+ Ok(config) => crate::agent::tinyagents::chat_provider_is_local(&config),+ Err(error) => {+ log::debug!("[web-channel] backstop locality probe skipped: {error}");+ false+ }+ };+ if local {+ let secs = crate::agent::tinyagents::local_web_turn_backstop_secs();+ log::debug!("[web-channel] local provider: turn backstop {secs:?}s (#6042)");+ return secs.map(Duration::from_secs);+ }+ web_turn_deadline()+}+/// Drive a chat-turn future under the wall-clock backstop.////// On elapse the inner future is dropped (cooperative teardown at its next