From 5f9259569a82a922f45db1d979c2252fa618c643 Mon Sep 17 00:00:00 2001 From: Tamaz_Sujashvili <56168197+Tamaz-sujashvili@users.noreply.github.com> Date: Fri, 5 Jun 2026 02:41:24 +0400 Subject: [PATCH] fix(desktop): refresh model picker when resuming a cached session The fast resume path updated cwd/branch but not model/provider, so the header stayed on the previous session's model until a full gateway resume. Fixes NousResearch/hermes-agent#38901 Co-authored-by: Cursor --- .../app/session/hooks/use-session-actions.ts | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/app/session/hooks/use-session-actions.ts b/apps/desktop/src/app/session/hooks/use-session-actions.ts index 6b4b08f945f4e..f6383d9a327ec 100644 --- a/apps/desktop/src/app/session/hooks/use-session-actions.ts +++ b/apps/desktop/src/app/session/hooks/use-session-actions.ts @@ -42,7 +42,13 @@ import { setYoloActive } from '@/store/session' import { reportBackendContract } from '@/store/updates' -import type { SessionCreateResponse, SessionInfo, SessionResumeResponse, UsageStats } from '@/types/hermes' +import type { + ModelOptionsResponse, + SessionCreateResponse, + SessionInfo, + SessionResumeResponse, + UsageStats +} from '@/types/hermes' import { NEW_CHAT_ROUTE, sessionRoute, SETTINGS_ROUTE } from '../../routes' import type { ClientSessionState, SidebarNavItem } from '../../types' @@ -437,6 +443,30 @@ export function useSessionActions({ clearComposerDraft() clearComposerAttachments() + const storedRow = $sessions + .get() + .find(session => session.id === storedSessionId || session._lineage_root_id === storedSessionId) + + if (storedRow?.model) { + setCurrentModel(storedRow.model) + } + + void requestGateway('model.options', { session_id: cachedRuntimeId }) + .then(opts => { + if (!isCurrentResume()) { + return + } + + if (opts.model) { + setCurrentModel(opts.model) + } + + if (opts.provider) { + setCurrentProvider(opts.provider) + } + }) + .catch(() => undefined) + void requestGateway('session.usage', { session_id: cachedRuntimeId }) .then(usage => { if (isCurrentResume() && usage) {