Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/codex/catalog/provider-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ function providerCatalogFingerprint(name: string, prov: OcxProviderConfig): Reco
base: prov.baseUrl ?? "",
adapter: prov.adapter ?? "",
models: [...(prov.models ?? [])].sort(),
selected: [...(prov.selectedModels ?? [])].sort(),
selected: Array.isArray(prov.selectedModels) ? [...prov.selectedModels].sort() : [],
defaultModel: prov.defaultModel ?? null,
ctx: prov.contextWindow ?? null,
ctxW: prov.modelContextWindows ?? null,
Expand Down
21 changes: 21 additions & 0 deletions tests/gather-routed-models-single-flight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,27 @@ describe("gatherRoutedModels single-flight", () => {
expect(filterCatalogVisibleModels(withSelModels, withSel).map(m => m.id)).toEqual(["keep-me"]);
});

test("malformed persisted selectedModels does not break catalog gathering", async () => {
const config = {
port: 10100,
defaultProvider: "p",
providers: {
p: {
adapter: "openai-chat",
baseUrl: "https://sel.example.test/v1",
models: ["configured-model"],
liveModels: false,
selectedModels: 42,
},
},
} as unknown as OcxConfig;

const models = await gatherRoutedModels(config);

expect(models.map(model => model.id)).toEqual(["configured-model"]);
expect(filterCatalogVisibleModels(models, config).map(model => model.id)).toEqual(["configured-model"]);
});

test("disabledModels-only config changes do not share a flight", async () => {
let fetchCount = 0;
let release!: () => void;
Expand Down
Loading