feat(FN-5046): complete Step 2 — add terminal-only failure suppression

Fusion-Task-Id: FN-5046
Fusion-Task-Lineage: 0748fd0e-70c3-44b9-a599-0df5255d4d60
This commit is contained in:
Fusion (runfusion.ai)
2026-05-18 07:18:10 -07:00
committed by gsxdsm
parent 6b13cab5d8
commit 7167eebe6b

View File

@@ -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 (