fix: Prevent infinite hangs in coder agent and implement timeouts for LLM API calls and interactive tools

This commit is contained in:
2026-08-14 15:22:25 -06:00
parent 2596194417
commit 644d899f78
8 changed files with 128 additions and 28 deletions
+6 -1
View File
@@ -57,12 +57,16 @@ pub trait Client: Sync + Send {
let mut builder = ReqwestClient::builder();
let extra = self.extra_config();
let timeout = extra.and_then(|v| v.connect_timeout).unwrap_or(10);
let read_timeout = extra.and_then(|v| v.read_timeout).unwrap_or(300);
if let Some(proxy) = extra.and_then(|v| v.proxy.as_deref()) {
builder = set_proxy(builder, proxy)?;
}
if let Some(user_agent) = self.app_config().user_agent.as_ref() {
builder = builder.user_agent(user_agent);
}
if read_timeout > 0 {
builder = builder.read_timeout(Duration::from_secs(read_timeout));
}
let client = builder
.connect_timeout(Duration::from_secs(timeout))
.build()
@@ -261,6 +265,7 @@ impl Default for ClientConfig {
pub struct ExtraConfig {
pub proxy: Option<String>,
pub connect_timeout: Option<u64>,
pub read_timeout: Option<u64>,
}
#[derive(Debug, Clone, Deserialize, Default)]
@@ -1005,4 +1010,4 @@ mod tests {
assert!(!should_retry_auth(&api_status_error(401), client));
assert!(!is_rejected(client, "at-1"));
}
}
}