From f049d9dec2e8a8bc23a736187c75a001593e88fe Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 27 Apr 2026 17:58:04 +0100 Subject: [PATCH] fix: avoid broad model row runtime resolution --- .../models/list.list-command.forward-compat.test.ts | 1 + src/commands/models/list.row-sources.ts | 1 + src/commands/models/list.rows.ts | 8 +++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/commands/models/list.list-command.forward-compat.test.ts b/src/commands/models/list.list-command.forward-compat.test.ts index 1cc1247d025..2e424bfd39f 100644 --- a/src/commands/models/list.list-command.forward-compat.test.ts +++ b/src/commands/models/list.list-command.forward-compat.test.ts @@ -620,6 +620,7 @@ describe("modelsListCommand forward-compat", () => { providerFilter: undefined, }); expect(mocks.loadProviderCatalogModelsForList).not.toHaveBeenCalled(); + expect(mocks.resolveModelWithRegistry).not.toHaveBeenCalled(); expect(lastPrintedRows<{ key: string }>()).toEqual([ expect.objectContaining({ key: "openai-codex/gpt-5.4", diff --git a/src/commands/models/list.row-sources.ts b/src/commands/models/list.row-sources.ts index 5c274880da5..c57636ef879 100644 --- a/src/commands/models/list.row-sources.ts +++ b/src/commands/models/list.row-sources.ts @@ -81,6 +81,7 @@ export async function appendAllModelRowSources( models: params.modelRegistry?.getAll() ?? [], modelRegistry: params.modelRegistry, context: params.context, + resolveWithRegistry: Boolean(params.context.filter.provider), }); await appendConfiguredProviderRows({ diff --git a/src/commands/models/list.rows.ts b/src/commands/models/list.rows.ts index fabc9f39320..1c5bb5d8ff9 100644 --- a/src/commands/models/list.rows.ts +++ b/src/commands/models/list.rows.ts @@ -266,11 +266,13 @@ export async function appendDiscoveredRows(params: { models: Model[]; modelRegistry?: ModelRegistry; context: RowBuilderContext; + resolveWithRegistry?: boolean; }): Promise> { const seenKeys = new Set(); - const modelResolver = params.modelRegistry - ? (await loadModelResolverModule()).resolveModelWithRegistry - : undefined; + const modelResolver = + params.modelRegistry && params.resolveWithRegistry !== false + ? (await loadModelResolverModule()).resolveModelWithRegistry + : undefined; const sorted = [...params.models].toSorted((a, b) => { const providerCompare = a.provider.localeCompare(b.provider); if (providerCompare !== 0) {