diff --git a/src/sse/handlers/chat.ts b/src/sse/handlers/chat.ts index 941d9f5290..778f6b2883 100644 --- a/src/sse/handlers/chat.ts +++ b/src/sse/handlers/chat.ts @@ -1058,8 +1058,8 @@ async function handleSingleModelChat( getTargetFormat(provider, credentials.providerSpecificData) || targetFormat; - // 5. Log proxy + translation events - safeLogEvents({ + // 5. Log proxy + translation events (fire-and-forget; never blocks the response) + void safeLogEvents({ result, proxyInfo, proxyLatency, diff --git a/src/sse/handlers/chatHelpers.ts b/src/sse/handlers/chatHelpers.ts index 3c4756d7ce..678a387de6 100644 --- a/src/sse/handlers/chatHelpers.ts +++ b/src/sse/handlers/chatHelpers.ts @@ -592,7 +592,9 @@ export async function safeResolveProxy(connectionId: string, apiKeyId?: string) } } -export function safeLogEvents({ +// Async because the egress-IP lookup lazy-imports proxyEgress; callers treat +// this as fire-and-forget logging (the internal try/catch swallows everything). +export async function safeLogEvents({ result, proxyInfo, proxyLatency,