fix: add outbound delivery crash recovery (#15636) (thanks @nabbilkhan) (#15636)

Co-authored-by: Shadow <hi@shadowing.dev>
This commit is contained in:
nabbilkhan
2026-02-13 15:54:07 -06:00
committed by GitHub
parent caebe70e9a
commit 207e2c5aff
6 changed files with 866 additions and 0 deletions

View File

@@ -470,6 +470,18 @@ export async function startGatewayServer(
void cron.start().catch((err) => logCron.error(`failed to start: ${String(err)}`));
// Recover pending outbound deliveries from previous crash/restart.
void (async () => {
const { recoverPendingDeliveries } = await import("../infra/outbound/delivery-queue.js");
const { deliverOutboundPayloads } = await import("../infra/outbound/deliver.js");
const logRecovery = log.child("delivery-recovery");
await recoverPendingDeliveries({
deliver: deliverOutboundPayloads,
log: logRecovery,
cfg: cfgAtStart,
});
})().catch((err) => log.error(`Delivery recovery failed: ${String(err)}`));
const execApprovalManager = new ExecApprovalManager();
const execApprovalForwarder = createExecApprovalForwarder();
const execApprovalHandlers = createExecApprovalHandlers(execApprovalManager, {