Increase research tool timeout to 20 minutes

The research tool often runs past 8 minutes due to web browsing and
analysis. Increased its timeout to 20 minutes while keeping other
tools at 8 minutes.

Changes:
- Tool timeout is now tool-specific (20 min for research, 8 min for others)
- Timeout error message now shows the correct duration for each tool
This commit is contained in:
Dhanji R. Prasanna
2026-01-19 21:51:08 +05:30
parent f4cce22db3
commit 4b7be3f9ee

View File

@@ -2174,9 +2174,14 @@ Skip if nothing new. Be brief."#;
// Clone working_dir to avoid borrow checker issues // Clone working_dir to avoid borrow checker issues
let working_dir = self.working_dir.clone(); let working_dir = self.working_dir.clone();
let exec_start = Instant::now(); let exec_start = Instant::now();
// Add 8-minute timeout for tool execution // Tool execution timeout: 20 minutes for research, 8 minutes for others
let timeout_duration = if tool_call.tool == "research" {
Duration::from_secs(20 * 60) // 20 minutes for research
} else {
Duration::from_secs(8 * 60) // 8 minutes for other tools
};
let tool_result = match tokio::time::timeout( let tool_result = match tokio::time::timeout(
Duration::from_secs(8 * 60), // 8 minutes timeout_duration,
// Use working_dir if set (from --codebase-fast-start) // Use working_dir if set (from --codebase-fast-start)
self.execute_tool_in_dir(&tool_call, working_dir.as_deref()), self.execute_tool_in_dir(&tool_call, working_dir.as_deref()),
) )
@@ -2184,8 +2189,12 @@ Skip if nothing new. Be brief."#;
{ {
Ok(result) => result?, Ok(result) => result?,
Err(_) => { Err(_) => {
warn!("Tool call {} timed out after 8 minutes", tool_call.tool); let timeout_mins = if tool_call.tool == "research" { 20 } else { 8 };
"Tool execution timed out after 8 minutes".to_string() warn!("Tool call {} timed out after {} minutes", tool_call.tool, timeout_mins);
format!(
"❌ Tool execution timed out after {} minutes",
timeout_mins
)
} }
}; };
let exec_duration = exec_start.elapsed(); let exec_duration = exec_start.elapsed();