mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-23 07:51:33 +00:00
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
This commit is contained in:
committed by
Tak Hoffman
parent
21f0b5b6a2
commit
b33a57fba9
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,14 +601,18 @@ function buildFailureAlert(form: CronFormState) {
|
||||
: undefined;
|
||||
const deliveryMode = form.failureAlertDeliveryMode;
|
||||
const accountId = form.failureAlertAccountId.trim();
|
||||
return {
|
||||
const patch: Record<string, unknown> = {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user