Skip to content

The agent that grows with you

fix(desktop): don't flash the profile-default effort before a resumed session reports its own

brooklyn!0048071c6551
diff --git a/apps/desktop/src/app/chat/composer/model-pill.test.tsx b/apps/desktop/src/app/chat/composer/model-pill.test.tsx
index 79d9248330e..2dc32500b71 100644
--- a/apps/desktop/src/app/chat/composer/model-pill.test.tsx
+++ b/apps/desktop/src/app/chat/composer/model-pill.test.tsx
@@ -144,6 +144,7 @@ describe('ModelPill per-surface model label', () => {
$model: atom('tile/claude-sonnet'),
$provider: atom('anthropic'),
$reasoningEffort: atom('high'),
+ $reasoningEffortPending: atom(false),
$reasoningEffortWire: atom(''),
$runtimeId: atom('tile-runtime'),
$storedId: atom('stored-tile'),
diff --git a/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx b/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx
index c08af916493..ed10f1a4954 100644
--- a/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx
+++ b/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx
@@ -1,10 +1,18 @@
-import { cleanup, render, screen } from '@testing-library/react'
+import { act, cleanup, render, screen } from '@testing-library/react'
import { atom } from 'nanostores'
import { afterEach, describe, expect, it } from 'vitest'
import type { ChatBarState } from '@/app/chat/composer/types'
-import { type SessionView, SessionViewProvider } from '@/app/chat/session-view'
-import { $defaultReasoningEffort } from '@/store/session'
+import { PRIMARY_SESSION_VIEW, type SessionView, SessionViewProvider } from '@/app/chat/session-view'
+import { applySessionInfoStatePatch, sessionInfoStatePatch } from '@/app/session/hooks/use-message-stream/utils'
+import { createClientSessionState } from '@/lib/chat-runtime'
+import {
+ $activeSessionId,
+ $defaultReasoningEffort,
+ $selectedStoredSessionId,
+ setCurrentReasoningEffort
+} from '@/store/session'
+import { $sessionStates, publishSessionState } from '@/store/session-states'
import { ReasoningPill } from './reasoning-pill'
@@ -28,6 +36,7 @@ const tileView = (reasoningEffort: string, reasoningEffortWire = ''): SessionVie
$model: atom('tile/claude-sonnet'),
$provider: atom('anthropic'),
$reasoningEffort: atom(reasoningEffort),
+ $reasoningEffortPending: atom(false),
$reasoningEffortWire: atom(reasoningEffortWire),
$runtimeId: atom('tile-runtime'),
$storedId: atom('stored-tile'),
@@ -37,6 +46,9 @@ const tileView = (reasoningEffort: string, reasoningEffortWire = ''): SessionVie
afterEach(() => {
cleanup()
$defaultReasoningEffort.set('')
+ $activeSessionId.set(null)
+ $selectedStoredSessionId.set(null)
+ $sessionStates.set({})
})
describe('ReasoningPill', () => {
@@ -84,6 +96,61 @@ describe('ReasoningPill', () => {
expect(screen.getByTestId('reasoning-pill').textContent).toBe('High')
})
+ it("never paints the profile default while a resumed session's own effort is still loading (#79807)", () => {
+ // Profile says ultra; the session being reopened is pinned to max.
+ $defaultReasoningEffort.set('ultra')
+ setCurrentReasoningEffort('')
+ $selectedStoredSessionId.set('stored-1')
+ $activeSessionId.set(null)
+
+ render(
+ <SessionViewProvider value={PRIMARY_SESSION_VIEW}>
+ <ReasoningPill disabled={false} model={modelState()} />
+ </SessionViewProvider>
+ )
+
+ const label = () => screen.getByTestId('reasoning-pill').textContent
+
+ // session.resume in flight: no runtime slice yet.
+ expect(label()).not.toContain('Ultra')
+
+ // Cold resume answered before the agent build, so no effort was reported.
+ act(() => {
+ publishSessionState('rt-1', { ...createClientSessionState('stored-1'), reasoningEffortPending: true })
+ $activeSessionId.set('rt-1')
+ })
+ expect(label()).not.toContain('Ultra')
+
+ // The built agent's session.info carries the session's real level.
+ act(() => {
+ const state = $sessionStates.get()['rt-1']!
+ publishSessionState('rt-1', applySessionInfoStatePatch(state, sessionInfoStatePatch({ reasoning_effort: 'max' })))
+ })
+ expect(label()).toBe('Max')
+ })
+
+ it('falls back to the profile default once the runtime reports the session has no pin of its own', () => {
+ $defaultReasoningEffort.set('ultra')
+ $selectedStoredSessionId.set('stored-1')
+
+ act(() => {
+ publishSessionState('rt-1', { ...createClientSessionState('stored-1'), reasoningEffortPending: true })
+ $activeSessionId.set('rt-1')
+ })
+
+ render(
+ <SessionViewProvider value={PRIMARY_SESSION_VIEW}>
+ <ReasoningPill disabled={false} model={modelState()} />
+ </SessionViewProvider>
+ )
+
+ act(() => {
+ const state = $sessionStates.get()['rt-1']!
+ publishSessionState('rt-1', applySessionInfoStatePatch(state, sessionInfoStatePatch({ reasoning_effort: '' })))
+ })
+ expect(screen.getByTestId('reasoning-pill').textContent).toBe('Ultra')
+ })
+
it('hides when the catalog says the model has no reasoning control, but not while that is unknown', () => {
const { unmount } = render(
<SessionViewProvider value={tileView('medium')}>
diff --git a/apps/desktop/src/app/chat/composer/reasoning-pill.tsx b/apps/desktop/src/app/chat/composer/reasoning-pill.tsx
index 2e0818678aa..a1626d0d71b 100644
--- a/apps/desktop/src/app/chat/composer/reasoning-pill.tsx
+++ b/apps/desktop/src/app/chat/composer/reasoning-pill.tsx
@@ -6,6 +6,7 @@ import { useSessionView } from '@/app/chat/session-view'
import { ModelMenuCloseContext } from '@/app/shell/model-menu-panel'
import { Button } from '@/components/ui/button'
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
+import { GlyphSpinner } from '@/components/ui/glyph-spinner'
import { releaseTypingFocus } from '@/components/ui/keyboard-first'
import { Tip } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
@@ -35,6 +36,7 @@ export function ReasoningPill({ disabled, model }: { disabled: boolean; model: C
const view = useSessionView()
const reasoningEffort = useStore(view.$reasoningEffort)
const reasoningEffortWire = useStore(view.$reasoningEffortWire)
+ const pending = useStore(view.$reasoningEffortPending)
const defaultEffort = useStore($defaultReasoningEffort)
const [open, setOpen] = useState(false)
@@ -49,9 +51,13 @@ export function ReasoningPill({ disabled, model }: { disabled: boolean; model: C
const clamp = reasoningEffortClamp(effort, reasoningEffortWire)
const label = reasoningEffortLabel(effort, reasoningEffortWire)
- const title = clamp
- ? `${copy.effort}: ${copy[clamp.effort]} (${copy.sendsOnRoute(copy[clamp.wire])})`
- : `${copy.effort}: ${label}`
+ // Until the session reports its own effort, the profile default is a guess
+ // about to be replaced (#79807). Show the model pill's quiet loader instead.
+ const title = pending
+ ? copy.effort
+ : clamp
+ ? `${copy.effort}: ${copy[clamp.effort]} (${copy.sendsOnRoute(copy[clamp.wire])})`
+ : `${copy.effort}: ${label}`
// Closing the menu ends its claim on the keyboard: Radix restores focus to
// this pill (a toolbar button), so without the release the Enter that
@@ -76,7 +82,7 @@ export function ReasoningPill({ disabled, model }: { disabled: boolean; model: C
type="button"
variant="ghost"
>
- <span>{label}</span>
+ {pending ? <GlyphSpinner className="opacity-50" spinner="braille" /> : <span>{label}</span>}
<ChevronDown className="size-2.5 shrink-0 opacity-50" />
</Button>
</DropdownMenuTrigger>
diff --git a/apps/desktop/src/app/chat/session-tile.tsx b/apps/desktop/src/app/chat/session-tile.tsx
index 9dbd34c5454..02de6f7ca35 100644
--- a/apps/desktop/src/app/chat/session-tile.tsx
+++ b/apps/desktop/src/app/chat/session-tile.tsx
@@ -73,7 +73,7 @@ import { startSessionDrag } from './session-drag'
import { SessionStatusDot } from './session-status-dot'
import { useSessionTileActions } from './session-tile-actions'
import { tileOwnerRoute } from './session-tile-owner'
-import { type SessionView, SessionViewProvider } from './session-view'
+import { reasoningEffortPending, type SessionView, SessionViewProvider } from './session-view'
import { SessionContextMenu } from './sidebar/session-actions-menu'
import { lastVisibleMessageIsUser } from './thread-loading'
@@ -149,6 +149,8 @@ function buildTileView(storedSessionId: string): SessionView {
$model: computed($state, state => state?.model ?? ''),
$provider: computed($state, state => state?.provider ?? ''),
$reasoningEffort: computed($state, state => state?.reasoningEffort ?? ''),
+ // No slice yet means the tile's resume is still in flight.
+ $reasoningEffortPending: computed($state, state => (state ? reasoningEffortPending(state) : true)),
$reasoningEffortWire: computed($state, state => state?.reasoningEffortWire ?? ''),
$runtimeId,
// Constant for the tile's lifetime — a plain atom, not a computed.
diff --git a/apps/desktop/src/app/chat/session-view.tsx b/apps/desktop/src/app/chat/session-view.tsx
index 4d9599b31c4..6542401119e 100644
--- a/apps/desktop/src/app/chat/session-view.tsx
+++ b/apps/desktop/src/app/chat/session-view.tsx
@@ -59,6 +59,10 @@ export interface SessionView {
$provider: ReadableAtom<string>
$fast: ReadableAtom<boolean>
$reasoningEffort: ReadableAtom<string>
+ /** The session's effort is not known yet (a resume in flight, or its agent
+ * still building), so an empty `$reasoningEffort` must not render as the
+ * profile default — that paints a level about to be replaced (#79807). */
+ $reasoningEffortPending: ReadableAtom<boolean>
/** Gateway-reported level the route sends for `$reasoningEffort` ('' = unknown). */
$reasoningEffortWire: ReadableAtom<string>
}
@@ -95,6 +99,21 @@ const $primaryBusy = computed([$primaryState, $busy, $selectedStoredSessionId],
state ? state.busy : selected ? false : draftBusy
)
+/** Whether a slice's effort is still unknown: marked pending by the resume and
+ * cleared by the first runtime report of `reasoning_effort` (even ''). */
+export const reasoningEffortPending = (state: ClientSessionState): boolean =>
+ Boolean(state.reasoningEffortPending) && !state.reasoningEffort
+
+/**
+ * Same reasoning as busy: a selected stored session with no slice yet is a
+ * cold resume in flight, whose effort the backend has not reported. The
+ * draft's '' there would render as the profile default. A true new chat (no
+ * stored id) is the composer's own pick and is never pending.
+ */
+const $primaryReasoningEffortPending = computed([$primaryState, $selectedStoredSessionId], (state, selected) =>
+ state ? reasoningEffortPending(state) : Boolean(selected)
+)
+
export const PRIMARY_SESSION_VIEW: SessionView = {
kind: 'primary',
$awaitingResponse: primaryField<boolean>(state => state.awaitingResponse, $awaitingResponse),
@@ -107,6 +126,7 @@ export const PRIMARY_SESSION_VIEW: SessionView = {
$model: primaryField<string>(state => state.model, $currentModel),
$provider: primaryField<string>(state => state.provider, $currentProvider),
$reasoningEffort: primaryField<string>(state => state.reasoningEffort, $currentReasoningEffort),
+ $reasoningEffortPending: $primaryReasoningEffortPending,
$reasoningEffortWire: primaryField<string>(state => state.reasoningEffortWire ?? '', $currentReasoningEffortWire),
$runtimeId: $activeSessionId,
$storedId: $selectedStoredSessionId,
diff --git a/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts b/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts
index 9d1eb2819f3..a525b8c20f9 100644
--- a/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts
+++ b/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts
@@ -1,7 +1,10 @@
import { renderHook } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { reasoningEffortPending } from '@/app/chat/session-view'
+import type { ClientSessionState } from '@/app/types'
import type * as HermesModule from '@/hermes'
+import { createClientSessionState } from '@/lib/chat-runtime'
import { setSessionOwnerHint, setSessions } from '@/store/session'
import { $sessionTiles, sessionTileDelegate } from '@/store/session-states'
import type { SessionInfo } from '@/types/hermes'
@@ -441,9 +444,29 @@ describe('useSessionTileDelegate resumeTile', () => {
expect(next.model).toBe('gpt-5')
expect(next.provider).toBe('openai')
expect(next.reasoningEffort).toBe('high')
+ expect(next.reasoningEffortPending).toBe(false)
expect(next.fast).toBe(true)
})
+ it("keeps the tile's effort pending when the deferred-build resume has not reported it (#79807)", async () => {
+ setSessions([row({ id: 'stored-lazy', profile: 'default' })])
+
+ const updateSessionState = vi.fn()
+
+ vi.mocked(requestGatewayForProfile).mockResolvedValueOnce({
+ info: { lazy: true, model: 'gpt-5', running: false },
+ session_id: 'runtime-lazy'
+ } as never)
+
+ renderTile(vi.fn(), { updateSessionState })
+ await sessionTileDelegate()!.resumeTile('stored-lazy')
+
+ const updater = updateSessionState.mock.calls[0][1] as (state: ClientSessionState) => ClientSessionState
+ const next = updater(createClientSessionState('stored-lazy'))
+
+ expect(reasoningEffortPending(next)).toBe(true)
+ })
+
it('invalidateRuntimeBindings clears the stored→runtime map so tiles re-resume after reconnect', async () => {
setSessions([row({ id: 'stored-c', profile: 'default' })])
diff --git a/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.ts b/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.ts
index 7aa16eb1ede..6177c2f4644 100644
--- a/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.ts
+++ b/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.ts
@@ -8,6 +8,7 @@ import {
} from '@/hermes'
import { translateNow } from '@/i18n/runtime'
import { type ChatMessage, chatMessageText, toChatMessages } from '@/lib/chat-messages'
+import { markReasoningEffortPending } from '@/lib/chat-runtime'
import { notify } from '@/store/notifications'
import {
isReadOnlyRuntimeId,
@@ -401,13 +402,16 @@ export function useSessionTileDelegate({
updateSessionState(
runtimeId,
state => ({
- ...state,
+ // The deferred build reports the session's own effort later (#79807).
+ ...markReasoningEffortPending(state),
busy: Boolean(info?.running),
// Persist the session's own model/provider from resume so the tile
// pill does not wait on a chrome-scoped catalog read (#93892).
...(typeof info?.model === 'string' ? { model: info.model } : {}),
...(typeof info?.provider === 'string' ? { provider: info.provider } : {}),
- ...(typeof info?.reasoning_effort === 'string' ? { reasoningEffort: info.reasoning_effort } : {}),
+ ...(typeof info?.reasoning_effort === 'string'
+ ? { reasoningEffort: info.reasoning_effort, reasoningEffortPending: false }
+ : {}),
...(typeof info?.reasoning_effort_wire === 'string'
? { reasoningEffortWire: info.reasoning_effort_wire }
: {}),
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/utils.ts b/apps/desktop/src/app/session/hooks/use-message-stream/utils.ts
index 7ff3859915b..2cb7db5cfa7 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/utils.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/utils.ts
@@ -14,6 +14,7 @@ type SessionRuntimeStatePatch = Partial<
| 'personality'
| 'provider'
| 'reasoningEffort'
+ | 'reasoningEffortPending'
| 'reasoningEffortWire'
| 'serviceTier'
| 'yolo'
@@ -45,6 +46,7 @@ export function sessionInfoStatePatch(payload: GatewayEventPayload | undefined):
if (typeof payload?.reasoning_effort === 'string') {
patch.reasoningEffort = payload.reasoning_effort
+ patch.reasoningEffortPending = false
}
if (typeof payload?.reasoning_effort_wire === 'string') {
@@ -85,6 +87,8 @@ export function applySessionInfoStatePatch(
(patch.personality === undefined || patch.personality === state.personality) &&
(patch.provider === undefined || patch.provider === state.provider) &&
(patch.reasoningEffort === undefined || patch.reasoningEffort === state.reasoningEffort) &&
+ (patch.reasoningEffortPending === undefined ||
+ patch.reasoningEffortPending === Boolean(state.reasoningEffortPending)) &&
(patch.serviceTier === undefined || patch.serviceTier === state.serviceTier) &&
(patch.yolo === undefined || patch.yolo === state.yolo)
) {
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx b/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx
index 7d4cb2a3c87..56bfdeb3565 100644
--- a/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx
+++ b/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx
@@ -5,6 +5,7 @@ import type { MutableRefObject } from 'react'
import { useEffect, useRef } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { PRIMARY_SESSION_VIEW } from '@/app/chat/session-view'
import { NO_PROJECT_ID } from '@/app/chat/sidebar/projects/workspace-groups'
import { resolveSessionRpcOwner } from '@/app/contrib/wiring-routing'
import { $terminalTakeover, setTerminalTakeover } from '@/app/right-sidebar/store'
@@ -80,7 +81,9 @@ import { $removedSessionIds, $sessionMutationsInFlight } from '@/store/session-r
import { requestForSessionProfile, type SessionProfileRoute } from '@/store/session-request-router'
import {
$sessionTiles,
+ dropSessionState,
knownOwnerForSession,
+ publishSessionState,
requestForOwnedSession,
sessionTileOwnerRoute
} from '@/store/session-states'
@@ -92,6 +95,7 @@ import { deferred } from '../../../test/deferred'
import { NEW_CHAT_ROUTE, sessionRoute } from '../../routes'
import type { ClientSessionState } from '../../types'
+import { applySessionInfoStatePatch, sessionInfoStatePatch } from './use-message-stream/utils'
import { useSessionActions } from './use-session-actions'
import { suppressTranscriptForView, transcriptRowContentKey } from './use-session-actions/transcript-provenance'
import type { TranscriptViewCutoff } from './use-session-actions/transcript-provenance'
@@ -1637,6 +1641,69 @@ describe('resumeSession failure recovery', () => {
expect($resumeFailedSessionId.get()).toBeNull()
})
+ it("leaves the resumed session's effort pending until the built agent reports it (#79807)", async () => {
+ const sessionStateByRuntimeIdRef = { current: new Map<string, ClientSessionState>() }
+
+ // A deferred-build resume answers with the lazy shape: no reasoning_effort.
+ const requestGateway = vi.fn(async (method: string, params?: Record<string, unknown>) => {
+ if (method === 'session.resume') {
+ return {
+ info: { lazy: true, model: 'qwen3.8-max' },
+ messages: [],
+ resumed: params?.session_id,
+ session_id: 'runtime-1'
+ } as never
+ }
+
+ return {} as never
+ })
+
+ vi.mocked(getLatestSessionMessages).mockResolvedValue({ messages: [] } as never)
+
+ await runResume(requestGateway, { sessionStateByRuntimeIdRef })
+
+ const resumed = sessionStateByRuntimeIdRef.current.get('runtime-1')!
+ publishSessionState('runtime-1', resumed)
+
+ expect($activeSessionId.get()).toBe('runtime-1')
+ expect(PRIMARY_SESSION_VIEW.$reasoningEffortPending.get()).toBe(true)
+
+ publishSessionState(
+ 'runtime-1',
+ applySessionInfoStatePatch(resumed, sessionInfoStatePatch({ reasoning_effort: 'max' }))
+ )
+
+ expect(PRIMARY_SESSION_VIEW.$reasoningEffortPending.get()).toBe(false)
+ expect(PRIMARY_SESSION_VIEW.$reasoningEffort.get()).toBe('max')
+ dropSessionState('runtime-1')
+ })
+
+ it('does not mark a resumed effort pending when the resume reply already carries it', async () => {
+ const sessionStateByRuntimeIdRef = { current: new Map<string, ClientSessionState>() }
+
+ const requestGateway = vi.fn(async (method: string, params?: Record<string, unknown>) => {
+ if (method === 'session.resume') {
+ return {
+ info: { model: 'qwen3.8-max', reasoning_effort: '' },
+ messages: [],
+ resumed: params?.session_id,
+ session_id: 'runtime-1'
+ } as never
+ }
+
+ return {} as never
+ })
+
+ vi.mocked(getLatestSessionMessages).mockResolvedValue({ messages: [] } as never)
+
+ await runResume(requestGateway, { sessionStateByRuntimeIdRef })
+
+ publishSessionState('runtime-1', sessionStateByRuntimeIdRef.current.get('runtime-1')!)
+
+ expect(PRIMARY_SESSION_VIEW.$reasoningEffortPending.get()).toBe(false)
+ dropSessionState('runtime-1')
+ })
+
it('resumes via the gateway default (deferred build) — not lazy, no eager opt-out', async () => {
// The switch-latency fix lives backend-side: a normal cold resume gets the
// gateway's default DEFERRED build (transcript returns immediately, agent
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
index e67942d39d6..18e1ba8e1ca 100644
--- a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
@@ -23,6 +23,7 @@ import {
stripPendingClarifyProjectionForCache,
toChatMessages
} from '@/lib/chat-messages'
+import { markReasoningEffortPending } from '@/lib/chat-runtime'
import { isMissingRpcMethod } from '@/lib/gateway-rpc'
import { recoverInFlightTurnJournal } from '@/lib/inflight-turn-journal'
import { setSessionYolo } from '@/lib/yolo-session'
@@ -2054,8 +2055,8 @@ export function useSessionActions({
updateSessionState(
resumed.session_id,
state => ({
- ...state,
- ...(runtimeInfo ?? {}),
+ // The deferred build reports the session's own effort later (#79807).
+ ...markReasoningEffortPending({ ...state, ...(runtimeInfo ?? {}) }),
messages: visibleMessagesForView,
transcriptProvenance,
busy: resumedRunning,
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts b/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts
index 4014f3c05a9..5df11ab5d8d 100644
--- a/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts
@@ -1972,6 +1972,7 @@ type SessionRuntimeStatePatch = Partial<
| 'personality'
| 'provider'
| 'reasoningEffort'
+ | 'reasoningEffortPending'
| 'reasoningEffortWire'
| 'serviceTier'
| 'yolo'
@@ -2096,6 +2097,7 @@ export function applyRuntimeInfo(
if (typeof info.reasoning_effort === 'string') {
sessionState.reasoningEffort = info.reasoning_effort
+ sessionState.reasoningEffortPending = false
}
if (typeof info.reasoning_effort_wire === 'string') {
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
index aa8faa9378f..4f38e8d8171 100644
--- a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
+++ b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
@@ -12,6 +12,7 @@ import {
setModelVisibilityOpen,
setVisibleModels
} from '@/store/model-visibility'
+import { $defaultReasoningEffort } from '@/store/session'
import type { LocalRuntimeJob } from '@/types/hermes'
import { ModelCatalogMenu, type ModelMenuController } from './model-catalog-menu'
@@ -55,17 +56,36 @@ afterEach(() => {
// The backend mock echoes this snapshot; retire fixture jobs before jsdom
// disappears so an in-flight app-level poll cannot schedule another tick.
$localRuntimeJobs.set([])
+ $defaultReasoningEffort.set('')
vi.clearAllMocks()
})
+describe('the current row effort', () => {
+ it('does not label the current model with the profile default before its session reports one (#79807)', async () => {
+ $defaultReasoningEffort.set('ultra')
+ renderMenu({ effortPending: true, model: 'gemini-2.5-flash', provider: 'google' })
+
+ const row = (await screen.findByText(/Gemini 2\.5 Flash/i)).closest('[role="menuitem"]')!
+
+ expect(row.textContent).not.toContain('Ultra')
+ cleanup()
+
+ renderMenu({ model: 'gemini-2.5-flash', provider: 'google' })
+
+ const settled = (await screen.findByText(/Gemini 2\.5 Flash/i)).closest('[role="menuitem"]')!
+
+ expect(settled.textContent).toContain('Ultra')
+ })
+})
+
// A minimal controller — these tests are about the CATALOG's own behaviour
// (what it lists, what it offers), not about what any host does with a pick.
-function renderMenu() {
+function renderMenu(current: Partial<ModelMenuController['current']> = {}) {
const select = vi.fn()
const controller: ModelMenuController = {
applyPreset: vi.fn(),
- current: { effort: '', fast: false, model: '', provider: '' },
+ current: { effort: '', fast: false, model: '', provider: '', ...current },
presetFor: () => ({}),
select,
setOptions: vi.fn()
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.tsx b/apps/desktop/src/app/shell/model-catalog-menu.tsx
index 1caf3d9bbab..decf839ca08 100644
--- a/apps/desktop/src/app/shell/model-catalog-menu.tsx
+++ b/apps/desktop/src/app/shell/model-catalog-menu.tsx
@@ -59,6 +59,8 @@ export const ModelMenuCloseContext = createContext<() => void>(() => {})
* `effort` is '' for "inherit the default" and 'none' for thinking off. */
export interface ModelChoice {
effort: string
+ /** `effort` is not reported yet, so '' is unknown rather than the default (#79807). */
+ effortPending?: boolean
/** Level the route actually sends for `effort` (`session.info.reasoning_effort_wire`); '' = unknown. */
effortWire?: string
fast: boolean
@@ -589,7 +591,7 @@ export function ModelCatalogMenu({
const meta = [
tag || null,
fastControl.kind !== 'none' && fastControl.on ? copy.fast : null,
- (caps?.reasoning ?? true)
+ (caps?.reasoning ?? true) && !(isCurrent && current.effortPending)
? reasoningEffortLabel(effEffort || defaultEffort, isCurrent ? current.effortWire : undefined)
: null
]
diff --git a/apps/desktop/src/app/shell/use-model-menu-controller.ts b/apps/desktop/src/app/shell/use-model-menu-controller.ts
index ced8d91f0c8..916b45bbb13 100644
--- a/apps/desktop/src/app/shell/use-model-menu-controller.ts
+++ b/apps/desktop/src/app/shell/use-model-menu-controller.ts
@@ -59,6 +59,7 @@ export function useModelMenuController({
const currentProvider = useStore(view.$provider)
const currentReasoningEffort = useStore(view.$reasoningEffort)
const currentReasoningEffortWire = useStore(view.$reasoningEffortWire)
+ const currentReasoningEffortPending = useStore(view.$reasoningEffortPending)
const modelPresets = useStore($modelPresets)
const defaultEffort = useStore($defaultReasoningEffort) || DEFAULT_REASONING_EFFORT
const touchesPrimary = view.kind === 'primary'
@@ -89,6 +90,7 @@ export function useModelMenuController({
sessionTileDelegate()?.updateSession(activeSessionId, state => ({
...state,
reasoningEffort: next,
+ reasoningEffortPending: false,
reasoningEffortWire: ''
}))
}
@@ -164,6 +166,7 @@ export function useModelMenuController({
current: {
effort: currentReasoningEffort,
+ effortPending: currentReasoningEffortPending,
effortWire: currentReasoningEffortWire,
fast: currentFastMode,
model: optionsModel,
diff --git a/apps/desktop/src/app/types.ts b/apps/desktop/src/app/types.ts
index 02294c81ea5..e4781ad0ace 100644
--- a/apps/desktop/src/app/types.ts
+++ b/apps/desktop/src/app/types.ts
@@ -159,6 +159,10 @@ export interface ClientSessionState {
/** Gateway-reported wire level for `reasoningEffort`; '' until the backend
* has stamped the current pick (so a clamp is never inferred client-side). */
reasoningEffortWire?: string
+ /** The runtime has not reported this session's effort yet, so '' above means
+ * "unknown", not "profile default". A cold resume answers before the agent
+ * builds, and only the built agent knows the session's own pin (#79807). */
+ reasoningEffortPending?: boolean
serviceTier: string
fast: boolean
yolo: boolean
diff --git a/apps/desktop/src/components/assistant-ui/catalog-install-tool.test.tsx b/apps/desktop/src/components/assistant-ui/catalog-install-tool.test.tsx
index 1c4563f1967..c77ed2a8011 100644
--- a/apps/desktop/src/components/assistant-ui/catalog-install-tool.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/catalog-install-tool.test.tsx
@@ -89,6 +89,7 @@ function view(sessionId: string): SessionView {
$model: atom(''),
$provider: atom(''),
$reasoningEffort: atom(''),
+ $reasoningEffortPending: atom(false),
$reasoningEffortWire: atom(''),
$runtimeId: atom(sessionId),
$storedId: atom(sessionId),
diff --git a/apps/desktop/src/components/assistant-ui/connector-tool.test.tsx b/apps/desktop/src/components/assistant-ui/connector-tool.test.tsx
index e893e60c3a3..086e50dcf42 100644
--- a/apps/desktop/src/components/assistant-ui/connector-tool.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/connector-tool.test.tsx
@@ -76,6 +76,7 @@ function view(sessionId: string): SessionView {
$model: atom(''),
$provider: atom(''),
$reasoningEffort: atom(''),
+ $reasoningEffortPending: atom(false),
$reasoningEffortWire: atom(''),
$runtimeId: atom(sessionId),
$storedId: atom(sessionId),
diff --git a/apps/desktop/src/components/assistant-ui/mcp-setup-tool.test.tsx b/apps/desktop/src/components/assistant-ui/mcp-setup-tool.test.tsx
index 67e61c295e5..e6d486cc104 100644
--- a/apps/desktop/src/components/assistant-ui/mcp-setup-tool.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/mcp-setup-tool.test.tsx
@@ -78,6 +78,7 @@ function view(sessionId: string): SessionView {
$model: atom(''),
$provider: atom(''),
$reasoningEffort: atom(''),
+ $reasoningEffortPending: atom(false),
$reasoningEffortWire: atom(''),
$runtimeId: atom(sessionId),
$storedId: atom(sessionId),
diff --git a/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx b/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx
index 9f03825c827..a6997fd3490 100644
--- a/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx
@@ -84,6 +84,7 @@ function view(sessionId: string, storedId: string): SessionView {
$model: atom(''),
$provider: atom(''),
$reasoningEffort: atom(''),
+ $reasoningEffortPending: atom(false),
$reasoningEffortWire: atom(''),
$runtimeId: atom(sessionId),
$storedId: atom(storedId),
diff --git a/apps/desktop/src/lib/chat-runtime.ts b/apps/desktop/src/lib/chat-runtime.ts
index d5492db55dd..d8b0c3140e3 100644
--- a/apps/desktop/src/lib/chat-runtime.ts
+++ b/apps/desktop/src/lib/chat-runtime.ts
@@ -49,6 +49,17 @@ export function createClientSessionState(
}
}
+/**
+ * Mark a freshly resumed slice's effort as not-yet-known. The deferred-build
+ * resume reply has no `reasoning_effort`, and falling through to the profile
+ * default would paint a level the built agent's `session.info` then replaces
+ * (#79807). A slice whose effort was already reported (a fast build can beat
+ * the resume reply) keeps it.
+ */
+export function markReasoningEffortPending(state: ClientSessionState): ClientSessionState {
+ return state.reasoningEffortPending === false ? state : { ...state, reasoningEffortPending: true }
+}
+
export function sessionTitle(session: SessionInfo): string {
return session.title?.trim() || session.preview?.trim() || 'Untitled session'
}