Skip to content

The agent that grows with you

fix(desktop): honor display.show_reasoning in the message renderer

r266-techf12c3a163105
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 3cd5b72f85b..5a3040cf49a 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
@@ -5,6 +5,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import { $terminalFontFamily, setTerminalFontFamilyFromConfig } from '@/app/right-sidebar/terminal/terminal-font'
import { getHermesConfig } from '@/hermes'
import { persistString } from '@/lib/storage'
+import { $showReasoning, setShowReasoningFromConfig } from '@/store/reasoning-disclosure'
import {
$currentCwd,
$currentFastMode,
@@ -35,6 +36,7 @@ const mockConfig = (config: Record<string, unknown>) =>
describe('useHermesConfig refreshHermesConfig', () => {
beforeEach(() => {
// Reset atoms and localStorage between tests
+ setShowReasoningFromConfig(undefined)
setCurrentCwd('')
setCurrentFastMode(false)
setCurrentModelSource('')
@@ -44,6 +46,21 @@ describe('useHermesConfig refreshHermesConfig', () => {
persistString(WORKSPACE_CWD_KEY, null)
})
+ it.each([
+ [true, true], [false, false], ['false', false], ['off', false], ['0', false],
+ [' True ', true], ['yes', true], [1, true], [0, false], [undefined, true]
+ ])('resolves reasoning display %j to %j and resets missing config to the default', async (value, expected) => {
+ mockConfig({ display: { show_reasoning: value } })
+ const { result } = renderHook(() => useHermesConfig({ activeSessionIdRef: { current: null } }))
+
+ await act(async () => { await result.current.refreshHermesConfig() })
+ expect($showReasoning.get()).toBe(expected)
+
+ mockConfig({})
+ await act(async () => { await result.current.refreshHermesConfig() })
+ expect($showReasoning.get()).toBe(true)
+ })
+
// 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
@@ -133,6 +150,7 @@ describe('useHermesConfig refreshHermesConfig', () => {
ownsSwitch = false
staleConfig.resolve({
+ display: { show_reasoning: false },
agent: { reasoning_effort: 'high', service_tier: 'priority' },
terminal: { font_family: 'MesloLGS NF' }
} as Awaited<ReturnType<typeof getHermesConfig>>)
@@ -145,6 +163,7 @@ describe('useHermesConfig refreshHermesConfig', () => {
expect($currentReasoningEffort.get()).toBe('')
expect($currentFastMode.get()).toBe(false)
expect($terminalFontFamily.get()).toBe('')
+ expect($showReasoning.get()).toBe(true)
})
it('does not let an older profile config overwrite a newer profile', async () => {
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 a4ce3785b0e..0b9b3ef9589 100644
--- a/apps/desktop/src/app/session/hooks/use-hermes-config.ts
+++ b/apps/desktop/src/app/session/hooks/use-hermes-config.ts
@@ -5,6 +5,7 @@ import { getHermesConfig, getHermesConfigDefaults } from '@/hermes'
import { BUILTIN_PERSONALITIES, normalizePersonalityValue, personalityNamesFromConfig } from '@/lib/chat-runtime'
import { normalize } from '@/lib/text'
import { setDisplayTimestampsFromConfig } from '@/store/display-timestamps'
+import { setShowReasoningFromConfig } from '@/store/reasoning-disclosure'
import {
getComposerSelectionGeneration,
getCurrentModelSource,
@@ -140,6 +141,7 @@ export function useHermesConfig({ activeSessionIdRef }: HermesConfigOptions) {
}
setDisplayTimestampsFromConfig(config.display?.timestamps)
+ setShowReasoningFromConfig(config.display?.show_reasoning)
setTerminalFontFamilyFromConfig(config.terminal?.font_family)
setChatFontFamilyFromConfig(config.desktop?.font_family)
diff --git a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx
index 6e336ced3a2..c4caee06835 100644
--- a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx
@@ -29,7 +29,7 @@ import { separateGluedReasoningBlocks } from '@/lib/reasoning-blocks'
import { isTodoToolName } from '@/lib/todos'
import { useEnterAnimation } from '@/lib/use-enter-animation'
import { cn } from '@/lib/utils'
-import { $reasoningCollapsedByDefault } from '@/store/reasoning-disclosure'
+import { $reasoningCollapsedByDefault, $showReasoning } from '@/store/reasoning-disclosure'
type TimelineToolCallProps = ToolCallMessagePartProps & { completedAt?: number; timestamp?: number }
@@ -308,6 +308,7 @@ const ReasoningAccordionGroup: FC<{ children?: ReactNode; endIndex: number; star
endIndex,
startIndex
}) => {
+ const showReasoning = useStore($showReasoning)
const messageId = useAuiState(s => s.message.id)
const messageRunning = useAuiState(s => s.message.status?.type === 'running')
// The guide's reasoning is it reading its own runbook ("Now step 4: offer
@@ -352,7 +353,7 @@ const ReasoningAccordionGroup: FC<{ children?: ReactNode; endIndex: number; star
}, undefined)
)
- if (!hasContent || guidedChat) {
+ if (!hasContent || guidedChat || !showReasoning) {
return null
}
@@ -380,6 +381,12 @@ const ReasoningTextPart: ReasoningMessagePartComponent = () => {
const { status, text } = useMessagePartReasoning()
const messageRunning = useAuiState(s => s.message.status?.type === 'running')
+ const showReasoning = useStore($showReasoning)
+
+ if (!showReasoning) {
+ return null
+ }
+
return (
<MarkdownTextContent
containerClassName="text-xs leading-snug text-muted-foreground/85"
diff --git a/apps/desktop/src/components/assistant-ui/thread/streaming.test.tsx b/apps/desktop/src/components/assistant-ui/thread/streaming.test.tsx
index cf6a746e3cb..dc64fb764d9 100644
--- a/apps/desktop/src/components/assistant-ui/thread/streaming.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/streaming.test.tsx
@@ -1,12 +1,14 @@
-import { AssistantRuntimeProvider, type ThreadMessage, useExternalStoreRuntime } from '@assistant-ui/react'
+import { AssistantRuntimeProvider, MessagePrimitive, type ThreadMessage, ThreadPrimitive, useExternalStoreRuntime } from '@assistant-ui/react'
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
import { useEffect, useState } from 'react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { $reasoningCollapsedByDefault } from '@/store/reasoning-disclosure'
+import { $reasoningCollapsedByDefault, setShowReasoningFromConfig } from '@/store/reasoning-disclosure'
import { stubThreadEnvironment, stubThreadViewportSize, ThreadRuntime } from '../test-utils'
+import { MESSAGE_PARTS_COMPONENTS } from './message-parts'
+
import { Thread } from '.'
const createdAt = new Date('2026-05-01T00:00:00.000Z')
@@ -477,6 +479,30 @@ describe('assistant-ui streaming renderer', () => {
beforeEach(() => {
resizeObservers.clear()
$reasoningCollapsedByDefault.set(false)
+ setShowReasoningFromConfig(undefined)
+ })
+
+ it.each([true, false])('honors reasoning visibility %j for grouped and standalone parts', async enabled => {
+ setShowReasoningFromConfig(enabled)
+
+ const UngroupedMessage = () => <MessagePrimitive.Root>
+ <MessagePrimitive.Parts components={{ Reasoning: MESSAGE_PARTS_COMPONENTS.Reasoning }} />
+ </MessagePrimitive.Root>
+
+ const { container } = render(<>
+ <RunningReasoningHarness />
+ <ThreadRuntime messages={[assistantReasoningMessage('standalone reasoning', true)]}>
+ <ThreadPrimitive.Root>
+ <ThreadPrimitive.Messages components={{ AssistantMessage: UngroupedMessage, UserMessage: () => null }} />
+ </ThreadPrimitive.Root>
+ </ThreadRuntime>
+ </>)
+
+ await waitFor(() => {
+ expect(container.querySelectorAll('[data-slot="aui_reasoning-text"]')).toHaveLength(enabled ? 2 : 0)
+ })
+ expect(within(container).queryByRole('button', { name: /thinking/i }) !== null).toBe(enabled)
+ expect(container.textContent?.includes('standalone reasoning')).toBe(enabled)
})
it('renders assistant text incrementally before completion', async () => {
diff --git a/apps/desktop/src/store/reasoning-disclosure.ts b/apps/desktop/src/store/reasoning-disclosure.ts
index 584c00a57ae..fa59aa0d625 100644
--- a/apps/desktop/src/store/reasoning-disclosure.ts
+++ b/apps/desktop/src/store/reasoning-disclosure.ts
@@ -12,3 +12,16 @@ $reasoningCollapsedByDefault.subscribe(value => persistBoolean(REASONING_COLLAPS
export function setReasoningCollapsedByDefault(value: boolean) {
$reasoningCollapsedByDefault.set(value)
}
+
+// Mirrors backend display.show_reasoning; omission follows DEFAULT_CONFIG.
+export const $showReasoning = atom(true)
+
+export function setShowReasoningFromConfig(value: unknown): void {
+ const enabled = value === undefined
+ ? true
+ : typeof value === 'string'
+ ? ['1', 'true', 'yes', 'on'].includes(value.trim().toLowerCase())
+ : Boolean(value)
+
+ $showReasoning.set(enabled)
+}
diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.ts
index b79cf331c3f..5b48336217d 100644
--- a/apps/desktop/src/types/hermes.ts
+++ b/apps/desktop/src/types/hermes.ts
@@ -422,6 +422,7 @@ export interface HermesConfig {
service_tier?: string
}
display?: {
+ show_reasoning?: boolean | null | number | string
personality?: string
skin?: string
interim_assistant_messages?: boolean