Skip to content

The agent that grows with you

fix(desktop): Settings Reasoning Blocks reads a quoted value as the gateway does

Tekniumc79dae9fb728
diff --git a/apps/desktop/src/app/settings/helpers.test.ts b/apps/desktop/src/app/settings/helpers.test.ts
index 19745762fd7..61b2ef14fe5 100644
--- a/apps/desktop/src/app/settings/helpers.test.ts
+++ b/apps/desktop/src/app/settings/helpers.test.ts
@@ -123,6 +123,21 @@ describe('settings helpers', () => {
expect(setConfigField({}, 'display.skin', 'ares')).toEqual({ display: { skin: 'ares' } })
})
+ it('Reasoning Blocks reads a quoted local value as the gateway does', () => {
+ const shown = (value: unknown) =>
+ configFieldValue({ display: { show_reasoning: true, platforms: { cli: { show_reasoning: value } } } } as HermesConfigRecord, 'display.show_reasoning')
+
+ for (const off of ['false', 'False', '0', 'no', 'off', ' false ']) {
+ expect(shown(off)).toBe(false)
+ }
+
+ for (const on of ['true', '1', 'yes', 'on']) {
+ expect(shown(on)).toBe(true)
+ }
+
+ expect(configFieldValue({ display: { show_reasoning: 'false' } }, 'display.show_reasoning')).toBe(false)
+ })
+
it('rejects prototype-polluting config paths', () => {
const config: HermesConfigRecord = {}
diff --git a/apps/desktop/src/app/settings/helpers.ts b/apps/desktop/src/app/settings/helpers.ts
index 616aafe41fd..0ec7706f0f1 100644
--- a/apps/desktop/src/app/settings/helpers.ts
+++ b/apps/desktop/src/app/settings/helpers.ts
@@ -263,13 +263,19 @@ export function setNested(obj: HermesConfigRecord, path: string, value: unknown)
// shows the local value, and a change writes both.
const LOCAL_SHOW_REASONING = 'display.platforms.cli.show_reasoning'
-/** The value a Settings field shows. */
+/** The value a Settings field shows. A quoted Reasoning Blocks value reads as the gateway's `_norm_bool`. */
export function configFieldValue(config: HermesConfigRecord, key: string): unknown {
- return key === 'display.show_reasoning'
- ? localShowReasoning((config as HermesConfig).display)
- : getNested(config, key)
+ if (key !== 'display.show_reasoning') {
+ return getNested(config, key)
+ }
+
+ const value = localShowReasoning((config as HermesConfig).display)
+
+ return typeof value === 'string' ? GATEWAY_TRUTHY.has(value.trim().toLowerCase()) : value
}
+const GATEWAY_TRUTHY = new Set(['true', '1', 'yes', 'on', 'raw', 'verbose'])
+
/** The config after a Settings field edit. */
export function setConfigField(config: HermesConfigRecord, key: string, value: unknown): HermesConfigRecord {
const next = setNested(config, key, value)