File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -304,14 +304,20 @@ export const runBrowserAutomation = task({
304304 data : { status : 'failed' } ,
305305 } ) ;
306306
307- // Send email notifications
308- await sendTaskStatusChangeEmails ( {
309- organizationId,
310- taskId,
311- taskTitle,
312- oldStatus,
313- newStatus : 'failed' ,
314- } ) ;
307+ // Only send email notifications if status actually changed
308+ if ( oldStatus !== 'failed' ) {
309+ await sendTaskStatusChangeEmails ( {
310+ organizationId,
311+ taskId,
312+ taskTitle,
313+ oldStatus,
314+ newStatus : 'failed' ,
315+ } ) ;
316+ } else {
317+ logger . info (
318+ `Skipping notification: task ${ taskId } was already in failed status` ,
319+ ) ;
320+ }
315321 }
316322 }
317323
Original file line number Diff line number Diff line change @@ -407,14 +407,20 @@ export const runTaskIntegrationChecks = task({
407407 `Task ${ taskId } marked as failed due to ${ totalFindings } findings${ hasFailedChecks ? ' and failed checks' : '' } ` ,
408408 ) ;
409409
410- // Send email notifications
411- await sendTaskStatusChangeEmails ( {
412- organizationId,
413- taskId,
414- taskTitle,
415- oldStatus,
416- newStatus : 'failed' ,
417- } ) ;
410+ // Only send email notifications if status actually changed
411+ if ( oldStatus !== 'failed' ) {
412+ await sendTaskStatusChangeEmails ( {
413+ organizationId,
414+ taskId,
415+ taskTitle,
416+ oldStatus,
417+ newStatus : 'failed' ,
418+ } ) ;
419+ } else {
420+ logger . info (
421+ `Skipping notification: task ${ taskId } was already in failed status` ,
422+ ) ;
423+ }
418424 } else if ( totalPassing > 0 ) {
419425 // Only update to done if not already done
420426 const currentTask = await db . task . findUnique ( {
You can’t perform that action at this time.
0 commit comments