






















@@ -212,6 +212,43 @@ describe("isProfileInCooldown", () => {
212212expect(isProfileInCooldown(store, "github-copilot:github", undefined, "gpt-4.1")).toBe(true);
213213});
214214215+it("returns false for a different model when cooldown is model-scoped (timeout) — #87462", () => {
216+const store = makeStore({
217+"google:default": {
218+cooldownUntil: Date.now() + 60_000,
219+cooldownReason: "timeout",
220+cooldownModel: "gemini-3-flash-preview",
221+},
222+});
223+// Other Google fallback models bypass the cooldown
224+expect(isProfileInCooldown(store, "google:default", undefined, "gemini-3.1-flash-lite")).toBe(
225+false,
226+);
227+expect(isProfileInCooldown(store, "google:default", undefined, "gemini-2.5-flash")).toBe(false);
228+// Same model stays blocked
229+expect(isProfileInCooldown(store, "google:default", undefined, "gemini-3-flash-preview")).toBe(
230+true,
231+);
232+// No model specified — blocked (conservative)
233+expect(isProfileInCooldown(store, "google:default")).toBe(true);
234+});
235+236+it("returns true for all models when timeout cooldownModel is undefined (legacy widened scope)", () => {
237+const store = makeStore({
238+"google:default": {
239+cooldownUntil: Date.now() + 60_000,
240+cooldownReason: "timeout",
241+cooldownModel: undefined,
242+},
243+});
244+expect(isProfileInCooldown(store, "google:default", undefined, "gemini-3-flash-preview")).toBe(
245+true,
246+);
247+expect(isProfileInCooldown(store, "google:default", undefined, "gemini-3.1-flash-lite")).toBe(
248+true,
249+);
250+});
251+215252it("does not bypass model-scoped cooldown when disabledUntil is active", () => {
216253const store = makeStore({
217254"github-copilot:github": {
@@ -226,6 +263,20 @@ describe("isProfileInCooldown", () => {
226263// should keep the profile blocked for all models.
227264expect(isProfileInCooldown(store, "github-copilot:github", undefined, "gpt-4.1")).toBe(true);
228265});
266+267+it("does not bypass model-scoped cooldown when blockedUntil is active", () => {
268+const now = Date.now();
269+const store = makeStore({
270+"google:default": {
271+blockedUntil: now + 120_000,
272+blockedReason: "subscription_limit",
273+cooldownUntil: now + 60_000,
274+cooldownReason: "timeout",
275+cooldownModel: "gemini-3-flash-preview",
276+},
277+});
278+expect(isProfileInCooldown(store, "google:default", now, "gemini-3.1-flash-lite")).toBe(true);
279+});
229280});
230281231282describe("resolveProfilesUnavailableReason", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。