The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 22:15 UTC
fix(shared): new chats use the global default when the project default model is hidden (#23615)
Julius Marminge committed
Nov 11, 2026 at 15:35 UTC
9b98bd07ba461a32920f28a8929810fd097b28a7
2 files changed
+42
packages/shared/src/projectSettings.test.ts
+26
@@ -119,6 +119,32 @@ describe("resolveProjectSettings", () => {
119
expect(resolved.sources.defaultModelSelection).toBe("environment");
120
});
121
122
+ // regression: #17556 a hidden project default silently became the catalog's first model
123
+ it.each([
124
+ ["hidden", ["gpt-5.6-terra", "gpt-5.6-sol"], [], "gpt-6.1-sol", "environment"],
125
+ ["visible", ["gpt-5.6-terra"], [], "gpt-5.6-sol", "project"],
126
+ ["custom", ["gpt-5.6-sol"], ["gpt-5.6-sol"], "gpt-5.6-sol", "project"],
127
+ ] as const)(
128
+ "resolves a %s project default model against the environment default",
129
+ (_visibility, hiddenModels, customModels, expectedModel, expectedSource) => {
130
+ const codex = ProviderInstanceId.make("codex");
131
+ const settings = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, {
132
+ defaultModelSelection: createModelSelection(codex, "gpt-6.1-sol"),
133
+ providerInstances: {
134
+ [codex]: { driver: ProviderDriverKind.make("codex"), config: { customModels } },
135
+ },
136
+ providerModelPreferences: { [codex]: { hiddenModels, modelOrder: [] } },
137
+ projectSettingsOverrides: {
138
+ [projectId]: { defaultModelSelection: createModelSelection(codex, "gpt-5.6-sol") },
139
+ },
140
+ });
141
+ const resolved = resolveProjectSettings(settings, projectId);
142
+ expect(resolved.settings.defaultModelSelection?.model).toBe(expectedModel);
143
+ expect(resolved.sources.defaultModelSelection).toBe(expectedSource);
144
+ expect(resolved.overrides.defaultModelSelection?.model).toBe("gpt-5.6-sol");
145
+ },
146
+ );
147
+
148
it("moves text generation off an instance the project turned off", () => {
149
const codex = ProviderInstanceId.make("codex");
150
const settings = {
packages/shared/src/projectSettings.ts
+16
@@ -14,6 +14,7 @@ import {
14
type ThreadEnvMode,
15
type WorktreeCleanupRules,
16
} from "@t3tools/contracts";
17
+import { readCustomModelEntries } from "./model.ts";
18
import { normalizeProjectPathForComparison } from "./path.ts";
19
import { fallbackTextGenerationModelSelection } from "./serverSettings.ts";
20
@@ -148,6 +149,21 @@ function resolveProjectOverrides(
149
) {
150
continue;
151
}
152
+ // Clients resolve a hidden model to the catalog's first visible one, so a
153
+ // hidden project default would silently pick a model nobody chose.
154
+ // Custom models stay visible even when listed as hidden, as in the clients.
155
+ if (key === "defaultModelSelection" && value !== null) {
156
+ const { instanceId, model } = value as ModelSelection;
157
+ const config = settings.providerInstances[instanceId]?.config as
158
+ | { customModels?: unknown }
159
+ | undefined;
160
+ if (
161
+ settings.providerModelPreferences?.[instanceId]?.hiddenModels.includes(model) &&
162
+ !readCustomModelEntries(config?.customModels).some((entry) => entry.slug === model)
163
+ ) {
164
+ continue;
165
+ }
166
+ }
167
effective[key] = value;
168
sources[key] = "project";
169
}