From 60487018cea423e37549537bce13ff648bc11cff Mon Sep 17 00:00:00 2001 From: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Date: Wed, 2 Sep 2026 13:17:16 +0200 Subject: [PATCH] fix(health): stop gating HTTP status on AI vendor health The `?strict=1` mode 503'd when the LLM chain was down, even though a dead vendor key can't be fixed by restarting the process. A monitoring system that restarts on a failing health check would loop pointlessly on a problem restarting can't solve. Health status is now always 200 once the process is up; `llm` stays in the response body as an informational field. `strict` had no other purpose, so its handling is removed entirely rather than left as dead branching. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG --- src/app/api/health/route.ts | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/app/api/health/route.ts b/src/app/api/health/route.ts index ea2172f..a494e5c 100644 --- a/src/app/api/health/route.ts +++ b/src/app/api/health/route.ts @@ -1,29 +1,19 @@ -// GET /api/health — liveness by default; add ?strict=1 for readiness. -// -// A dead LLM key must never fail the check a kill-and-restart decision reads: -// restarting the process can't fix someone else's outage. So the plain check -// always returns 200 once the process is up, carrying `llm` as information -// only. `?strict=1` is the opt-in for a caller that actually wants to know -// whether analysis currently works — it 503s only when the chain has been -// down for `downAfter` consecutive requests. +// GET /api/health — liveness. A dead LLM key must never fail the check a +// kill-and-restart decision reads: restarting the process can't fix someone +// else's outage. Always 200 once the process is up; `llm` is informational. -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; import { getLLMHealth } from "@/lib/health"; -export async function GET(req: NextRequest) { +export async function GET() { const llm = getLLMHealth(); - const strict = req.nextUrl.searchParams.get("strict") === "1"; - const status = strict && llm.status === "down" ? 503 : 200; - return NextResponse.json( - { - success: true, - data: { - status: status === 200 ? "healthy" : "unhealthy", - llm, - timestamp: new Date().toISOString(), - }, + return NextResponse.json({ + success: true, + data: { + status: "healthy", + llm, + timestamp: new Date().toISOString(), }, - { status }, - ); + }); }