File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -70,9 +70,19 @@ pub fn format_exec_output_for_model_freeform(
7070 // round to 1 decimal place
7171 let duration_seconds = ( ( exec_output. duration . as_secs_f32 ( ) ) * 10.0 ) . round ( ) / 10.0 ;
7272
73- let total_lines = exec_output. aggregated_output . text . lines ( ) . count ( ) ;
73+ let content = if exec_output. timed_out {
74+ format ! (
75+ "command timed out after {} milliseconds\n {}" ,
76+ exec_output. duration. as_millis( ) ,
77+ exec_output. aggregated_output. text
78+ )
79+ } else {
80+ exec_output. aggregated_output . text . clone ( )
81+ } ;
82+
83+ let total_lines = content. lines ( ) . count ( ) ;
7484
75- let formatted_output = truncate_text ( & exec_output . aggregated_output . text , truncation_policy) ;
85+ let formatted_output = truncate_text ( & content , truncation_policy) ;
7686
7787 let mut sections = Vec :: new ( ) ;
7888
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ async fn shell_command_times_out_with_timeout_ms() -> anyhow::Result<()> {
219219 . replace ( '\r' , "\n " )
220220 . trim_end_matches ( '\n' )
221221 . to_string ( ) ;
222- let expected_pattern = r"(?s)^Exit code: 124\nWall time: [0-9]+(?:\.[0-9]+)? seconds\nOutput:(?: \ncommand timed out after [0-9]+ milliseconds)? \n?$" ;
222+ let expected_pattern = r"(?s)^Exit code: 124\nWall time: [0-9]+(?:\.[0-9]+)? seconds\nOutput:\ncommand timed out after [0-9]+ milliseconds\n?$" ;
223223 assert_regex_match ( expected_pattern, & normalized_output) ;
224224
225225 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments