diff --git a/src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts b/src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts index 4869610dadb..ebb6f8a6dc1 100644 --- a/src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts +++ b/src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts @@ -288,8 +288,9 @@ describe("runCronIsolatedAgentTurn", () => { // Announce delivery failure should not mark a successful agent execution // as error. The execution succeeded; only delivery failed. expect(res.status).toBe("ok"); - expect(res.delivered).not.toBe(true); + expect(res.delivered).toBe(false); expect(res.deliveryAttempted).toBe(true); + expect(res.error).toBe("cron announce delivery failed"); expect(deps.sendMessageTelegram).not.toHaveBeenCalled(); }); }); @@ -345,8 +346,9 @@ describe("runCronIsolatedAgentTurn", () => { // Even when announce throws (e.g. "pairing required"), the agent // execution succeeded so the job status should be ok. expect(res.status).toBe("ok"); - expect(res.delivered).not.toBe(true); + expect(res.delivered).toBe(false); expect(res.deliveryAttempted).toBe(true); + expect(res.error).toContain("pairing required"); expect(deps.sendMessageTelegram).not.toHaveBeenCalled(); }); }); diff --git a/src/cron/isolated-agent/delivery-dispatch.ts b/src/cron/isolated-agent/delivery-dispatch.ts index 9f7fb016e49..db8f03d383a 100644 --- a/src/cron/isolated-agent/delivery-dispatch.ts +++ b/src/cron/isolated-agent/delivery-dispatch.ts @@ -337,6 +337,8 @@ export async function dispatchCronDelivery( status: "ok", summary, outputText, + error: message, + delivered: false, deliveryAttempted, ...params.telemetry, }); @@ -351,6 +353,8 @@ export async function dispatchCronDelivery( status: "ok", summary, outputText, + error: String(err), + delivered: false, deliveryAttempted, ...params.telemetry, });