@@ -2009,7 +2009,14 @@ fn run_loop(config: ResolvedConfig, identity: RunIdentity) -> Result<()> {
20092009 } ;
20102010 let hash = hash_output ( & output) ;
20112011 let last_hash = last_hash_by_target. get ( target) . cloned ( ) . unwrap_or_default ( ) ;
2012- if should_skip_scan_by_hash ( config. trigger_edge , & hash, & last_hash) {
2012+ let has_pending_confirm =
2013+ has_pending_confirm_for_target ( & trigger_confirm_pending_since, target) ;
2014+ if should_skip_scan_by_hash (
2015+ config. trigger_edge ,
2016+ & hash,
2017+ & last_hash,
2018+ has_pending_confirm,
2019+ ) {
20132020 continue ;
20142021 }
20152022
@@ -2788,8 +2795,21 @@ fn confirm_window_elapsed(
27882795 false
27892796}
27902797
2791- fn should_skip_scan_by_hash ( trigger_edge_enabled : bool , hash : & str , last_hash : & str ) -> bool {
2792- trigger_edge_enabled && hash == last_hash
2798+ fn has_pending_confirm_for_target (
2799+ pending_since : & std:: collections:: HashMap < String , std:: time:: Instant > ,
2800+ target : & str ,
2801+ ) -> bool {
2802+ let prefix = format ! ( "{target}|" ) ;
2803+ pending_since. keys ( ) . any ( |key| key. starts_with ( & prefix) )
2804+ }
2805+
2806+ fn should_skip_scan_by_hash (
2807+ trigger_edge_enabled : bool ,
2808+ hash : & str ,
2809+ last_hash : & str ,
2810+ has_pending_confirm : bool ,
2811+ ) -> bool {
2812+ trigger_edge_enabled && hash == last_hash && !has_pending_confirm
27932813}
27942814
27952815fn extract_trigger_preview ( output : & str , max_lines : usize , use_unicode : bool ) -> ( usize , String ) {
@@ -4963,9 +4983,21 @@ mod tests {
49634983
49644984 #[ test]
49654985 fn hash_skip_depends_on_trigger_edge_mode ( ) {
4966- assert ! ( should_skip_scan_by_hash( true , "same" , "same" ) ) ;
4967- assert ! ( !should_skip_scan_by_hash( false , "same" , "same" ) ) ;
4968- assert ! ( !should_skip_scan_by_hash( true , "new" , "old" ) ) ;
4986+ assert ! ( should_skip_scan_by_hash( true , "same" , "same" , false ) ) ;
4987+ assert ! ( !should_skip_scan_by_hash( true , "same" , "same" , true ) ) ;
4988+ assert ! ( !should_skip_scan_by_hash( false , "same" , "same" , false ) ) ;
4989+ assert ! ( !should_skip_scan_by_hash( true , "new" , "old" , false ) ) ;
4990+ }
4991+
4992+ #[ test]
4993+ fn pending_confirm_detected_per_target ( ) {
4994+ let mut pending = std:: collections:: HashMap :: new ( ) ;
4995+ let now = std:: time:: Instant :: now ( ) ;
4996+ pending. insert ( "ai:7.0|inline|0" . to_string ( ) , now) ;
4997+ pending. insert ( "other:1.0|inline|0" . to_string ( ) , now) ;
4998+ assert ! ( has_pending_confirm_for_target( & pending, "ai:7.0" ) ) ;
4999+ assert ! ( has_pending_confirm_for_target( & pending, "other:1.0" ) ) ;
5000+ assert ! ( !has_pending_confirm_for_target( & pending, "ai:8.0" ) ) ;
49695001 }
49705002
49715003 #[ test]
0 commit comments