@devries-cameron20 / t3code-1 / commits / 2828f28145
Fork 0

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

fix(web): composer follows an optionless thread instead of the settings default (#16546)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

F4llen committed Nov 11, 2026 at 06:23 UTC 2828f28145e1611e7f50274e8049e04e8fa0b7f5
2 files changed +74 -4
apps/web/src/composerDraftStore.ts
+3 -4
@@ -1165,13 +1165,12 @@ export function deriveEffectiveComposerModelState(input: {
1165 activeSelection.model,
1166 ))
1167 : baseModel;
1168 - // Options come from the first of the draft, thread and project that has any. Their selections
1169 - // stay with them, so a fallback instance can check which model the options belong to.
1168 + // Draft options win; otherwise an existing thread's options, even none, outrank the project's.
1169 + // Selections stay with them, so a fallback instance can check which model the options belong to.
1170 const optionSelections =
1171 [
1172 input.draft?.modelSelectionByProvider,
1173 - selectionsByInstance(input.threadModelSelection),
1174 - selectionsByInstance(input.projectModelSelection),
1173 + selectionsByInstance(input.threadModelSelection ?? input.projectModelSelection),
1174 ].find((selections) => modelSelectionByProviderToOptions(selections) !== null) ?? null;
1175 const modelOptions = modelSelectionByProviderToOptions(optionSelections);
1176
apps/web/src/modelSelection.test.ts
+71
@@ -712,6 +712,77 @@ describe("instance-scoped model selection", () => {
712 ).toEqual(saved);
713 });
714
715 + describe("composer model option precedence", () => {
716 + const instanceId = ProviderInstanceId.make("claudeAgent");
717 + const driver = ProviderDriverKind.make("claudeAgent");
718 + const base = provider({ provider: driver, instanceId, models: ["claude-opus-5-5"] });
719 + const providers = [
720 + {
721 + ...base,
722 + models: base.models.map((model) => ({
723 + ...model,
724 + capabilities: {
725 + optionDescriptors: [
726 + {
727 + id: "effort",
728 + label: "Effort",
729 + type: "select" as const,
730 + options: [
731 + { id: "medium", label: "Medium", isDefault: true },
732 + { id: "high", label: "High" },
733 + ],
734 + currentValue: "medium",
735 + },
736 + ],
737 + },
738 + })),
739 + },
740 + ];
741 + const settingsDefault = createModelSelection(instanceId, "claude-opus-5-5", [
742 + { id: "effort", value: "high" },
743 + ]);
744 + const dispatchedSelection = (
745 + threadModelSelection: ReturnType<typeof createModelSelection> | null,
746 + ) => {
747 + const state = deriveEffectiveComposerModelState({
748 + draft: null,
749 + providers,
750 + selectedProvider: driver,
751 + selectedInstanceId: instanceId,
752 + threadModelSelection,
753 + projectModelSelection: settingsDefault,
754 + settings: settingsWithProviderInstances(),
755 + });
756 + const dispatch = getComposerProviderState({
757 + provider: driver,
758 + model: state.selectedModel,
759 + models: providers[0]!.models,
760 + modelOptions: state.modelOptions?.[instanceId],
761 + });
762 + return createModelSelection(
763 + instanceId,
764 + state.selectedModel,
765 + dispatch.modelOptionsForDispatch,
766 + );
767 + };
768 +
769 + it("does not inherit settings options for an optionless existing thread", () => {
770 + const threadSelection = createModelSelection(instanceId, "claude-opus-5-5");
771 + expect(dispatchedSelection(threadSelection)).toEqual(threadSelection);
772 + });
773 +
774 + it("keeps the options it was saved with", () => {
775 + const threadSelection = createModelSelection(instanceId, "claude-opus-5-5", [
776 + { id: "effort", value: "medium" },
777 + ]);
778 + expect(dispatchedSelection(threadSelection)).toEqual(threadSelection);
779 + });
780 +
781 + it("leaves the settings default's options in place before a thread exists", () => {
782 + expect(dispatchedSelection(null)).toEqual(settingsDefault);
783 + });
784 + });
785 +
786 it("keeps a custom-instance draft model while dropping unsupported options", () => {
787 const instanceId = ProviderInstanceId.make("claude_openrouter");
788 const driver = ProviderDriverKind.make("claudeAgent");