Files
OmniRoute/tests/unit/github-copilot-gpt-4o-mini.test.ts
backryun e755c5ac68 fix(providers): refresh GitHub Copilot catalog (#6154)
* fix(providers): refresh github copilot catalog

Limit GitHub Copilot discovery to the curated supported model set and keep the provider cooldown panel client-safe by moving countdown formatting out of localDb.

* chore(quality): rebaseline providerPageHelpers.ts file-size (+13, #6154 copilot catalog)

The GitHub Copilot catalog refresh grows the provider-page model-section helper
(1021->1034). Fast-path PR->release skips check:file-size, so the bump lands with
the PR. Justification recorded in file-size-baseline.json.

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>

---------

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
2026-07-05 02:33:32 -03:00

47 lines
2.1 KiB
TypeScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { getRegistryEntry } from "../../open-sse/config/providerRegistry.ts";
// Regression guard: the GitHub Copilot (`gh`) provider must expose `gpt-4o-mini`
// alongside the curated date-pinned GPT-4o model. Copilot serves the cheaper mini variant via
// chat/completions, so apps that hard-code `gpt-4o-mini` should resolve to the
// Copilot provider — not only to the separate github-models (`ghm`) marketplace
// entry, which lists it under the `openai/` prefix (`openai/gpt-4o-mini`).
//
// Ported from upstream decolua/9router (add GPT-4o mini to GitHub Copilot).
test("github (Copilot) provider exposes gpt-4o-mini next to curated GPT-4o", () => {
const entry = getRegistryEntry("github");
assert.ok(entry, "github registry entry should exist");
assert.ok(entry.models, "github registry entry should have a models array");
const ids = entry.models!.map((m) => m.id);
assert.ok(ids.includes("gpt-4o-2024-11-20"), "date-pinned gpt-4o should remain registered");
assert.ok(
ids.includes("gpt-4o-mini"),
"gpt-4o-mini should be registered on the Copilot (gh) provider"
);
const mini = entry.models!.find((m) => m.id === "gpt-4o-mini");
assert.equal(mini?.name, "GPT-4o mini");
assert.equal(mini?.contextLength, 128000);
assert.equal(ids.includes("gpt-4o"), false, "bare gpt-4o is not in the curated list");
});
test("Copilot gpt-4o-mini is distinct from the github-models openai/gpt-4o-mini", () => {
const copilot = getRegistryEntry("github");
const marketplace = getRegistryEntry("github-models");
const copilotIds = (copilot?.models ?? []).map((m) => m.id);
const marketplaceIds = (marketplace?.models ?? []).map((m) => m.id);
// The two providers reference the same upstream model under different ids:
// Copilot uses the bare `gpt-4o-mini`; the marketplace uses `openai/gpt-4o-mini`.
assert.ok(copilotIds.includes("gpt-4o-mini"));
assert.ok(marketplaceIds.includes("openai/gpt-4o-mini"));
assert.ok(
!copilotIds.includes("openai/gpt-4o-mini"),
"Copilot should not carry the marketplace-prefixed id"
);
});