Skip to content

The agent that grows with you

fix(desktop): publish the profile default reasoning effort to a store

Brooklyn Nicholson58f5a05655c5
diff --git a/apps/desktop/src/app/session/hooks/use-hermes-config.test.ts b/apps/desktop/src/app/session/hooks/use-hermes-config.test.ts
index 23e0f5a74c8..a5ec2060bf5 100644
--- a/apps/desktop/src/app/session/hooks/use-hermes-config.test.ts
+++ b/apps/desktop/src/app/session/hooks/use-hermes-config.test.ts
@@ -8,11 +8,13 @@ import {
$currentCwd,
$currentFastMode,
$currentReasoningEffort,
+ $defaultReasoningEffort,
markComposerSelectionManual,
setCurrentCwd,
setCurrentFastMode,
setCurrentModelSource,
- setCurrentReasoningEffort
+ setCurrentReasoningEffort,
+ setDefaultReasoningEffort
} from '@/store/session'
import { useHermesConfig } from './use-hermes-config'
@@ -44,9 +46,31 @@ describe('useHermesConfig refreshHermesConfig', () => {
setCurrentFastMode(false)
setCurrentModelSource('')
setCurrentReasoningEffort('')
+ setDefaultReasoningEffort('')
persistString(WORKSPACE_CWD_KEY, null)
})
+ // Regression: the composer keeps a manual model pick sticky, which skips the
+ // composer reseed. The profile default must still be published, because the
+ // model picker resolves "the default effort" from it when applying a model's
+ // preset — otherwise selecting a model silently downgrades a configured
+ // `agent.reasoning_effort: high` to Hermes' built-in medium.
+ it('publishes the profile default effort even when a manual pick blocks the composer reseed', async () => {
+ setCurrentModelSource('manual')
+ setCurrentReasoningEffort('low')
+
+ mockConfig({ agent: { reasoning_effort: 'high' } })
+ const { result } = renderHook(() => useHermesConfig({ activeSessionIdRef: { current: null } }))
+
+ await act(async () => {
+ await result.current.refreshHermesConfig()
+ })
+
+ expect($defaultReasoningEffort.get()).toBe('high')
+ // The manual pick itself is still respected.
+ expect($currentReasoningEffort.get()).toBe('low')
+ })
+
it('does not let terminal.cwd replace an inactive selected workspace', async () => {
setCurrentCwd('/Users/example/repo/.worktrees/feature')
diff --git a/apps/desktop/src/app/session/hooks/use-hermes-config.ts b/apps/desktop/src/app/session/hooks/use-hermes-config.ts
index 5d78fb1c6c5..06f5a139367 100644
--- a/apps/desktop/src/app/session/hooks/use-hermes-config.ts
+++ b/apps/desktop/src/app/session/hooks/use-hermes-config.ts
@@ -11,6 +11,7 @@ import {
setCurrentPersonality,
setCurrentReasoningEffort,
setCurrentServiceTier,
+ setDefaultReasoningEffort,
setIntroPersonality
} from '@/store/session'
import { applyAutoSpeakFromConfig } from '@/store/voice-prefs'
@@ -83,6 +84,12 @@ export function useHermesConfig({ activeSessionIdRef }: HermesConfigOptions) {
const reasoning = normalizeConfigEffort(config.agent?.reasoning_effort)
const tier = (config.agent?.service_tier ?? '').trim()
+ // Publish the profile default regardless of whether the composer is
+ // reseeded below: picker rows and preset application resolve "the
+ // default" from here, so a manual model pick must not leave them
+ // rendering/applying Hermes' built-in medium over the user's config.
+ setDefaultReasoningEffort(reasoning)
+
const shouldSeedComposer =
!activeSessionIdRef.current &&
getComposerSelectionGeneration() === selectionGeneration &&
diff --git a/apps/desktop/src/store/session.ts b/apps/desktop/src/store/session.ts
index 0044a7b34a6..f5a1a3aad4a 100644
--- a/apps/desktop/src/store/session.ts
+++ b/apps/desktop/src/store/session.ts
@@ -454,6 +454,18 @@ export const setCurrentReasoningEffort = (next: Updater<string>) => {
persistString(COMPOSER_EFFORT_KEY, $currentReasoningEffort.get() || null)
}
+// Hermes' built-in effort when neither the surface nor the profile config
+// specifies one (see VALID_REASONING_EFFORTS / parse_reasoning_effort).
+export const DEFAULT_REASONING_EFFORT = 'medium'
+
+// The profile's `agent.reasoning_effort`, mirrored from config so surfaces that
+// need to render or apply "the default" resolve the user's configured level
+// instead of assuming DEFAULT_REASONING_EFFORT. Empty until config loads, and
+// re-seeded on every profile switch by useHermesConfig.
+export const $defaultReasoningEffort = atom('')
+
+export const setDefaultReasoningEffort = (next: string) => updateAtom($defaultReasoningEffort, next)
+
export const setCurrentServiceTier = (next: Updater<string>) => updateAtom($currentServiceTier, next)
export const setCurrentFastMode = (next: Updater<boolean>) => {