Skip to content

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

fix(search): raise execute tool bus timeout to 90s

Steven Enamakel56a871667a34
diff --git a/crates/openhuman-core/src/modules/search/proxy.rs b/crates/openhuman-core/src/modules/search/proxy.rs
index cc6c41e864..8218b4504e 100644
--- a/crates/openhuman-core/src/modules/search/proxy.rs
+++ b/crates/openhuman-core/src/modules/search/proxy.rs
@@ -13,6 +13,18 @@ use tinysearch_bus::{names, ExecuteToolRequest, ExecuteToolResponse, ListToolsRe
use super::{module_config, MODULE_ID};
use crate::config::Config;
+/// Bus deadline for one `ExecuteTool` call.
+///
+/// The bus default ([`tinybus::connection::DEFAULT_TIMEOUT`], 30 s) is sized
+/// for control calls. `web_answer_tool` waits on a provider to search *and*
+/// synthesize an answer, and `web_search_tool` can fall back across providers
+/// one after another; both routinely exceeded 30 s in production and came back
+/// as a bus timeout although the module was still working. 90 s stays under
+/// the harness's own default tool deadline
+/// ([`crate::tools::timeout::DEFAULT_TIMEOUT_SECS`], 120 s), so the module's
+/// answer, not the harness kill, decides the result.
+pub(super) const EXECUTE_TOOL_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(90);
+
fn last_config() -> &'static tokio::sync::Mutex<Option<u64>> {
static LAST: OnceLock<tokio::sync::Mutex<Option<u64>>> = OnceLock::new();
LAST.get_or_init(|| tokio::sync::Mutex::new(None))
@@ -154,7 +166,7 @@ pub async fn execute_tool(
// carries the model's arguments, which are not secrets. An
// ordinary call also works with a developer override, which is
// never attested.
- .call(names::methods::EXECUTE_TOOL, (request,))
+ .pipe_execute(request)
.await
.map_err(|error| {
tracing::debug!(tool = %tool, "[modules][search] ExecuteTool failed");
@@ -164,6 +176,23 @@ pub async fn execute_tool(
.await
}
+/// `ExecuteTool` through `proxy`, under [`EXECUTE_TOOL_TIMEOUT`] rather than
+/// the bus default.
+pub(super) async fn call_execute_tool<R: serde::de::DeserializeOwned>(
+ proxy: tinybus::Proxy,
+ request: ExecuteToolRequest,
+) -> tinybus::Result<R> {
+ tracing::debug!(
+ tool = %request.name,
+ timeout_secs = EXECUTE_TOOL_TIMEOUT.as_secs(),
+ "[modules][search] ExecuteTool"
+ );
+ proxy
+ .with_timeout(EXECUTE_TOOL_TIMEOUT)
+ .call(names::methods::EXECUTE_TOOL, (request,))
+ .await
+}
+
#[cfg(test)]
#[path = "proxy_tests.rs"]
mod proxy_tests;