fix(gateway): a quoted local show_reasoning "false" stays off

The local overlay copied display.platforms.cli.show_reasoning unchanged, so a
quoted "false" reached Python/Ink truthiness checks as a non-empty string and
showed reasoning, while Desktop hid it. Normalise the winning value with the
setting's existing normaliser; precedence and no-value defaults are unchanged.
This commit is contained in:
Teknium committed 2026-10-18 20:34:02 -07:00
1 parent e1f987caf9
commit 2fcc601530
2 files changed
+18 -1

No files matched your search

+1 -1
View File
@@ -226,5 +226,5 @@ def local_display_config(display: Any) -> dict[str, Any]:
continue
if isinstance(value, dict) and isinstance(display.get(key), dict):
value = {**display[key], **value}
display[key] = value
display[key] = _normalise(key, value)
return display
+17
View File
@@ -93,6 +93,23 @@ def test_launch_default_reads_the_local_key():
assert launch_shows_reasoning(_Policy({'show_reasoning': False}), None) is False
def test_quoted_local_false_stays_off():
"""A quoted ``"false"`` under the local key is off on every surface, not a truthy string."""
from gateway.display_config import local_display_config
from gateway.local_viewer_events import launch_shows_reasoning
display = {'show_reasoning': False, 'platforms': {'cli': {'show_reasoning': 'false'}}}
class _Policy:
source = 'tui'
def config(self, _authority, secrets=False):
return {'display': display}
assert local_display_config(display)['show_reasoning'] is False
assert launch_shows_reasoning(_Policy(), None) is False
def test_classic_cli_display_reads_the_local_key():
from gateway.display_config import local_display_config