Skip to content

Commit fb59412

Browse files
t3dotggclaude
andcommitted
fix(web): text generation falls back to its cheap default, not the flagship model
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ec1313c commit fb59412

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎apps/web/src/modelSelection.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
ANTIGRAVITY_DEFAULT_MODEL,
3+
DEFAULT_TEXT_GENERATION_MODEL,
34
ProviderDriverKind,
45
ProviderInstanceId,
56
type ServerProvider,
@@ -835,6 +836,24 @@ describe("instance-scoped model selection", () => {
835836
ProviderInstanceId.make("codex"),
836837
);
837838
});
839+
it("falls back to the text generation default, not the chat default, for a removed model", () => {
840+
const codex = provider({ instanceId: "codex", models: ["gpt-6-astra", "gpt-6-luna"] });
841+
const providers = [
842+
{ ...codex, models: codex.models.map((m, i) => (i === 0 ? { ...m, isDefault: true } : m)) },
843+
];
844+
const settings: UnifiedSettings = {
845+
...settingsWithProviderInstances(),
846+
textGenerationModelSelection: createModelSelection(
847+
ProviderInstanceId.make("codex"),
848+
"gpt-5.6-luna",
849+
),
850+
};
851+
852+
expect(resolveAppModelSelectionState(settings, providers).model).toBe(
853+
DEFAULT_TEXT_GENERATION_MODEL,
854+
);
855+
});
856+
838857
it("does not select a provider that cannot generate system text", () => {
839858
const instanceId = ProviderInstanceId.make("antigravity");
840859
const unsupported = {

‎apps/web/src/modelSelection.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,19 @@ export function resolveAppModelSelectionState(
366366
selectedEntry ?? entries.find((candidate) => candidate.enabled && candidate.isAvailable);
367367
if (entry) {
368368
// When the instance changed due to fallback (e.g. selected instance was disabled),
369-
// don't carry over the old instance's model — use the fallback instance's default.
369+
// don't carry over the old instance's model.
370370
const selectedModel = selectedEntry ? selection.model : null;
371+
// A saved model the catalog no longer lists, or a new fallback instance,
372+
// gets the driver's cheap text generation default. The catalog's own
373+
// default is the flagship chat model, which is too expensive here.
374+
const options = getAppModelOptionsForInstance(settings, entry);
371375
const model =
376+
resolveSelectableModel(entry.driverKind, selectedModel, options) ??
377+
resolveSelectableModel(
378+
entry.driverKind,
379+
DEFAULT_TEXT_GENERATION_MODEL_BY_PROVIDER[entry.driverKind],
380+
options,
381+
) ??
372382
resolveAppModelSelectionForInstance(
373383
entry.instanceId,
374384
settings,

0 commit comments

Comments
 (0)