Compare commits

..

2 Commits

Author SHA1 Message Date
Probe Test
23686bc6f6 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.
2026-07-26 11:02:37 -03:00
Probe Test
62ced83caa 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.
2026-07-26 11:02:36 -03:00
5 changed files with 20 additions and 29 deletions

View File

@@ -77,6 +77,7 @@ import {
isAntigravityMissingProjectError,
PROVIDER_BREAKER_FAILURE_STATUSES,
shouldTripProviderBreakerForResult,
PROVIDER_BREAKER_FAILURE_STATUSES,
} from "./chatPredicates";
import { connectionHasExtraKeys } from "@omniroute/open-sse/services/apiKeyRotator.ts";
import {

View File

@@ -87,9 +87,9 @@ test("credentialed providers expose one logical candidate per visible registry m
);
for (const model of [
"antigravity/claude-sonnet-4-6",
"antigravity/gemini-3.6-flash-low",
"antigravity/gemini-3.6-flash-medium",
"antigravity/gemini-3.6-flash-high",
"antigravity/gemini-3-flash-agent",
"antigravity/gemini-3.5-flash-low",
"antigravity/gemini-3.5-flash-extra-low",
]) {
assert.ok(modelStrings.includes(model), `${model} should be eligible for auto routing`);
}
@@ -134,10 +134,8 @@ test("connection model exclusions narrow only that model's account allowlist", a
assert.deepEqual(candidate.allowedConnectionIds, [second.id]);
}
const sonnet = candidates.find(
(candidate) => candidate.model === "antigravity/claude-sonnet-4-6"
);
assert.ok(sonnet, "Claude Sonnet 5 should remain in the candidate pool");
const sonnet = candidates.find((candidate) => candidate.model === "antigravity/claude-sonnet-4-6");
assert.ok(sonnet, "Claude Sonnet 4.6 should remain in the candidate pool");
assert.deepEqual([...(sonnet.allowedConnectionIds ?? [])].sort(), [first.id, second.id].sort());
});
@@ -150,9 +148,9 @@ test("hiding the first registry model does not drop the credentialed provider",
assert.equal(modelStrings.includes("antigravity/claude-sonnet-4-6"), false);
for (const model of [
"antigravity/gemini-3.6-flash-low",
"antigravity/gemini-3.6-flash-medium",
"antigravity/gemini-3.6-flash-high",
"antigravity/gemini-3-flash-agent",
"antigravity/gemini-3.5-flash-low",
"antigravity/gemini-3.5-flash-extra-low",
]) {
assert.ok(modelStrings.includes(model), `${model} should remain after Sonnet is hidden`);
}

View File

@@ -42,8 +42,6 @@ test("default model alias seed writes missing aliases and is idempotent", async
assert.equal(aliases["gemini-3-flash-preview"], undefined);
const routed = await sseModelService.getModelInfo("gemini-3.1-pro");
// The stored alias target is "agy/gemini-pro-agent", but getModelInfo canonicalizes
// the "agy" alias to its provider id "antigravity" (ALIAS_TO_PROVIDER_ID, #8013).
assert.deepEqual(routed, {
provider: "antigravity",
model: "gemini-pro-agent",

View File

@@ -189,7 +189,11 @@ test("getProviderConcurrencyCap resolves override -> static default -> fallback"
);
setProviderQuotaOverrides({ nvidia: { concurrency: 3 } });
try {
assert.equal(getProviderConcurrencyCap("nvidia", 99), 3, "override wins over the static default");
assert.equal(
getProviderConcurrencyCap("nvidia", 99),
3,
"override wins over the static default"
);
} finally {
setProviderQuotaOverrides(null);
}
@@ -218,16 +222,9 @@ test("nvidia 429 does not trip the provider circuit breaker (unchanged 408/500/5
// documentation-alignment guard proving Phase 1 didn't accidentally widen
// PROVIDER_BREAKER_FAILURE_STATUSES to include 429 (which would collapse the
// per-model lockout this PR adds into a whole-connection/provider outage).
// #8013 extracted the const from src/sse/handlers/chat.ts into chatPredicates.ts
// (still consumed by chat.ts's breaker paths) — read the declaration from its
// current home.
const chatHandlerPath = path.join(
process.cwd(),
"src",
"sse",
"handlers",
"chatPredicates.ts"
);
// The PROVIDER_BREAKER_FAILURE_STATUSES declaration was extracted from chat.ts into
// the sibling chatPredicates.ts (chat.ts now imports it); read it from its home.
const chatHandlerPath = path.join(process.cwd(), "src", "sse", "handlers", "chatPredicates.ts");
const source = fs.readFileSync(chatHandlerPath, "utf8");
const match = source.match(/PROVIDER_BREAKER_FAILURE_STATUSES\s*=\s*new Set\(\[([^\]]+)\]\)/);
assert.ok(match, "PROVIDER_BREAKER_FAILURE_STATUSES declaration found");

View File

@@ -15,14 +15,11 @@ const {
capThinkingBudget,
} = await import("../../src/shared/constants/modelSpecs.ts");
test("T31: antigravity static catalog exposes client-visible Gemini preview IDs", () => {
// Antigravity exposes client-visible Gemini IDs even though the upstream still
// accepts its internal model identifiers. #8013 (align official clients / callable
// catalog) retired the `gemini-3-pro-preview` alias, so assert the current
// client-visible top flash tier instead.
test("T31: antigravity static catalog exposes client-visible Gemini model IDs", () => {
// Antigravity's static catalog surfaces the live, client-visible model IDs returned by
// the model selector (#8013 refactor: gemini-3.6-flash-high is the current defaultAgentModelId).
const staticIds = (getStaticModelsForProvider("antigravity") || []).map((m) => m.id);
assert.ok(staticIds.includes("gemini-3.6-flash-high"));
assert.ok(!staticIds.includes("gemini-3-pro-preview"));
// #3303 (agy parity, discussion #3184): the Gemini + Claude budget tiers ARE
// client-visible on the Antigravity OAuth backend (Claude was never removed).
assert.ok(staticIds.includes("gemini-3.1-pro-low"));