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) {