diff --git a/packages/engine/src/notification/notification-service.ts b/packages/engine/src/notification/notification-service.ts index d688d89fd..392135b03 100644 --- a/packages/engine/src/notification/notification-service.ts +++ b/packages/engine/src/notification/notification-service.ts @@ -62,7 +62,7 @@ export class NotificationService { private readonly failedNotificationGraceMs: number; private failureNotificationSuppressedCount = 0; private failureNotificationDelayMs = 60_000; - private failureNotificationMode: "sticky-only" | "all" = "sticky-only"; + private failureNotificationMode: "sticky-only" | "all" | "terminal-only" = "sticky-only"; constructor( private readonly store: NotificationServiceStore, @@ -168,7 +168,7 @@ export class NotificationService { } if (task.status === "failed") { - if (this.failureNotificationMode === "all" || this.failureNotificationDelayMs === 0) { + if (this.failureNotificationMode === "all") { this.maybeNotify(task.id, "failed", this.createTaskPayload(task, "failed")); } else { this.scheduleFailureNotification(task); @@ -564,6 +564,13 @@ export class NotificationService { return; } + const isTerminal = task.paused === true || task.column === "in-review"; + if (this.failureNotificationMode === "terminal-only" && !isTerminal) { + this.failureNotificationSuppressedCount += 1; + schedulerLog.log(`[notify] ${taskId} non-terminal failure — suppressed (mode=terminal-only)`); + return; + } + const pausedTask = task as Task & { pausedReason?: string }; let eventType: NotificationEvent = "failed"; if (