mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 12:52:11 +03:00
* fix(sse): export PROVIDER_BREAKER_FAILURE_STATUSES so chat.ts stops throwing ReferenceError Base-red slice 4 (single root cause across the whole handleChat cluster). src/sse/handlers/chat.ts:1273 references PROVIDER_BREAKER_FAILURE_STATUSES to decide whether an all-rate-limited provider result should trip the provider breaker, but the constant was only a FILE-LOCAL const in chatPredicates.ts (a refactor extracted it out of chat.ts and never re-exported it). Every request that reached that branch threw `ReferenceError: PROVIDER_BREAKER_FAILURE_STATUSES is not defined`, so the global fallback and breaker-gate paths blew up — surfacing as "All models failed | PROVIDER_BREAKER_FAILURE_STATUSES is not defined" and breaking the handleChat coverage tests (combo-error passthrough, 503 for cooled-down/open-breaker, budget-error, model cooldown, body-derived retry-after, non-JSON rate-limit bodies). Fix: export the const from chatPredicates.ts and import it in chat.ts (one canonical definition, restoring the pre-refactor behavior). Validated: chat-route-coverage 15/0 (was 12/3), chat-cooldown-aware-retry 6/0, chat-rate-limit-body-lock 2/0; breaker guards (7907, combo-breaker-429, openrouter-6842) unchanged; typecheck:core clean. * test(nvidia): read PROVIDER_BREAKER_FAILURE_STATUSES from chatPredicates.ts Same root cause as the chat.ts import fix in this PR: the const was extracted out of chat.ts into chatPredicates.ts, so the nvidia-quota Phase-1 guard (which greps the source for the `= new Set([...])` declaration to prove 429 was not added to the breaker classification) must read chatPredicates.ts, not chat.ts. Now 13/0. --------- Co-authored-by: Probe Test <probe@example.com>