From b33a57fba967d4382666f05ae53d02406bdfed33 Mon Sep 17 00:00:00 2001 From: Evgeny Zislis Date: Mon, 2 Mar 2026 03:05:40 +0200 Subject: [PATCH] fix(cron): avoid forcing announce mode and clear inherited to on mode change - UI: only include mode in patch if explicitly set to non-default - delivery.ts: clear inherited 'to' when job overrides mode, since URL semantics differ between announce and webhook modes --- src/cron/delivery.ts | 5 +++++ ui/src/ui/controllers/cron.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cron/delivery.ts b/src/cron/delivery.ts index 96864f0e74a..903abf8db5e 100644 --- a/src/cron/delivery.ts +++ b/src/cron/delivery.ts @@ -165,6 +165,11 @@ export function resolveFailureDestination( accountId = jobAccountId; } if (jobMode !== undefined) { + // Mode was explicitly overridden - clear inherited 'to' since URL semantics differ + // between announce (channel recipient) and webhook (HTTP endpoint) + if (globalConfig?.mode !== jobMode) { + to = undefined; + } mode = jobMode; } } diff --git a/ui/src/ui/controllers/cron.ts b/ui/src/ui/controllers/cron.ts index 550ad2b6f39..26682506347 100644 --- a/ui/src/ui/controllers/cron.ts +++ b/ui/src/ui/controllers/cron.ts @@ -601,14 +601,18 @@ function buildFailureAlert(form: CronFormState) { : undefined; const deliveryMode = form.failureAlertDeliveryMode; const accountId = form.failureAlertAccountId.trim(); - return { + const patch: Record = { after: after > 0 ? Math.floor(after) : undefined, channel: form.failureAlertChannel.trim() || CRON_CHANNEL_LAST, to: form.failureAlertTo.trim() || undefined, ...(cooldownMs !== undefined ? { cooldownMs } : {}), - ...(deliveryMode ? { mode: deliveryMode } : {}), ...(accountId ? { accountId } : {}), }; + // Only include mode if explicitly set to non-default value + if (deliveryMode && deliveryMode !== "announce") { + patch.mode = deliveryMode; + } + return patch; } export async function addCronJob(state: CronState) {