7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
fix(classify): only treat an end-of-life phrase as definitive on a gone-shaped status (#855)
OhOkThisIsFine36cc2ed9693c
diff --git a/server/src/__tests__/services/model-retirement.test.ts b/server/src/__tests__/services/model-retirement.test.tsindex 6275dd17..fa1f8590 100644--- a/server/src/__tests__/services/model-retirement.test.ts+++ b/server/src/__tests__/services/model-retirement.test.ts@@ -81,6 +81,36 @@ describe('modelRetirementSignal (conservative end-of-life detection — #634)',))).toBe('definitive');});+ // 'definitive' skips the corroboration gate and disables the model on ONE+ // response, so the phrase must not be load-bearing by itself: a rate-limit+ // or server-error body can quote a retirement notice (about this model or+ // another) without the model being gone.+ it('ignores an end-of-life phrase when the status does not agree the model is gone', () => {+ expect(modelRetirementSignal(Object.assign(+ new Error('Rate limit exceeded. Note: llama-3.1-8b reaches end of life on 2026-12-01'),+ { status: 429 },+ ))).toBeNull();+ expect(modelRetirementSignal(Object.assign(+ new Error('Internal server error: upstream pool has been decommissioned'),+ { status: 500 },+ ))).toBeNull();+ expect(modelRetirementSignal(Object.assign(+ new Error('Bad request: the v1 endpoint has been sunset, use v2'),+ { status: 400 },+ ))).toBeNull();+ });++ it('still fires when a gone-shaped status carries the phrase', () => {+ expect(modelRetirementSignal(Object.assign(+ new Error('API error 410: this model has been retired'),+ { status: 410 },+ ))).toBe('definitive');+ expect(modelRetirementSignal(Object.assign(+ new Error('API error 404: this model has been decommissioned'),+ { status: 404 },+ ))).toBe('definitive');+ });+it('treats a 404 that clearly says the model is gone as probable (needs corroboration)', () => {expect(modelRetirementSignal(Object.assign(new Error('OpenRouter API error 404: this model is no longer available'),diff --git a/server/src/lib/error-classify.ts b/server/src/lib/error-classify.tsindex 25833815..3ea8bd41 100644--- a/server/src/lib/error-classify.ts+++ b/server/src/lib/error-classify.ts@@ -449,7 +449,13 @@ export function modelRetirementSignal(err: any): ModelRetirementConfidence | nulconst msg = (err?.message ?? '').toLowerCase();const status = typeof err?.status === 'number' ? err.status : 0;const gone = status === 410 || /\berror 410\b/.test(msg) || /\b410 gone\b/.test(msg);- if (gone || END_OF_LIFE_PHRASES.some(phrase => msg.includes(phrase))) return 'definitive';+ // An end-of-life phrase is only definitive when the status agrees the model+ // is not there. On its own it is just text, and 'definitive' skips the+ // corroboration gate in noteModelRetirementSignal — so a 429 or 500 whose+ // body happens to mention a retirement (an advisory notice, a status-page+ // quote, a message about a DIFFERENT model) disabled a live model on one+ // response. Unmatched here means it falls through and teaches nothing.+ if (gone || (isModelNotFoundError(err) && END_OF_LIFE_PHRASES.some(phrase => msg.includes(phrase)))) return 'definitive';if (!isModelNotFoundError(err)) return null;return MODEL_GONE_PHRASES.some(phrase => msg.includes(phrase)) ? 'probable' : null;}