@@ -86,6 +86,58 @@ describe("workEntryIndicatesToolFailure", () => {
8686 ) . toBe ( false ) ;
8787 } ) ;
8888
89+ it . each ( [
90+ "FILE NOT FOUND" ,
91+ "No files found" ,
92+ "ENOENT" ,
93+ "No such file or directory" ,
94+ "No such file" ,
95+ "CommandNotFoundException" ,
96+ "Command not found" ,
97+ "Cannot find path 'example'\nbecause it does not exist" ,
98+ "The term 'example'\nis not recognized" ,
99+ "Is not recognized as the name of a cmdlet" ,
100+ "A parameter cannot be found that matches parameter name" ,
101+ "<exited with exit code 12>" ,
102+ "Exited with exit code\t2" ,
103+ "Exit with exit code 1" ,
104+ "Exit code: 9" ,
105+ "Exit code\n3" ,
106+ ] ) ( "detects an error after a long successful output: %s" , ( error ) => {
107+ const entry = {
108+ ...base ,
109+ tone : "tool" as const ,
110+ toolLifecycleStatus : "completed" ,
111+ detail : `${ "Synthetic successful output.\n" . repeat ( 512 ) } ${ error } ` ,
112+ } ;
113+ expect ( workEntryIndicatesToolFailure ( entry ) ) . toBe ( true ) ;
114+ expect ( workEntryDisplayIndicatesToolFailure ( entry ) ) . toBe ( true ) ;
115+ } ) ;
116+
117+ it . each ( [
118+ "Cannot find path" ,
119+ "Because it does not exist" ,
120+ "Is not recognized" ,
121+ "The term 'example'" ,
122+ "<exited with exit code 0>" ,
123+ "Exit code: 0" ,
124+ "Exit code: -1" ,
125+ "Exit code: 12things" ,
126+ ] ) ( "keeps incomplete or non-failure markers successful: %s" , ( detail ) => {
127+ expect ( workEntryIndicatesToolFailure ( { ...base , tone : "tool" , detail } ) ) . toBe ( false ) ;
128+ } ) ;
129+
130+ it ( "matches paired failure phrases across legacy detail and command fields" , ( ) => {
131+ const entry = {
132+ ...base ,
133+ tone : "tool" as const ,
134+ detail : "Cannot find path 'example'" ,
135+ command : "Because it does not exist" ,
136+ } ;
137+ expect ( workEntryIndicatesToolFailure ( entry ) ) . toBe ( true ) ;
138+ expect ( workEntryDisplayIndicatesToolFailure ( entry ) ) . toBe ( false ) ;
139+ } ) ;
140+
89141 it ( "does not treat error text in a command as rendered failure" , ( ) => {
90142 const entry = {
91143 label : "Ran command" ,
0 commit comments