@devries-cameron20 / t3code-1 / commits / 92388d5a08
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): picking a custom model named like a Codex alias keeps that model (#29789)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Alex Southwell committed Nov 3, 2026 at 23:27 UTC 92388d5a083b7b077ed4aeddaca6b7f1b6971e6f
2 files changed +22 -4
apps/web/src/composerDraftStore.test.ts
+14
@@ -1754,6 +1754,7 @@ describe("composerDraftStore modelSelection", () => {
1754 ).toEqual(
1755 expect.objectContaining({
1756 instanceId: CODEX_SECONDARY_INSTANCE,
1757 + model: "gpt-5-codex",
1758 options: [{ id: "reasoningEffort", value: "low" }],
1759 }),
1760 );
@@ -1770,6 +1771,19 @@ describe("composerDraftStore modelSelection", () => {
1771 options: [{ id: "reasoningEffort", value: "low" }],
1772 }),
1773 );
1774 + expect(
1775 + useComposerDraftStore.getState().stickyOptionsByModelByProvider[CODEX_SECONDARY_INSTANCE],
1776 + ).toEqual({ "gpt-5-codex": [{ id: "reasoningEffort", value: "low" }] });
1777 +
1778 + // A custom slug that matches a Codex alias stays exact; the picker already resolved it.
1779 + store.setModelSelection(threadRef, createModelSelection(CODEX_SECONDARY_INSTANCE, "gpt-5.3"), {
1780 + explicit: true,
1781 + replaceOptions: true,
1782 + });
1783 + expect(
1784 + draftFor(threadId, TEST_ENVIRONMENT_ID)?.modelSelectionByProvider[CODEX_SECONDARY_INSTANCE]
1785 + ?.model,
1786 + ).toBe("gpt-5.3");
1787 });
1788 });
1789
apps/web/src/composerDraftStore.ts
+8 -4
@@ -42,6 +42,7 @@ import { DeepMutable } from "effect/Types";
42 import {
43 createModelSelection,
44 draftModelPickMatchesThread,
45 + normalizeCustomModelSlug,
46 normalizeModelSlug,
47 } from "@t3tools/shared/model";
48 import { AsyncResult, Atom, type AtomRegistry } from "effect/reactivity";
@@ -990,7 +991,11 @@ function normalizeModelSelection(
991 const driverKindHint =
992 normalizeProviderDriverKind(candidate?.provider ?? legacy?.provider) ??
993 ProviderDriverKind.make("codex");
993 - const model = normalizeModelSlug(rawModel, driverKindHint);
994 + // Instance-scoped picks are already resolved slugs; a custom slug can match a static alias.
995 + const model =
996 + candidate?.instanceId === undefined
997 + ? normalizeModelSlug(rawModel, driverKindHint)
998 + : normalizeCustomModelSlug(rawModel);
999 if (!model) {
1000 return null;
1001 }
@@ -3066,7 +3071,7 @@ const composerDraftStore = create<ComposerDraftStoreState>()(
3071 }
3072 const instanceKey = options?.instanceId ?? defaultInstanceIdForDriver(normalizedProvider);
3073 const fallbackModel =
3069 - normalizeModelSlug(options?.model, normalizedProvider) ??
3074 + normalizeCustomModelSlug(options?.model) ??
3075 DEFAULT_MODEL_BY_PROVIDER[normalizedProvider] ??
3076 DEFAULT_MODEL;
3077 const providerOpts =
@@ -3098,8 +3103,7 @@ const composerDraftStore = create<ComposerDraftStoreState>()(
3103 nextStickyMap[instanceKey] ??
3104 base.modelSelectionByProvider[instanceKey] ??
3105 createModelSelection(instanceKey, fallbackModel);
3101 - const rememberedModel =
3102 - normalizeModelSlug(options?.model, normalizedProvider) ?? stickyBase.model;
3106 + const rememberedModel = normalizeCustomModelSlug(options?.model) ?? stickyBase.model;
3107 if (providerOpts) {
3108 nextStickyMap[instanceKey] = createModelSelection(
3109 instanceKey,