Skip to content

Commit e586acd

Browse files
committed
fix: honor static allowlists during catalog augmentation
Do not append jawcode metadata rows when a provider explicitly opts into liveModels:false; that mode is an exact configured allowlist.
1 parent 47defbe commit e586acd

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/codex-catalog.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ export function augmentRoutedModelsWithJawcodeMetadata(models: CatalogModel[], p
478478
const seen = new Set(out.map(m => `${m.provider}/${m.id}`));
479479
for (const provider of providerNames) {
480480
if (!JAWCODE_CATALOG_AUGMENT_PROVIDERS.has(provider)) continue;
481+
if (providers?.[provider]?.liveModels === false) continue;
481482
const jawcodeProvider = resolveJawcodeProvider(provider);
482483
if (!jawcodeProvider) continue;
483484
for (const meta of listJawcodeModelMetadata(jawcodeProvider)) {

tests/codex-catalog.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,38 @@ describe("Codex catalog routed normalization", () => {
298298
expect(models.filter(m => `${m.provider}/${m.id}` === "opencode-go/glm-5.2")).toHaveLength(1);
299299
});
300300

301+
test("liveModels false disables jawcode metadata augmentation for exact allowlists", async () => {
302+
const models = await gatherRoutedModels({
303+
providers: {
304+
"opencode-go": {
305+
adapter: "openai-chat",
306+
baseUrl: "https://opencode-go.test/v1",
307+
apiKey: "sk-test",
308+
liveModels: false,
309+
models: ["glm-5.2"],
310+
},
311+
},
312+
});
313+
const slugs = models.map(m => `${m.provider}/${m.id}`);
314+
315+
expect(slugs).toEqual(["opencode-go/glm-5.2"]);
316+
});
317+
318+
test("liveModels false with no models exposes no augmented provider rows", async () => {
319+
const models = await gatherRoutedModels({
320+
providers: {
321+
"opencode-go": {
322+
adapter: "openai-chat",
323+
baseUrl: "https://opencode-go.test/v1",
324+
apiKey: "sk-test",
325+
liveModels: false,
326+
},
327+
},
328+
});
329+
330+
expect(models).toEqual([]);
331+
});
332+
301333
test("anthropic sonnet 4.6 uses the 200k opencodex catalog cap", () => {
302334
const entries = buildCatalogEntries(nativeTemplate(), [], [
303335
{ provider: "anthropic", id: "claude-sonnet-4-6" },

0 commit comments

Comments
 (0)