@@ -18,6 +18,7 @@ use code_tui::test_helpers::{render_chat_widget_to_vt100, ChatWidgetHarness};
1818use std:: collections:: HashMap ;
1919use std:: path:: PathBuf ;
2020use std:: time:: Duration ;
21+ use std:: time:: Instant ;
2122
2223fn next_order_meta ( request_ordinal : u64 , seq : & mut u64 ) -> OrderMeta {
2324 let order = OrderMeta {
@@ -428,7 +429,10 @@ fn queued_exec_end_flushes_after_stream_clears() {
428429 // Stream finishes before the idle-flush callback fires; pending ExecEnd should still flush.
429430 harness. force_stream_clear ( ) ;
430431
431- std:: thread:: sleep ( Duration :: from_millis ( 250 ) ) ;
432+ // Give the flush timers enough headroom under nextest parallelism.
433+ std:: thread:: sleep ( Duration :: from_millis ( 400 ) ) ;
434+ harness. flush_into_widget ( ) ;
435+ std:: thread:: sleep ( Duration :: from_millis ( 200 ) ) ;
432436 harness. flush_into_widget ( ) ;
433437
434438 let output = render_chat_widget_to_vt100 ( & mut harness, 80 , 14 ) ;
@@ -492,15 +496,19 @@ fn background_style_exec_end_with_zero_seq_does_not_get_stuck() {
492496 harness. force_stream_clear ( ) ;
493497
494498 // Flush queued interrupts to deliver begin/end.
495- std:: thread:: sleep ( Duration :: from_millis ( 250 ) ) ;
496- harness. flush_into_widget ( ) ;
497-
498- let output = render_chat_widget_to_vt100 ( & mut harness, 80 , 12 ) ;
499- assert ! (
500- output. contains( "bg" ) && !output. contains( "Running..." ) ,
501- "exec with zero seq end should complete after flush:\n {}" ,
502- output
503- ) ;
499+ let deadline = Instant :: now ( ) + Duration :: from_secs ( 2 ) ;
500+ let mut output;
501+ loop {
502+ std:: thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
503+ harness. flush_into_widget ( ) ;
504+ output = render_chat_widget_to_vt100 ( & mut harness, 80 , 12 ) ;
505+ if output. contains ( "bg" ) && !output. contains ( "Running..." ) {
506+ break ;
507+ }
508+ if Instant :: now ( ) >= deadline {
509+ panic ! ( "exec with zero seq end should complete after flush:\n {}" , output) ;
510+ }
511+ }
504512}
505513
506514#[ test]
0 commit comments