fix(channel): prevent false timeout during multi-turn tool loops (#1037)

This commit is contained in:
Chummy 2026-02-20 12:28:05 +08:00 committed by GitHub
parent 178bb108da
commit f274fd5757
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 6 deletions

View file

@ -7,9 +7,9 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::{OnceLock, RwLock};
use tokio::fs::{self, OpenOptions};
#[cfg(unix)]
use tokio::fs::File;
use tokio::fs::{self, OpenOptions};
use tokio::io::AsyncWriteExt;
const SUPPORTED_PROXY_SERVICE_KEYS: &[&str] = &[
@ -2197,7 +2197,10 @@ pub struct ChannelsConfig {
pub dingtalk: Option<DingTalkConfig>,
/// QQ Official Bot channel configuration.
pub qq: Option<QQConfig>,
/// Timeout in seconds for processing a single channel message (LLM + tools).
/// Base timeout in seconds for processing a single channel message (LLM + tools).
/// Runtime uses this as a per-turn budget that scales with tool-loop depth
/// (up to 4x, capped) so one slow/retried model call does not consume the
/// entire conversation budget.
/// Default: 300s for on-device LLMs (Ollama) which are slower than cloud APIs.
#[serde(default = "default_channel_message_timeout_secs")]
pub message_timeout_secs: u64,
@ -3544,9 +3547,9 @@ async fn sync_directory(_path: &Path) -> Result<()> {
#[cfg(test)]
mod tests {
use super::*;
use std::path::PathBuf;
#[cfg(unix)]
use std::{fs::Permissions, os::unix::fs::PermissionsExt};
use std::path::PathBuf;
use tokio::sync::{Mutex, MutexGuard};
use tokio::test;
use tokio_stream::wrappers::ReadDirStream;