fix(health): stop gating HTTP status on AI vendor health in strict mode - #173
Merged
Conversation
?strict=1 turned an LLM outage into an HTTP 503 for the health endpoint, which a monitoring/orchestration system reading that status would treat as a reason to restart the process -- but a dead API key or exhausted free-tier budget can't be fixed by a restart, so that's a pointless restart loop for a problem restarting can't solve. Liveness now always answers 200 once the database is reachable; LLM state stays in the body as an informational field, unconditionally. The strict param existed only to drive this gating, so it's removed rather than left as dead branching. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/health?strict=1returned HTTP 503 whenever the LLM chain was reported "down" -- a monitoring/orchestration system alerting or acting on that status code would treat it as a reason to restart the process, but a dead API key or exhausted free-tier budget can't be fixed by a restart. That's a pointless restart loop for a problem restarting can't solve.strictparam existed only to drive this 503 gating, so it's removed entirely rather than left as dead branching.tests/__tests__/lib/llm-health.test.tsthat asserted the old strict/readiness split to instead assert the route never gates HTTP status on LLM state and no longer referencesstrict.Note: this repo had a deliberate, previously-merged design (PR #153, 2026-08-28) splitting liveness (default, always 200) from readiness (
?strict=1, 503 on LLM down, "point alerting here"). That design was reasoned and tested, not an oversight -- but per the standing fleet-wide rule (a health endpoint must never let AI/LLM vendor status drive its HTTP status, since nothing wired to it can act on that signal usefully), it's being closed the same way as the other two repos with this pattern.strict=1was confirmed dormant -- nothing in this repo's deploy/CI/monitoring config currently passes it.Test plan
npm run typecheck-- cleannpm run check:selfhost-- cleannpm run test-- 274 passed, 2 skipped (including the updated health guard test)npm run build-- succeedsnpx eslinton the two changed files -- clean (full-reponpm run lintis currently broken by an unrelated stray git worktree from a concurrent session under.claude/worktrees/, reproduced onmainwith this change stashed -- not caused by this PR; CI runs a clean checkout and won't have that worktree)🤖 Generated with Claude Code