fix(gateway): prune expired entries instead of clearing all hook auth failure state (#15848)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 188a40e8a3
Co-authored-by: AI-Reviewer-QS <255312808+AI-Reviewer-QS@users.noreply.github.com>
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Reviewed-by: @steipete
This commit is contained in:
AI-Reviewer-QS
2026-02-14 08:46:12 +08:00
committed by GitHub
parent 67b5c093b5
commit 28431b84cc
4 changed files with 132 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ const mocks = vi.hoisted(() => {
const printModelTable = vi.fn();
return {
loadConfig: vi.fn().mockReturnValue({
agents: { defaults: { model: { primary: "openai-codex/gpt-5.3-codex-spark" } } },
agents: { defaults: { model: { primary: "openai-codex/gpt-5.3-codex" } } },
models: { providers: {} },
}),
ensureAuthProfileStore: vi.fn().mockReturnValue({ version: 1, profiles: {}, order: {} }),
@@ -14,8 +14,8 @@ const mocks = vi.hoisted(() => {
resolveConfiguredEntries: vi.fn().mockReturnValue({
entries: [
{
key: "openai-codex/gpt-5.3-codex-spark",
ref: { provider: "openai-codex", model: "gpt-5.3-codex-spark" },
key: "openai-codex/gpt-5.3-codex",
ref: { provider: "openai-codex", model: "gpt-5.3-codex" },
tags: new Set(["configured"]),
aliases: [],
},
@@ -24,8 +24,8 @@ const mocks = vi.hoisted(() => {
printModelTable,
resolveForwardCompatModel: vi.fn().mockReturnValue({
provider: "openai-codex",
id: "gpt-5.3-codex-spark",
name: "GPT-5.3 Codex Spark",
id: "gpt-5.3-codex",
name: "GPT-5.3 Codex",
api: "openai-codex-responses",
baseUrl: "https://chatgpt.com/backend-api",
input: ["text"],
@@ -76,7 +76,7 @@ vi.mock("../../agents/model-forward-compat.js", async (importOriginal) => {
import { modelsListCommand } from "./list.list-command.js";
describe("modelsListCommand forward-compat", () => {
it("does not mark configured codex spark as missing when forward-compat can build a fallback", async () => {
it("does not mark configured codex model as missing when forward-compat can build a fallback", async () => {
const runtime = { log: vi.fn(), error: vi.fn() };
await modelsListCommand({ json: true }, runtime as never);
@@ -88,9 +88,9 @@ describe("modelsListCommand forward-compat", () => {
missing: boolean;
}>;
const spark = rows.find((r) => r.key === "openai-codex/gpt-5.3-codex-spark");
expect(spark).toBeTruthy();
expect(spark?.missing).toBe(false);
expect(spark?.tags).not.toContain("missing");
const codex = rows.find((r) => r.key === "openai-codex/gpt-5.3-codex");
expect(codex).toBeTruthy();
expect(codex?.missing).toBe(false);
expect(codex?.tags).not.toContain("missing");
});
});