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 });