mirror of
https://github.com/bitbaum/ai-kit.git
synced 2026-12-04 05:48:21 +01:00
A health tracker that has recorded nothing looks identical whether the
chain is perfect or every key is missing. Straight after a deploy that is
exactly the state it is in, so the one question a deploy needs answered
("did I just ship a working AI path?") is the one it cannot answer.
Observed 2026-09-05 converting the first app: deploy green, bundle
provably held the new code, both keys present, /api/health 200 — and
llm.status "unknown". Every available signal said "probably fine" and
none said "works". The only paths that would have produced a real answer
were an admin-authenticated form and two crons that EMAIL REAL USERS.
createLivenessProbe / createAiHealthHandler make the call deliberately,
and the safety properties are the design:
- probes only on ?probe=1 AND with a secret, never on an ordinary poll;
- a SUCCESS is cached 10 min, so an authorised retry loop cannot drain a
daily budget shared with the app's real features;
- a FAILURE is never cached — the point is the truth about right now;
- no secret configured => 501, not an open endpoint that can spend money;
- 200/503 so an uptime monitor can watch the URL directly;
- constant-time secret compare;
- 256-token budget, because reasoning models answer EMPTY at 16.
Each of those four safety properties verified by MUTATION: disabling the
success cache, caching failures, dropping the 501 guard and bypassing the
secret compare each turned exactly the test that names it red.
README also loses two stale claims: it still advertised the withheld HTTP
client that 0.7.0 shipped — the front door was telling every prospective
adopter the exact thing that made them hand-roll a client.
Claude-Session: https://claude.ai/code/session_01NHDLTKGirKU7He8q2YR2y4
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>