File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -2340,9 +2340,6 @@ mod tests {
23402340 assert_eq ! ( expected, got) ;
23412341 }
23422342
2343- // Truncation tests have moved to conversation_history where
2344- // the model-facing formatting now lives.
2345-
23462343 #[ test]
23472344 fn includes_timed_out_message ( ) {
23482345 let exec = ExecToolCallOutput {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ pub mod runtimes;
99pub mod sandboxing;
1010pub mod spec;
1111
12+ use crate :: conversation_history:: format_exec_output;
1213use crate :: exec:: ExecToolCallOutput ;
1314pub use router:: ToolRouter ;
1415use serde:: Serialize ;
@@ -64,13 +65,15 @@ pub fn format_exec_output_str(exec_output: &ExecToolCallOutput) -> String {
6465
6566 let content = aggregated_output. text . as_str ( ) ;
6667
67- if exec_output. timed_out {
68- let prefixed = format ! (
68+ let body = if exec_output. timed_out {
69+ format ! (
6970 "command timed out after {} milliseconds\n {content}" ,
7071 exec_output. duration. as_millis( )
71- ) ;
72- return prefixed;
73- }
72+ )
73+ } else {
74+ content. to_string ( )
75+ } ;
7476
75- content. to_string ( )
77+ // Truncate for model consumption before serialization.
78+ format_exec_output ( & body)
7679}
You can’t perform that action at this time.
0 commit comments