mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-18 21:40:53 +00:00
fix(cron): preserve explicit to on mode override and always include mode in UI patches
- delivery.ts: preserve job-level explicit 'to' when overriding mode - UI: always include mode in failureAlert patch so users can switch between announce/webhook
This commit is contained in:
committed by
Tak Hoffman
parent
b33a57fba9
commit
62f71fa401
@@ -154,6 +154,9 @@ export function resolveFailureDestination(
|
||||
const jobAccountId = normalizeAccountId(jobFailureDest.accountId);
|
||||
const jobMode = normalizeFailureMode(jobFailureDest.mode);
|
||||
|
||||
// Track if 'to' was explicitly set at job level
|
||||
const jobToExplicit = "to" in jobFailureDest && jobFailureDest.to !== undefined;
|
||||
|
||||
// Only override if explicitly set (not undefined)
|
||||
if (jobChannel !== undefined) {
|
||||
channel = jobChannel;
|
||||
@@ -167,7 +170,8 @@ export function resolveFailureDestination(
|
||||
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) {
|
||||
// But preserve explicit 'to' that was set at job level
|
||||
if (!jobToExplicit && globalConfig?.mode !== jobMode) {
|
||||
to = undefined;
|
||||
}
|
||||
mode = jobMode;
|
||||
|
||||
@@ -608,8 +608,8 @@ function buildFailureAlert(form: CronFormState) {
|
||||
...(cooldownMs !== undefined ? { cooldownMs } : {}),
|
||||
...(accountId ? { accountId } : {}),
|
||||
};
|
||||
// Only include mode if explicitly set to non-default value
|
||||
if (deliveryMode && deliveryMode !== "announce") {
|
||||
// Always include mode so users can switch between webhook/announce
|
||||
if (deliveryMode) {
|
||||
patch.mode = deliveryMode;
|
||||
}
|
||||
return patch;
|
||||
|
||||
Reference in New Issue
Block a user