From 3ec72f612165bdbce7b1d9b27d81000894df71a4 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Mon, 13 Apr 2026 23:31:12 -0300 Subject: [PATCH] fix: add 60s timeout to OpenAI-compatible HTTP client preventing LLM deadlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reqwest::Client::new() has no timeout — when external APIs (NVIDIA, Groq, etc.) hang or throttle, the request blocks forever, freezing the entire response pipeline for the user. Also add std::time::Duration import to llm/mod.rs. Co-authored-by: Qwen-Coder --- src/llm/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/llm/mod.rs b/src/llm/mod.rs index 5d9c113e..bb411f36 100644 --- a/src/llm/mod.rs +++ b/src/llm/mod.rs @@ -3,6 +3,7 @@ use futures::StreamExt; use log::{error, info}; use serde_json::Value; use std::sync::Arc; +use std::time::Duration; use tokio::sync::{mpsc, RwLock}; pub mod cache; @@ -198,7 +199,10 @@ impl OpenAIClient { }; Self { - client: reqwest::Client::new(), + client: reqwest::Client::builder() + .timeout(Duration::from_secs(60)) + .build() + .unwrap_or_else(|_| reqwest::Client::new()), base_url: base, endpoint_path: endpoint, rate_limiter: Arc::new(rate_limiter),