diff --git a/packages/coding-agent/test/model-registry.test.ts b/packages/coding-agent/test/model-registry.test.ts index 18bf921b3..35dd8f954 100644 --- a/packages/coding-agent/test/model-registry.test.ts +++ b/packages/coding-agent/test/model-registry.test.ts @@ -8,7 +8,7 @@ import type { Model, OpenAICompletionsCompat, } from "@earendil-works/pi-ai/compat"; -import { getApiProvider, getSupportedThinkingLevels } from "@earendil-works/pi-ai/compat"; +import { getApiProvider, getModels, getSupportedThinkingLevels } from "@earendil-works/pi-ai/compat"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { AuthStorage } from "../src/core/auth-storage.ts"; import type { ModelsJsonProvider } from "../src/core/model-config.ts"; @@ -1879,12 +1879,15 @@ describe("ModelRegistry", () => { }); test("getAvailable filters GitHub Copilot OAuth models to account picker availability", async () => { + const copilotModel = getModels("github-copilot")[0]; + if (!copilotModel) throw new Error("Expected at least one GitHub Copilot model"); + await authStorage.modify("github-copilot", async () => ({ type: "oauth", refresh: "github-access-token", access: "tid=test;exp=9999999999;proxy-ep=proxy.individual.githubcopilot.com;", expires: Date.now() + 60_000, - availableModelIds: ["gpt-4.1"], + availableModelIds: [copilotModel.id], })); const registry = await createModelRegistry(authStorage, modelsJsonPath); @@ -1894,7 +1897,7 @@ describe("ModelRegistry", () => { .getAvailable() .filter((m) => m.provider === "github-copilot") .map((m) => m.id), - ).toEqual(["gpt-4.1"]); + ).toEqual([copilotModel.id]); }); test("getApiKeyAndHeaders resolves authHeader on every request", async () => {