Skip to content

Commit 5baa5db

Browse files
authored
🤖 fix: restore LRU model default for new workspaces (#703)
Reverts a regression introduced in 2c700b8 where the default model was hardcoded to Sonnet 4.5. Now defaults to the most recently used model (LRU) as expected. _Generated with `mux`_
1 parent 75dcd8f commit 5baa5db

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/browser/hooks/useSendMessageOptions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useThinkingLevel } from "./useThinkingLevel";
22
import { useMode } from "@/browser/contexts/ModeContext";
33
import { usePersistedState } from "./usePersistedState";
4+
import { getDefaultModelFromLRU } from "./useModelLRU";
45
import { modeToToolPolicy, PLAN_MODE_INSTRUCTION } from "@/common/utils/ui/modeUtils";
56
import { getModelKey } from "@/common/constants/storage";
67
import type { SendMessageOptions } from "@/common/types/ipc";
@@ -10,7 +11,6 @@ import type { MuxProviderOptions } from "@/common/types/providerOptions";
1011
import { getSendOptionsFromStorage } from "@/browser/utils/messages/sendOptions";
1112
import { enforceThinkingPolicy } from "@/browser/utils/thinking/policy";
1213
import { useProviderOptions } from "./useProviderOptions";
13-
import { WORKSPACE_DEFAULTS } from "@/constants/workspaceDefaults";
1414

1515
/**
1616
* Construct SendMessageOptions from raw values
@@ -56,9 +56,10 @@ export function useSendMessageOptions(workspaceId: string): SendMessageOptions {
5656
const [thinkingLevel] = useThinkingLevel();
5757
const [mode] = useMode();
5858
const { options: providerOptions } = useProviderOptions();
59+
const defaultModel = getDefaultModelFromLRU();
5960
const [preferredModel] = usePersistedState<string>(
6061
getModelKey(workspaceId),
61-
WORKSPACE_DEFAULTS.model, // Hard-coded default (LRU is UI convenience)
62+
defaultModel, // Default to most recently used model
6263
{ listener: true } // Listen for changes from ModelSelector and other sources
6364
);
6465

@@ -67,7 +68,7 @@ export function useSendMessageOptions(workspaceId: string): SendMessageOptions {
6768
thinkingLevel,
6869
preferredModel,
6970
providerOptions,
70-
WORKSPACE_DEFAULTS.model
71+
defaultModel
7172
);
7273
}
7374

src/browser/utils/messages/sendOptions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getModelKey, getThinkingLevelKey, getModeKey } from "@/common/constants/storage";
22
import { modeToToolPolicy, PLAN_MODE_INSTRUCTION } from "@/common/utils/ui/modeUtils";
33
import { readPersistedState } from "@/browser/hooks/usePersistedState";
4+
import { getDefaultModelFromLRU } from "@/browser/hooks/useModelLRU";
45
import type { SendMessageOptions } from "@/common/types/ipc";
56
import type { UIMode } from "@/common/types/mode";
67
import type { ThinkingLevel } from "@/common/types/thinking";
@@ -36,8 +37,8 @@ function getProviderOptions(): MuxProviderOptions {
3637
* This ensures DRY - single source of truth for option extraction.
3738
*/
3839
export function getSendOptionsFromStorage(workspaceId: string): SendMessageOptions {
39-
// Read model preference (workspace-specific), fallback to immutable defaults
40-
const model = readPersistedState<string>(getModelKey(workspaceId), WORKSPACE_DEFAULTS.model);
40+
// Read model preference (workspace-specific), fallback to LRU default
41+
const model = readPersistedState<string>(getModelKey(workspaceId), getDefaultModelFromLRU());
4142

4243
// Read thinking level (workspace-specific)
4344
const thinkingLevel = readPersistedState<ThinkingLevel>(

0 commit comments

Comments
 (0)