Skip to content

Commit 23039ed

Browse files
t3dotggclaude
andcommitted
fix(server): searching delegate models by provider name no longer shows only dead models
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1abf368 commit 23039ed

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎apps/server/src/mcp/OrchestratorMcpService.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,16 @@ describe("OrchestratorMcpService provider resolution", () => {
14311431
models: ["oc/m12", "oc/m01", "oc/m03", "oc/m04", "oc/m05", "oc/m06", "oc/m07", "oc/m08"],
14321432
omitted: 3,
14331433
});
1434+
// A word naming the provider matches all its models, so legacy ones stay out.
1435+
assert.deepEqual(listing(yield* capabilitiesWith("Codex")), [
1436+
{ id: codexInstanceId, models: ["gpt-6", "gpt-4", "gpt-3", "my-alpha"], omitted: 1 },
1437+
{ id: opencodeInstanceId, models: [], omitted: 0 },
1438+
]);
1439+
assert.deepEqual(listing(yield* capabilitiesWith("codex gpt 5"))[0], {
1440+
id: codexInstanceId,
1441+
models: ["gpt-5"],
1442+
omitted: 0,
1443+
});
14341444
}),
14351445
);
14361446

‎apps/server/src/mcp/OrchestratorMcpService.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ const FULL_CATALOG_DRIVERS: ReadonlySet<string> = new Set(["codex", "claudeAgent
287287
const LISTED_MODEL_LIMIT = 8;
288288

289289
/**
290-
* Picks the models orchestrator_capabilities shows for one provider. Hidden
291-
* models never appear. With search terms, lists matches; otherwise lists pinned
292-
* models (custom, favorite, the caller's own) plus the provider's non-legacy
290+
* Picks the models orchestrator_capabilities shows for one provider. Hidden models never
291+
* appear. Search words naming the provider are dropped; other words list matches. With no
292+
* words left, lists pinned models (custom, favorite, the caller's own) plus non-legacy
293293
* models, or only the first few in the user's model order for large catalogs.
294294
*/
295295
function listCapabilityModels(input: {
@@ -304,10 +304,13 @@ function listCapabilityModels(input: {
304304
const visible = input.provider.models
305305
.filter((model) => model.isCustom || !input.preferences?.hiddenModels.includes(model.slug))
306306
.toSorted((a, b) => (rank.get(a.slug) ?? rank.size) - (rank.get(b.slug) ?? rank.size));
307-
if (input.searchTerms.length > 0) {
307+
const { instanceId, driver, displayName } = input.provider;
308+
const providerText = `${instanceId} ${driver} ${displayName ?? ""}`.toLowerCase();
309+
const modelTerms = input.searchTerms.filter((term) => !providerText.includes(term));
310+
if (modelTerms.length > 0) {
308311
const matches = visible.filter((model) => {
309312
const text = `${model.slug} ${model.name} ${model.subProvider ?? ""}`.toLowerCase();
310-
return input.searchTerms.every((term) => text.includes(term));
313+
return modelTerms.every((term) => text.includes(term));
311314
});
312315
const listed = matches.slice(0, LISTED_MODEL_LIMIT);
313316
return { listed, omitted: matches.length - listed.length };

0 commit comments

Comments
 (0)