mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-18 21:02:50 +03:00
test(sse): align turn-pin suites to the provider-cooldown window gate
The two native-codex-turn-pin suites landed via the #10379 merge wave after PR #12247 forked, so #12247's green CI never saw them: they set up 'provider in global cooldown' with a single recordProviderCooldown call, the pre-#12247 contract. Since the window gate, a provider only counts as cooling after providerFailureThreshold failures inside the window — the setup now loops to the profile threshold (same alignment the tracker's own legacy suite got in Sibling sweep: all 7 suites touching recordProviderCooldown pass (60/60).
This commit is contained in:
@@ -20,6 +20,7 @@ const { getCircuitBreaker, resetAllCircuitBreakers } =
|
||||
await import("../../src/shared/utils/circuitBreaker.ts");
|
||||
const { recordProviderCooldown, clearCooldownState } =
|
||||
await import("../../open-sse/services/providerCooldownTracker.ts");
|
||||
const { PROVIDER_PROFILES } = await import("../../open-sse/config/constants.ts");
|
||||
const { resolveResilienceSettings } = await import("../../src/lib/resilience/settings.ts");
|
||||
|
||||
const BODY = {
|
||||
@@ -222,9 +223,13 @@ test("isPinnedTargetModelScopedUnusable distinguishes model lockout from provide
|
||||
false
|
||||
);
|
||||
|
||||
// Reset breaker, test provider cooldown
|
||||
// Reset breaker, test provider cooldown. Since #12247 the global provider
|
||||
// cooldown honors the PROVIDER_PROFILES window gate: the provider only counts
|
||||
// as cooling after providerFailureThreshold failures inside the window.
|
||||
cb.reset();
|
||||
recordProviderCooldown("antigravity", undefined, resilienceSettings);
|
||||
for (let i = 0; i < PROVIDER_PROFILES.oauth.providerFailureThreshold; i++) {
|
||||
recordProviderCooldown("antigravity", undefined, resilienceSettings);
|
||||
}
|
||||
assert.equal(
|
||||
await isPinnedTargetModelScopedUnusable({
|
||||
target,
|
||||
|
||||
@@ -19,6 +19,7 @@ const {
|
||||
} = await import("../../open-sse/services/combo/nativeCodexTurnPin.ts");
|
||||
const { recordProviderCooldown, isProviderInCooldown, clearCooldownState } =
|
||||
await import("../../open-sse/services/providerCooldownTracker.ts");
|
||||
const { PROVIDER_PROFILES } = await import("../../open-sse/config/constants.ts");
|
||||
const { getCircuitBreaker, resetAllCircuitBreakers } =
|
||||
await import("../../src/shared/utils/circuitBreaker.ts");
|
||||
const { resolveResilienceSettings } = await import("../../src/lib/resilience/settings.ts");
|
||||
@@ -403,7 +404,11 @@ describe("Native Codex Turn Pin model-scoped fallback", () => {
|
||||
allCombos: null,
|
||||
});
|
||||
|
||||
recordProviderCooldown("antigravity", undefined, settings);
|
||||
// #12247: the window gate needs providerFailureThreshold failures before
|
||||
// the whole provider counts as cooling.
|
||||
for (let i = 0; i < PROVIDER_PROFILES.oauth.providerFailureThreshold; i++) {
|
||||
recordProviderCooldown("antigravity", undefined, settings);
|
||||
}
|
||||
assert.equal(isProviderInCooldown("antigravity", undefined, settings), true);
|
||||
|
||||
const attempted: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user