File tree Expand file tree Collapse file tree
src/cortex-tui/src/runner/event_loop Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33use std:: time:: { Duration , Instant } ;
44
5+ /// Connection timeout for subagent streaming requests.
6+ /// Higher than main streaming to allow for subagent initialization.
7+ const SUBAGENT_CONNECTION_TIMEOUT : Duration = Duration :: from_secs ( 120 ) ;
8+
9+ /// Per-event timeout during subagent responses.
10+ /// Higher than main streaming to account for longer tool executions.
11+ const SUBAGENT_EVENT_TIMEOUT : Duration = Duration :: from_secs ( 60 ) ;
12+
513use crate :: app:: SubagentTaskDisplay ;
614use crate :: events:: { SubagentEvent , ToolEvent } ;
715use crate :: session:: StoredToolCall ;
@@ -210,7 +218,7 @@ impl EventLoop {
210218 } ;
211219
212220 let stream_result =
213- tokio:: time:: timeout ( Duration :: from_secs ( 120 ) , client. complete ( request) ) . await ;
221+ tokio:: time:: timeout ( SUBAGENT_CONNECTION_TIMEOUT , client. complete ( request) ) . await ;
214222
215223 let mut stream = match stream_result {
216224 Ok ( Ok ( s) ) => s,
@@ -252,7 +260,7 @@ impl EventLoop {
252260 let mut iteration_tool_calls: Vec < ( String , String , serde_json:: Value ) > = Vec :: new ( ) ;
253261
254262 loop {
255- let event = tokio:: time:: timeout ( Duration :: from_secs ( 60 ) , stream. next ( ) ) . await ;
263+ let event = tokio:: time:: timeout ( SUBAGENT_EVENT_TIMEOUT , stream. next ( ) ) . await ;
256264
257265 match event {
258266 Ok ( Some ( Ok ( ResponseEvent :: Delta ( delta) ) ) ) => {
You can’t perform that action at this time.
0 commit comments