The best way to control Claude Code, Codex and more from any computer or phone
fix(web): keep saved default model when changing effort (#22193)
Co-authored-by: macodev00 <macodev00@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
maco committed
Nov 11, 2026 at 13:00 UTC
d56b82c7084cc4b5e5015c2f9ff1a5279bda74b7
6 files changed
+222
-16
apps/web/src/components/chat/ProviderModelPicker.logic.test.ts
new
+20
@@ -0,0 +1,20 @@
1
+import { ProviderDriverKind } from "@t3tools/contracts";
2
+import { describe, expect, it } from "vite-plus/test";
3
+
4
+import { retainedModelWhileProviderLocked } from "./ProviderModelPicker.logic";
5
+
6
+const claude = ProviderDriverKind.make("claudeAgent");
7
+const opus = { slug: "claude-opus-5-5", name: "Claude Opus 5.5", shortName: "Opus 5.5" };
8
+const sonnet = { slug: "claude-sonnet-5-5", name: "Claude Sonnet 5.5", shortName: "Sonnet 5.5" };
9
+const retained = (enabled: boolean, isAvailable: boolean, models = [sonnet, opus]) =>
10
+ retainedModelWhileProviderLocked({ driverKind: claude, enabled, isAvailable, models }, opus.slug);
11
+
12
+describe("retainedModelWhileProviderLocked", () => {
13
+ it("shows a hidden saved model while its provider cannot run", () => {
14
+ expect(retained(false, true)).toBe(opus);
15
+ expect(retained(true, false)).toBe(opus);
16
+ expect(retained(false, true, [sonnet])).toEqual({ slug: opus.slug, name: opus.slug });
17
+ expect(retained(true, true)).toBeUndefined();
18
+ expect(retainedModelWhileProviderLocked(null, opus.slug)).toBeUndefined();
19
+ });
20
+});
apps/web/src/components/chat/ProviderModelPicker.logic.ts
new
+18
@@ -0,0 +1,18 @@
1
+import type { ProviderDriverKind } from "@t3tools/contracts";
2
+
3
+import type { ModelEsque } from "./providerIconUtils";
4
+
5
+/** Keeps a hidden model visible while its provider is locked or turned off. */
6
+export function retainedModelWhileProviderLocked(
7
+ entry: {
8
+ readonly driverKind: ProviderDriverKind;
9
+ readonly enabled: boolean;
10
+ readonly isAvailable: boolean;
11
+ readonly models: ReadonlyArray<Pick<ModelEsque, "slug" | "name" | "shortName" | "subProvider">>;
12
+ } | null,
13
+ model: string,
14
+): ModelEsque | undefined {
15
+ if (!entry || (entry.enabled && entry.isAvailable) || !model) return undefined;
16
+ if (entry.driverKind === "opencode" || entry.driverKind === "antigravity") return undefined;
17
+ return entry.models.find((candidate) => candidate.slug === model) ?? { slug: model, name: model };
18
+}
apps/web/src/components/chat/ProviderModelPicker.tsx
+2
@@ -21,6 +21,7 @@ import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
21
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
22
import { cn } from "~/lib/utils";
23
import { ModelPickerContent, resolveModelPickerSelectedModel } from "./ModelPickerContent";
24
+import { retainedModelWhileProviderLocked } from "./ProviderModelPicker.logic";
25
import { ChatGptSharingControl } from "./ChatGptSharingControl";
26
import { ProviderInstanceIcon } from "./ProviderInstanceIcon";
27
import { ModelEsque, getDisplayModelName, getTriggerDisplayModelName } from "./providerIconUtils";
@@ -161,6 +162,7 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
162
model: props.model,
163
options: selectedInstanceOptions,
164
}) ??
165
+ retainedModelWhileProviderLocked(activeEntry, props.model) ??
166
(activeEntry?.driverKind === "opencode" || activeEntry?.driverKind === "antigravity"
167
? undefined
168
: selectedInstanceOptions[0]);
apps/web/src/components/settings/ProjectDefaultsSettings.logic.test.ts
new
+112
@@ -0,0 +1,112 @@
1
+import { ProviderDriverKind, ProviderInstanceId, type ServerProvider } from "@t3tools/contracts";
2
+import { DEFAULT_UNIFIED_SETTINGS, type UnifiedSettings } from "@t3tools/contracts/settings";
3
+import { createModelSelection } from "@t3tools/shared/model";
4
+import { describe, expect, it } from "vite-plus/test";
5
+
6
+import { providerInstanceEntriesFor } from "../../providerInstances";
7
+import { resolveDefaultModelSettingsPresentation } from "./ProjectDefaultsSettings.logic";
8
+
9
+const claudeId = ProviderInstanceId.make("claudeAgent");
10
+const high = [{ id: "effort", value: "high" }];
11
+const savedClaude = createModelSelection(claudeId, "claude-opus-4-8", high);
12
+function provider(input: {
13
+ instanceId: string;
14
+ driver: string;
15
+ enabled?: boolean;
16
+ availability?: ServerProvider["availability"];
17
+ models: ReadonlyArray<string>;
18
+}): ServerProvider {
19
+ return {
20
+ instanceId: ProviderInstanceId.make(input.instanceId),
21
+ driver: ProviderDriverKind.make(input.driver),
22
+ enabled: input.enabled ?? true,
23
+ installed: true,
24
+ version: null,
25
+ status: "ready",
26
+ ...(input.availability ? { availability: input.availability } : {}),
27
+ auth: { status: "authenticated" },
28
+ checkedAt: "2026-01-01T00:00:00.000Z",
29
+ models: input.models.map((slug, index) => ({
30
+ slug,
31
+ name: slug,
32
+ isCustom: false,
33
+ ...(index === 0 ? { isDefault: true } : {}),
34
+ capabilities: {},
35
+ })),
36
+ slashCommands: [],
37
+ skills: [],
38
+ };
39
+}
40
+
41
+const claudeAndCodex = [
42
+ provider({ instanceId: "codex", driver: "codex", models: ["gpt-5.6"] }),
43
+ provider({ instanceId: "claudeAgent", driver: "claudeAgent", models: ["claude-opus-4-8"] }),
44
+];
45
+
46
+function present(
47
+ providers: ReadonlyArray<ServerProvider>,
48
+ overrides: Partial<UnifiedSettings> = {},
49
+) {
50
+ const settings = {
51
+ ...DEFAULT_UNIFIED_SETTINGS,
52
+ defaultModelSelection: savedClaude,
53
+ ...overrides,
54
+ };
55
+ return resolveDefaultModelSettingsPresentation({
56
+ entries: providerInstanceEntriesFor(providers, settings, null),
57
+ providers,
58
+ settings,
59
+ projectId: null,
60
+ });
61
+}
62
+
63
+const claudeOff: Partial<UnifiedSettings> = {
64
+ providerInstances: {
65
+ [claudeId]: { driver: ProviderDriverKind.make("claudeAgent"), enabled: false },
66
+ },
67
+};
68
+
69
+describe("resolveDefaultModelSettingsPresentation", () => {
70
+ it("keeps the saved model and explains why when its provider cannot run", () => {
71
+ const withoutClaude = claudeAndCodex.filter((entry) => entry.instanceId !== claudeId);
72
+ const claudeUnavailable = claudeAndCodex.map((entry) =>
73
+ entry.instanceId === claudeId ? { ...entry, availability: "unavailable" as const } : entry,
74
+ );
75
+ // Settings turn Claude off before the server snapshot reflects it.
76
+ expect(present(claudeAndCodex, claudeOff)).toEqual({
77
+ selection: savedClaude,
78
+ providerNote: "Claude is turned off.",
79
+ });
80
+ expect(present(claudeUnavailable)).toEqual({
81
+ selection: savedClaude,
82
+ providerNote: "Claude is unavailable.",
83
+ });
84
+ expect(present(withoutClaude)).toEqual({
85
+ selection: savedClaude,
86
+ providerNote: "This provider is not available on this environment.",
87
+ });
88
+ });
89
+
90
+ it("leaves effort editable when the saved provider can run", () => {
91
+ expect(present(claudeAndCodex)).toEqual({ selection: savedClaude, providerNote: null });
92
+ });
93
+
94
+ it("still follows a hidden model on the same provider", () => {
95
+ const row = present(
96
+ [
97
+ provider({
98
+ instanceId: "claudeAgent",
99
+ driver: "claudeAgent",
100
+ models: ["claude-sonnet-5", "claude-opus-4-8"],
101
+ }),
102
+ ],
103
+ {
104
+ providerModelPreferences: {
105
+ [claudeId]: { hiddenModels: ["claude-opus-4-8"], modelOrder: [] },
106
+ },
107
+ },
108
+ );
109
+ expect(row.providerNote).toBeNull();
110
+ expect(row.selection).toMatchObject({ instanceId: claudeId, model: "claude-sonnet-5" });
111
+ });
112
+});
apps/web/src/components/settings/ProjectDefaultsSettings.logic.ts
new
+58
@@ -0,0 +1,58 @@
1
+import type { ModelSelection, ProjectId, ServerProvider } from "@t3tools/contracts";
2
+import type { UnifiedSettings } from "@t3tools/contracts/settings";
3
+
4
+import { resolveEffectiveDefaultModelSelection } from "../../modelSelection";
5
+import {
6
+ resolveDefaultProviderModelSelection,
7
+ resolveProjectDefaultProviderModelSelection,
8
+ type ProviderInstanceEntry,
9
+} from "../../providerInstances";
10
+
11
+export interface DefaultModelSettingsPresentation {
12
+ readonly selection: ModelSelection | null;
13
+ /** Set when the saved model's provider cannot run; effort stays hidden until it can. */
14
+ readonly providerNote: string | null;
15
+}
16
+
17
+export function resolveDefaultModelSettingsPresentation(input: {
18
+ readonly entries: ReadonlyArray<ProviderInstanceEntry>;
19
+ readonly providers: ReadonlyArray<ServerProvider>;
20
+ readonly settings: UnifiedSettings;
21
+ readonly projectId: ProjectId | null;
22
+}): DefaultModelSettingsPresentation {
23
+ const saved = input.settings.defaultModelSelection;
24
+ if (saved === null) {
25
+ const automatic = resolveProjectDefaultProviderModelSelection(
26
+ input.providers,
27
+ input.settings,
28
+ input.projectId,
29
+ );
30
+ return {
31
+ selection: automatic
32
+ ? resolveEffectiveDefaultModelSelection(input.settings, input.providers, automatic)
33
+ : null,
34
+ providerNote: null,
35
+ };
36
+ }
37
+
38
+ const savedEntry = input.entries.find((entry) => entry.instanceId === saved.instanceId);
39
+ const resolved = resolveDefaultProviderModelSelection(input.providers, saved);
40
+ // Settings can turn a provider off before the server snapshot catches up, so check both.
41
+ if (
42
+ !savedEntry?.enabled ||
43
+ !savedEntry.isAvailable ||
44
+ resolved?.instanceId !== saved.instanceId
45
+ ) {
46
+ return { selection: saved, providerNote: providerNote(savedEntry) };
47
+ }
48
+ return {
49
+ selection: resolveEffectiveDefaultModelSelection(input.settings, input.providers, resolved),
50
+ providerNote: null,
51
+ };
52
+}
53
+
54
+function providerNote(entry: ProviderInstanceEntry | undefined): string {
55
+ if (!entry) return "This provider is not available on this environment.";
56
+ if (!entry.enabled) return `${entry.displayName} is turned off.`;
57
+ return `${entry.displayName} is unavailable.`;
58
+}
apps/web/src/components/settings/ProjectDefaultsSettings.tsx
+12
-16
@@ -12,13 +12,8 @@ import { useClientSettings } from "../../hooks/useSettings";
12
import {
13
defaultModelSelectionsAreMixed,
14
getCustomModelOptionsByInstance,
15
- resolveEffectiveDefaultModelSelection,
15
} from "../../modelSelection";
17
-import {
18
- providerInstanceEntriesFor,
19
- resolveDefaultProviderModelSelection,
20
- resolveProjectDefaultProviderModelSelection,
21
-} from "../../providerInstances";
16
+import { providerInstanceEntriesFor } from "../../providerInstances";
17
import { useEnvironmentProviders, useEnvironments } from "../../state/environments";
18
import { firstManagedDenial } from "../../state/managedPolicy";
19
import { EMPTY_SERVER_PROVIDERS } from "../../state/server";
@@ -30,6 +25,7 @@ import { TraitsPicker } from "../chat/TraitsPicker";
25
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
26
import { toastManager } from "../ui/toast";
27
import { Switch } from "../ui/switch";
28
+import { resolveDefaultModelSettingsPresentation } from "./ProjectDefaultsSettings.logic";
29
import type { ProjectSettingsCategory } from "./ProjectSettingsPanel";
30
import { searchableSetting } from "./settingsSearch";
31
import { useSettingsScope } from "./SettingsScopeContext";
@@ -67,14 +63,14 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
63
(representative?.serverConfig
64
? providersByEnvironment.get(representative.environmentId)
65
: undefined) ?? EMPTY_SERVER_PROVIDERS;
70
- const storedSelection =
71
- settings.defaultModelSelection === null
72
- ? resolveProjectDefaultProviderModelSelection(providers, settings, target?.projectId ?? null)
73
- : resolveDefaultProviderModelSelection(providers, settings.defaultModelSelection);
74
- const selection = storedSelection
75
- ? resolveEffectiveDefaultModelSelection(settings, providers, storedSelection)
76
- : null;
66
const entries = providerInstanceEntriesFor(providers, settings, target?.projectId ?? null);
67
+ const presentation = resolveDefaultModelSettingsPresentation({
68
+ entries,
69
+ providers,
70
+ settings,
71
+ projectId: target?.projectId ?? null,
72
+ });
73
+ const selection = presentation.selection;
74
const modelOptions = getCustomModelOptionsByInstance(
75
settings,
76
providers,
@@ -146,7 +142,7 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
142
status={
143
mixedModel
144
? `${automaticModel ? "Automatic defaults differ." : "Defaults differ."} Select one environment or choose a shared model to edit effort.`
149
- : effortDisabledReason
145
+ : (presentation.providerNote ?? effortDisabledReason)
146
}
147
resetAction={
148
settings.defaultModelSelection !== null ? (
@@ -154,7 +150,7 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
150
) : null
151
}
152
control={
157
- selection && activeEntry ? (
153
+ selection ? (
154
<div className="flex min-w-0 flex-wrap items-center justify-end gap-1.5">
155
<ProviderModelPicker
156
environmentId={representative?.environmentId ?? null}
@@ -179,7 +175,7 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
175
setModel(createModelSelection(instanceId, model))
176
}
177
/>
182
- {!mixedModel && !effortDisabledReason ? (
178
+ {!mixedModel && !presentation.providerNote && !effortDisabledReason && activeEntry ? (
179
<TraitsPicker
180
provider={activeEntry.driverKind}
181
models={activeEntry.models}