The best way to control Claude Code, Codex and more from any computer or phone
fix(web): text generation no longer falls back to the expensive flagship model (#19722)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 15, 2026 at 03:19 UTC
45b5993a527fd51813393c3bafcddab430b3a8e1
2 files changed
+30
-1
apps/web/src/modelSelection.test.ts
+19
@@ -1,5 +1,6 @@
1
import {
2
ANTIGRAVITY_DEFAULT_MODEL,
3
+ DEFAULT_TEXT_GENERATION_MODEL,
4
ProviderDriverKind,
5
ProviderInstanceId,
6
type ServerProvider,
@@ -835,6 +836,24 @@ describe("instance-scoped model selection", () => {
836
ProviderInstanceId.make("codex"),
837
);
838
});
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
+
857
it("does not select a provider that cannot generate system text", () => {
858
const instanceId = ProviderInstanceId.make("antigravity");
859
const unsupported = {
apps/web/src/modelSelection.ts
+11
-1
@@ -366,9 +366,19 @@ export function resolveAppModelSelectionState(
366
selectedEntry ?? entries.find((candidate) => candidate.enabled && candidate.isAvailable);
367
if (entry) {
368
// 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.
370
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);
375
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
+ ) ??
382
resolveAppModelSelectionForInstance(
383
entry.instanceId,
384
settings,