Merge pull request #453 from diegosouzapw/fix/issue-449-450-pino-docker-responses-worker

fix: pino Docker crash + Codex /v1/responses worker exit + package-lock sync
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-03-18 15:11:38 -03:00
committed by GitHub
3 changed files with 15 additions and 14 deletions

View File

@@ -32,6 +32,10 @@ COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/standalone ./
# Explicitly copy @swc/helpers — not always traced by standalone output but needed at runtime
COPY --from=builder /app/node_modules/@swc/helpers ./node_modules/@swc/helpers
# Explicitly copy pino transport dependencies — pino spawns a worker that requires
# pino-abstract-transport at runtime; Next.js standalone trace does not capture it (#449)
COPY --from=builder /app/node_modules/pino-abstract-transport ./node_modules/pino-abstract-transport
COPY --from=builder /app/node_modules/pino-pretty ./node_modules/pino-pretty
COPY --from=builder /app/scripts/run-standalone.mjs ./run-standalone.mjs
COPY --from=builder /app/scripts/runtime-env.mjs ./runtime-env.mjs
COPY --from=builder /app/scripts/bootstrap-env.mjs ./bootstrap-env.mjs

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "omniroute",
"version": "2.7.0",
"version": "2.7.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "omniroute",
"version": "2.7.0",
"version": "2.7.2",
"hasInstallScript": true,
"license": "MIT",
"workspaces": [

View File

@@ -1,16 +1,14 @@
import { CORS_ORIGIN } from "@/shared/utils/cors";
import { handleChat } from "@/sse/handlers/chat";
import { initTranslators } from "@omniroute/open-sse/translator/index.ts";
let initialized = false;
async function ensureInitialized() {
if (!initialized) {
await initTranslators();
initialized = true;
console.log("[SSE] Translators initialized for /v1/responses");
}
}
// NOTE: We do NOT call initTranslators() here — the translator registry is
// bootstrapped at module level inside open-sse/translator/index.ts when it
// is first imported. Calling it again from a Next.js Route Handler caused a
// "the worker has exited" uncaughtException crash on Codex CLI requests (#450)
// because the dynamic import runs in a Next.js server worker context where
// certain Node APIs used by the translator bootstrap are not available.
// The translators are always initialized via the open-sse side (chatCore),
// so /v1/responses just delegates to handleChat which handles everything.
export async function OPTIONS() {
return new Response(null, {
@@ -24,9 +22,8 @@ export async function OPTIONS() {
/**
* POST /v1/responses - OpenAI Responses API format
* Now handled by translator pattern (openai-responses format auto-detected)
* Handled by the unified chat handler (openai-responses format auto-detected).
*/
export async function POST(request) {
await ensureInitialized();
return await handleChat(request);
}