From 2f7ba51b809a291ee73dca1a3bd668f3e3080de7 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 27 May 2026 02:26:49 -0700 Subject: [PATCH] refactor(gateway): drop try/except wrappers around resolve_display_setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two new display-resolution sites added by #31034 (busy_ack_detail and long_running_notifications) wrapped resolve_display_setting() in try/except Exception. The existing 4 call sites in this file don't — the function is safe by contract. Match the established pattern and drop the redundant guards. -16 LOC, no behaviour change. --- gateway/run.py | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index 09c36aa983a..3ef8df391b6 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -3226,17 +3226,16 @@ class GatewayRunner: # Build a status-rich acknowledgment. Mobile chat defaults keep this # terse; detailed iteration/tool state is still available in logs and # can be opted in per platform via display.platforms..busy_ack_detail. + from gateway.display_config import resolve_display_setting status_parts = [] - busy_ack_detail_enabled = True - try: - from gateway.display_config import resolve_display_setting as _resolve_display_setting - _user_cfg = _load_gateway_config() - _platform_key = _platform_config_key(event.source.platform) - busy_ack_detail_enabled = bool( - _resolve_display_setting(_user_cfg, _platform_key, "busy_ack_detail", True) + busy_ack_detail_enabled = bool( + resolve_display_setting( + _load_gateway_config(), + _platform_config_key(event.source.platform), + "busy_ack_detail", + True, ) - except Exception: - busy_ack_detail_enabled = True + ) if busy_ack_detail_enabled and running_agent and running_agent is not _AGENT_PENDING_SENTINEL: try: @@ -17430,18 +17429,14 @@ class GatewayRunner: # 0 = disable notifications. _NOTIFY_INTERVAL_RAW = _float_env("HERMES_AGENT_NOTIFY_INTERVAL", 180) _NOTIFY_INTERVAL = _NOTIFY_INTERVAL_RAW if _NOTIFY_INTERVAL_RAW > 0 else None - try: - _notify_enabled = bool( - resolve_display_setting( - user_config, - platform_key, - "long_running_notifications", - True, - ) + if not bool( + resolve_display_setting( + user_config, + platform_key, + "long_running_notifications", + True, ) - except Exception: - _notify_enabled = True - if not _notify_enabled: + ): _NOTIFY_INTERVAL = None _notify_start = time.time()