Skip to content
TypeScript

fix(web): the model picker offers every saved custom model, not just the first 32 (#14961)

tiliakoosb5b6c8cf4c00
diff --git a/apps/web/src/modelSelection.test.ts b/apps/web/src/modelSelection.test.ts
index ca00cd9b542..37e735f0d21 100644
--- a/apps/web/src/modelSelection.test.ts
+++ b/apps/web/src/modelSelection.test.ts
@@ -187,6 +187,39 @@ describe("instance-scoped model selection", () => {
);
});
+ it("offers and resolves every saved custom model, past the first 32", () => {
+ const providers = [
+ provider({
+ provider: ProviderDriverKind.make("claudeAgent"),
+ instanceId: "claude_openrouter",
+ }),
+ ];
+ const customModels = Array.from({ length: 40 }, (_, index) => `proxy/model-${index + 1}`);
+ const settings: UnifiedSettings = {
+ ...settingsWithProviderInstances(),
+ providerInstances: {
+ ...settingsWithProviderInstances().providerInstances,
+ [ProviderInstanceId.make("claude_openrouter")]: {
+ driver: ProviderDriverKind.make("claudeAgent"),
+ config: { customModels },
+ },
+ },
+ };
+ const openrouter = deriveProviderInstanceEntries(providers)[0]!;
+
+ expect(
+ getAppModelOptionsForInstance(settings, openrouter).map((option) => option.slug),
+ ).toEqual(customModels);
+ expect(
+ resolveAppModelSelectionForInstance(
+ ProviderInstanceId.make("claude_openrouter"),
+ settings,
+ providers,
+ "proxy/model-40",
+ ),
+ ).toBe("proxy/model-40");
+ });
+
it("does not inject an unknown selected slug into the stock instance list", () => {
const providers = [
provider({
diff --git a/apps/web/src/modelSelection.ts b/apps/web/src/modelSelection.ts
index 83879703464..8ab0c46ad39 100644
--- a/apps/web/src/modelSelection.ts
+++ b/apps/web/src/modelSelection.ts
@@ -32,7 +32,6 @@ import {
} from "./providerInstances";
import { sortModelsForProviderInstance } from "./modelOrdering";
-const MAX_CUSTOM_MODEL_COUNT = 32;
export const MAX_CUSTOM_MODEL_LENGTH = 256;
const DEFAULT_TEXT_GENERATION_INSTANCE_ID = ProviderInstanceId.make("codex");
@@ -149,9 +148,6 @@ function normalizeCustomModelEntries(
seen.add(candidate.slug);
normalizedModels.push(candidate);
- if (normalizedModels.length >= MAX_CUSTOM_MODEL_COUNT) {
- break;
- }
}
return normalizedModels;