From 4c7132728a1bb678ff716476b54b56fbd3d78867 Mon Sep 17 00:00:00 2001 From: Simon Axelsson Date: Mon, 7 Sep 2026 17:55:10 +0200 Subject: [PATCH] fix: use raw AUD0 client in outbox dispatcher --- app/api/0pt/internal/evidence-outbox/dispatch/route.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/0pt/internal/evidence-outbox/dispatch/route.ts b/app/api/0pt/internal/evidence-outbox/dispatch/route.ts index 496236c..585996d 100644 --- a/app/api/0pt/internal/evidence-outbox/dispatch/route.ts +++ b/app/api/0pt/internal/evidence-outbox/dispatch/route.ts @@ -44,7 +44,11 @@ export async function POST(request: NextRequest) { } const repo = repository(); - const dispatcher = new Aud0OutboxDispatcher(repo, createAud0Client()); + // CRITICAL: the dispatcher must bypass the durable wrapper. Using the + // default client here would enqueue the event again and could create an + // infinite outbox loop instead of delivering to AUD0. + const rawAud0 = createAud0Client(undefined, { durable: false }); + const dispatcher = new Aud0OutboxDispatcher(repo, rawAud0); const result = await dispatcher.sweep(limit); const stats = await repo.stats(); return NextResponse.json({ result, stats });