@@ -423,3 +423,93 @@ it("shows local receipt and failure without requiring an ACP transcript, and ope
423423 f . dispose ( ) ;
424424 }
425425} ) ;
426+
427+ it ( "dismisses only that agent's error on this message, without changing other work" , ( ) => {
428+ const local = createLocalAgentActivity ( ) ;
429+ const f = fixture ( local ) ;
430+ const onFocusedRemoval = vi . fn ( ) ;
431+ const view = render (
432+ < ActivityAccessory { ...f . props } onFocusedRemoval = { onFocusedRemoval } /> ,
433+ ) ;
434+ const begin = ( agent : string , messageId : string ) =>
435+ local . begin ( {
436+ scope : "test" ,
437+ channelId : "c" ,
438+ threadRootId : root ,
439+ messageId,
440+ agent,
441+ } ) ;
442+ try {
443+ act ( ( ) => {
444+ begin ( A , root ) . finish ( {
445+ ok : false ,
446+ error : "Provider unavailable after a long and detailed reason" ,
447+ } ) ;
448+ begin ( A , next ) . finish ( { ok : false , error : "Elsewhere" } ) ;
449+ begin ( B , root ) . step ( "Read" , "notes.txt" ) ;
450+ } ) ;
451+ fireEvent . click (
452+ screen . getByRole ( "button" , { name : / V i e w a g e n t a c t i v i t y / } ) ,
453+ ) ;
454+ expect (
455+ screen . getByText ( "Provider unavailable after a long and detailed reason" )
456+ . parentElement ,
457+ ) . toHaveAttribute ( "data-error" ) ;
458+ expect (
459+ screen . queryByRole ( "button" , { name : "Dismiss error from Bubbles" } ) ,
460+ ) . toBeNull ( ) ;
461+ fireEvent . click (
462+ screen . getByRole ( "button" , { name : "Dismiss error from Blossom" } ) ,
463+ ) ;
464+ expect ( f . props . open ) . not . toHaveBeenCalled ( ) ;
465+ expect ( onFocusedRemoval ) . not . toHaveBeenCalled ( ) ;
466+ expect (
467+ screen . getByRole ( "button" , { name : "View activity for Bubbles" } ) ,
468+ ) . toBeInTheDocument ( ) ;
469+ expect (
470+ screen . queryByRole ( "button" , { name : "View activity for Blossom" } ) ,
471+ ) . toBeNull ( ) ;
472+ expect (
473+ local . reader
474+ . work ( )
475+ . filter ( ( row ) => row . agent === A )
476+ . map ( ( row ) => [ row . messageId , row . state ] ) ,
477+ ) . toEqual ( [ [ next , "error" ] ] ) ;
478+ } finally {
479+ view . unmount ( ) ;
480+ f . dispose ( ) ;
481+ }
482+ } ) ;
483+
484+ it ( "moves focus out when dismissing the last error removes the bubble" , ( ) => {
485+ const local = createLocalAgentActivity ( ) ;
486+ const f = fixture ( local ) ;
487+ const onFocusedRemoval = vi . fn ( ) ;
488+ const view = render (
489+ < ActivityAccessory { ...f . props } onFocusedRemoval = { onFocusedRemoval } /> ,
490+ ) ;
491+ try {
492+ act ( ( ) => {
493+ local
494+ . begin ( {
495+ scope : "test" ,
496+ channelId : "c" ,
497+ threadRootId : root ,
498+ messageId : root ,
499+ agent : A ,
500+ } )
501+ . finish ( { ok : false , error : "Provider unavailable" } ) ;
502+ } ) ;
503+ fireEvent . click (
504+ screen . getByRole ( "button" , { name : / V i e w a g e n t a c t i v i t y / } ) ,
505+ ) ;
506+ fireEvent . click (
507+ screen . getByRole ( "button" , { name : "Dismiss error from Blossom" } ) ,
508+ ) ;
509+ expect ( onFocusedRemoval ) . toHaveBeenCalledOnce ( ) ;
510+ expect ( screen . queryByText ( "Provider unavailable" ) ) . toBeNull ( ) ;
511+ } finally {
512+ view . unmount ( ) ;
513+ f . dispose ( ) ;
514+ }
515+ } ) ;
0 commit comments