From 24e20e6ae8a9389fa47f9fc38d304749a116fce4 Mon Sep 17 00:00:00 2001 From: Leon Date: Sat, 18 Apr 2026 00:08:06 +0800 Subject: [PATCH] fix: _load_show_reasoning should resolve per-platform config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delegates to resolve_display_setting() so the resolution order (platform override → global → default) stays in one place. The /reasoning on command saves to display.platforms..show_reasoning but _load_show_reasoning() only read the global display.show_reasoning. After a gateway restart, the in-memory _show_reasoning was always False even though per-platform config had it set to True. --- gateway/run.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index ca07254268..d4230fd678 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -1236,15 +1236,23 @@ class GatewayRunner: return None @staticmethod - def _load_show_reasoning() -> bool: - """Load show_reasoning toggle from config.yaml display section.""" + def _load_show_reasoning(platform_key: str = "") -> bool: + """Load show_reasoning toggle — resolves per-platform then global. + + Delegates to resolve_display_setting() so the resolution order + (platform override → global → default) stays in one place. + """ try: + from gateway.display_config import resolve_display_setting import yaml as _y cfg_path = _hermes_home / "config.yaml" + user_cfg = {} if cfg_path.exists(): with open(cfg_path, encoding="utf-8") as _f: - cfg = _y.safe_load(_f) or {} - return bool(cfg.get("display", {}).get("show_reasoning", False)) + user_cfg = _y.safe_load(_f) or {} + return bool(resolve_display_setting( + user_cfg, platform_key, "show_reasoning", False + )) except Exception: pass return False @@ -6075,7 +6083,8 @@ class GatewayRunner: args = event.get_command_args().strip().lower() config_path = _hermes_home / "config.yaml" self._reasoning_config = self._load_reasoning_config() - self._show_reasoning = self._load_show_reasoning() + _pk = _platform_config_key(event.source.platform) + self._show_reasoning = self._load_show_reasoning(_pk) def _save_config_key(key_path: str, value): """Save a dot-separated key to config.yaml."""