|
5 | 5 | normalizeOptionalThreadValue, |
6 | 6 | } from "@openclaw/normalization-core/string-coerce"; |
7 | 7 | import { normalizeAgentId } from "../../routing/session-key.js"; |
| 8 | +import { resolveCronDeliveryPlan } from "../delivery-plan.js"; |
8 | 9 | import { parseAbsoluteTimeMs } from "../parse.js"; |
9 | 10 | import { |
10 | 11 | coerceFiniteScheduleNumber, |
@@ -959,7 +960,8 @@ export function applyJobPatch( |
959 | 960 | job.payload = mergeCronPayload(job.payload, patch.payload); |
960 | 961 | } |
961 | 962 | if (patch.delivery) { |
962 | | - job.delivery = mergeCronDelivery(job.delivery, patch.delivery); |
| 963 | + const implicitMode = resolveCronDeliveryPlan(job).mode; |
| 964 | + job.delivery = mergeCronDelivery(job.delivery, patch.delivery, implicitMode); |
963 | 965 | } |
964 | 966 | if ("failureAlert" in patch) { |
965 | 967 | job.failureAlert = mergeCronFailureAlert(job.failureAlert, patch.failureAlert); |
@@ -1231,10 +1233,11 @@ function buildPayloadFromPatch(patch: CronPayloadPatch): CronPayload { |
1231 | 1233 | function mergeCronDelivery( |
1232 | 1234 | existing: CronDelivery | undefined, |
1233 | 1235 | patch: CronDeliveryPatch, |
| 1236 | + implicitMode: CronDelivery["mode"], |
1234 | 1237 | ): CronDelivery | undefined { |
1235 | 1238 | const hasCompletionDestinationPatch = "completionDestination" in patch; |
1236 | 1239 | const next: CronDelivery = { |
1237 | | - mode: existing?.mode ?? "none", |
| 1240 | + mode: existing?.mode ?? implicitMode, |
1238 | 1241 | channel: existing?.channel, |
1239 | 1242 | to: existing?.to, |
1240 | 1243 | threadId: existing?.threadId, |
@@ -1338,7 +1341,6 @@ function mergeCronDelivery( |
1338 | 1341 | if ( |
1339 | 1342 | existing === undefined && |
1340 | 1343 | !("mode" in patch) && |
1341 | | - next.mode === "none" && |
1342 | 1344 | next.channel === undefined && |
1343 | 1345 | next.to === undefined && |
1344 | 1346 | next.threadId === undefined && |
|
0 commit comments