The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a failed primary model switch restores the wire stamp
kshitijk4poorfd1a93d31904
diff --git a/apps/desktop/src/app/session/hooks/use-model-controls.test.tsx b/apps/desktop/src/app/session/hooks/use-model-controls.test.tsxindex b64bd04c608..47b048fa8ad 100644--- a/apps/desktop/src/app/session/hooks/use-model-controls.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-model-controls.test.tsx@@ -9,10 +9,12 @@ import {$activeSessionId,$currentModel,$currentProvider,+ $currentReasoningEffortWire,getCurrentModelSource,setCurrentModel,setCurrentModelSource,- setCurrentProvider+ setCurrentProvider,+ setCurrentReasoningEffortWire} from '@/store/session'import * as SessionStates from '@/store/session-states'@@ -432,6 +434,7 @@ describe('useModelControls', () => {$activeSessionId.set('session-1')setCurrentModel('fable-5')setCurrentProvider('nous')+ setCurrentReasoningEffortWire('max')const requestGateway = vi.fn(async () => {throw new Error('no such model')@@ -445,6 +448,8 @@ describe('useModelControls', () => {expect($currentModel.get()).toBe('fable-5')expect($currentProvider.get()).toBe('nous')+ // The old route's clamp is true again once the switch is undone.+ expect($currentReasoningEffortWire.get()).toBe('max')expect(notifyError).toHaveBeenCalled()})diff --git a/apps/desktop/src/app/session/hooks/use-model-controls.ts b/apps/desktop/src/app/session/hooks/use-model-controls.tsindex 885cc4ef697..f3ee32ae39f 100644--- a/apps/desktop/src/app/session/hooks/use-model-controls.ts+++ b/apps/desktop/src/app/session/hooks/use-model-controls.ts@@ -19,12 +19,14 @@ import {$activeSessionId,$currentModel,$currentProvider,+ $currentReasoningEffortWire,getComposerSelectionGeneration,getCurrentModelSource,markComposerSelectionManual,setCurrentModel,setCurrentModelSource,- setCurrentProvider+ setCurrentProvider,+ setCurrentReasoningEffortWire} from '@/store/session'import { $sessionStates, sessionTileDelegate } from '@/store/session-states'@@ -261,7 +263,9 @@ export function useModelControls({? $currentProvider.get(): ($sessionStates.get()[liveSessionId!]?.provider ?? '')- const prevTileWire = touchesPrimary ? '' : ($sessionStates.get()[liveSessionId!]?.reasoningEffortWire ?? '')+ const prevWire = touchesPrimary+ ? $currentReasoningEffortWire.get()+ : ($sessionStates.get()[liveSessionId!]?.reasoningEffortWire ?? '')const prevSource = getCurrentModelSource()const liveGatewayProfile = cacheProfile || $activeGatewayProfile.get()@@ -291,13 +295,15 @@ export function useModelControls({if (touchesPrimary) {setCurrentModel(prevModel)setCurrentProvider(prevProvider)+ // The setters withdraw the wire stamp on a change; the old route's stamp is still true.+ setCurrentReasoningEffortWire(prevWire)setCurrentModelSource(prevSource)} else if (liveSessionId) {sessionTileDelegate()?.updateSession(liveSessionId, state => ({...state,model: prevModel,provider: prevProvider,- reasoningEffortWire: prevTileWire+ reasoningEffortWire: prevWire}))}