fix: mark silent NO_REPLY direct deliveries as delivered

This commit is contained in:
openperf 2026-03-14 13:13:47 +08:00
parent d4d7af3400
commit 8151abb0ad
2 changed files with 13 additions and 6 deletions

View File

@ -426,8 +426,8 @@ describe("dispatchCronDelivery — double-announce guard", () => {
// NO_REPLY must be filtered out before reaching the outbound adapter.
expect(deliverOutboundPayloads).not.toHaveBeenCalled();
// No delivery was sent, so delivered stays false.
expect(state.delivered).toBe(false);
// Mark as silently delivered so the job is persisted as successful.
expect(state.delivered).toBe(true);
// deliveryAttempted must be true so the heartbeat timer does not fire
// a fallback enqueueSystemEvent with the NO_REPLY sentinel text.
expect(state.deliveryAttempted).toBe(true);
@ -454,7 +454,7 @@ describe("dispatchCronDelivery — double-announce guard", () => {
const state = await dispatchCronDelivery(params);
expect(deliverOutboundPayloads).not.toHaveBeenCalled();
expect(state.delivered).toBe(false);
expect(state.delivered).toBe(true);
expect(state.deliveryAttempted).toBe(true);
expect(

View File

@ -325,10 +325,17 @@ export async function dispatchCronDelivery(
(p) => !isSilentReplyText(p.text, SILENT_REPLY_TOKEN),
);
if (payloadsForDelivery.length === 0) {
// Mark attempted so the heartbeat timer does not fire a fallback
// enqueueSystemEvent with the NO_REPLY sentinel text.
// Mark as silently delivered so the heartbeat timer does not fire a fallback
// and the job is persisted as successfully delivered.
deliveryAttempted = true;
return null;
delivered = true;
return params.withRunSession({
status: "ok",
summary,
outputText,
delivered: true,
...params.telemetry,
});
}
if (params.isAborted()) {
return params.withRunSession({