From 24b785ef81060488f85d61ebcb187dcf1b8e03b0 Mon Sep 17 00:00:00 2001 From: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com> Date: Wed, 21 Jan 2026 09:51:43 +0800 Subject: [PATCH] chore: futher add more time for running (#994) --- backend/app/component/model_validation.py | 4 ++-- backend/app/controller/chat_controller.py | 4 ++-- backend/app/service/chat_service.py | 2 +- backend/app/service/task.py | 2 +- backend/app/utils/agent.py | 4 +++- backend/app/utils/workforce.py | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/backend/app/component/model_validation.py b/backend/app/component/model_validation.py index d734ab92..c0b52ea6 100644 --- a/backend/app/component/model_validation.py +++ b/backend/app/component/model_validation.py @@ -29,7 +29,7 @@ def create_agent( model_type=mtype, api_key=api_key, url=url, - timeout=10, + timeout=60, # 1 minute for validation model_config_dict=model_config_dict, **kwargs, ) @@ -37,6 +37,6 @@ def create_agent( system_message="You are a helpful assistant that must use the tool get_website_content to get the content of a website.", model=model, tools=[get_website_content], - step_timeout=900, + step_timeout=1800, # 30 minutes ) return agent diff --git a/backend/app/controller/chat_controller.py b/backend/app/controller/chat_controller.py index b3aef085..b3b8db9a 100644 --- a/backend/app/controller/chat_controller.py +++ b/backend/app/controller/chat_controller.py @@ -36,8 +36,8 @@ router = APIRouter() # Create traceroot logger for chat controller chat_logger = traceroot.get_logger("chat_controller") -# SSE timeout configuration (30 minutes in seconds) -SSE_TIMEOUT_SECONDS = 30 * 60 +# SSE timeout configuration (60 minutes in seconds) +SSE_TIMEOUT_SECONDS = 60 * 60 async def _cleanup_task_lock_safe(task_lock, reason: str) -> bool: diff --git a/backend/app/service/chat_service.py b/backend/app/service/chat_service.py index a9fdda99..04accf8b 100644 --- a/backend/app/service/chat_service.py +++ b/backend/app/service/chat_service.py @@ -154,7 +154,7 @@ def collect_previous_task_context(working_directory: str, previous_task_content: return "\n".join(context_parts) -def check_conversation_history_length(task_lock: TaskLock, max_length: int = 100000) -> tuple[bool, int]: +def check_conversation_history_length(task_lock: TaskLock, max_length: int = 200000) -> tuple[bool, int]: """ Check if conversation history exceeds maximum length diff --git a/backend/app/service/task.py b/backend/app/service/task.py index 1d9bb76b..d4958dd9 100644 --- a/backend/app/service/task.py +++ b/backend/app/service/task.py @@ -503,7 +503,7 @@ async def _periodic_cleanup(): await asyncio.sleep(300) # Run every 5 minutes current_time = datetime.now() - stale_timeout = timedelta(hours=2) # Consider tasks stale after 2 hours + stale_timeout = timedelta(hours=4) # Consider tasks stale after 4 hours stale_ids = [] for task_id, task_lock in task_locks.items(): diff --git a/backend/app/utils/agent.py b/backend/app/utils/agent.py index fa4bee25..91ef926e 100644 --- a/backend/app/utils/agent.py +++ b/backend/app/utils/agent.py @@ -173,7 +173,7 @@ class ListenChatAgent(ChatAgent): pause_event: asyncio.Event | None = None, prune_tool_calls_from_memory: bool = False, enable_snapshot_clean: bool = False, - step_timeout: float | None = 900, + step_timeout: float | None = 1800, # 30 minutes **kwargs: Any, ) -> None: super().__init__( @@ -805,6 +805,7 @@ def agent_model( api_key=options.api_key, url=options.api_url, model_config_dict=model_config or None, + timeout=600, # 10 minutes **init_params, ) @@ -1855,6 +1856,7 @@ async def mcp_agent(options: Chat): if options.is_cloud() else None ), + timeout=600, # 10 minutes **{ k: v for k, v in (options.extra_params or {}).items() diff --git a/backend/app/utils/workforce.py b/backend/app/utils/workforce.py index 8cb34615..363e6462 100644 --- a/backend/app/utils/workforce.py +++ b/backend/app/utils/workforce.py @@ -61,7 +61,7 @@ class Workforce(BaseWorkforce): graceful_shutdown_timeout=graceful_shutdown_timeout, share_memory=share_memory, use_structured_output_handler=use_structured_output_handler, - task_timeout_seconds=1800, # 30 minutes + task_timeout_seconds=3600, # 60 minutes failure_handling_config=FailureHandlingConfig( enabled_strategies=["retry", "replan"], ),