Skip to content

The agent that grows with you

review-fix(suppress-audit): run_shutdown/browser_tool_cdp/tui server — restore BASE exception semantics

Tekniumd9141c425fc6
diff --git a/gateway/run_shutdown.py b/gateway/run_shutdown.py
index 0f6997072ce..083b59023bc 100644
--- a/gateway/run_shutdown.py
+++ b/gateway/run_shutdown.py
@@ -1095,15 +1095,18 @@ class GatewayShutdownMixin:
path = self._stuck_loop_counts_path()
if not path.exists():
return
- counts = self._read_json_counts(path) or {}
- if session_key not in counts:
- return
- del counts[session_key]
- with suppress(Exception):
- if counts:
- await asyncio.to_thread(atomic_json_write, path, counts, indent=None)
- else:
- path.unlink(missing_ok=True)
+ # The whole read/mutate/write is guarded (as on main): a corrupt counters file
+ # (non-dict JSON) must never raise out of a session-completion path.
+ try:
+ counts = self._read_json_counts(path) or {}
+ if session_key in counts:
+ del counts[session_key]
+ if counts:
+ await asyncio.to_thread(atomic_json_write, path, counts, indent=None)
+ else:
+ path.unlink(missing_ok=True)
+ except Exception:
+ pass
# Restart orchestration
@staticmethod
diff --git a/tools/browser_tool_cdp.py b/tools/browser_tool_cdp.py
index d7000628c43..2843a47971a 100644
--- a/tools/browser_tool_cdp.py
+++ b/tools/browser_tool_cdp.py
@@ -88,10 +88,12 @@ def _get_dialog_policy_config() -> Tuple[str, float]:
else:
_bt.logger.debug("Invalid browser.dialog_policy=%r; using default", candidate)
timeout_raw = browser_cfg.get("dialog_timeout_s")
- with contextlib.suppress(TypeError, ValueError):
- parsed = float(timeout_raw) if timeout_raw is not None else DEFAULT_DIALOG_TIMEOUT_S
- if parsed > 0:
- timeout_s = parsed
+ try:
+ timeout_s = float(timeout_raw) if timeout_raw is not None else DEFAULT_DIALOG_TIMEOUT_S
+ if timeout_s <= 0:
+ timeout_s = DEFAULT_DIALOG_TIMEOUT_S
+ except (TypeError, ValueError):
+ timeout_s = DEFAULT_DIALOG_TIMEOUT_S
return policy, timeout_s
except Exception:
return DEFAULT_DIALOG_POLICY, DEFAULT_DIALOG_TIMEOUT_S
diff --git a/tui_gateway/server.py b/tui_gateway/server.py
index 43902800e5b..dae582a0e04 100644
--- a/tui_gateway/server.py
+++ b/tui_gateway/server.py
@@ -2097,7 +2097,10 @@ def _session_info(agent, session: dict | None = None) -> dict:
with contextlib.suppress(Exception):
from hermes_cli.banner import get_update_result
from hermes_cli.config import recommended_update_command
- info.update(update_behind=get_update_result(timeout=0.5), update_command=recommended_update_command())
+ # Two assignments (not one info.update): if recommended_update_command() raises,
+ # update_behind must still be reported, as on main.
+ info["update_behind"] = get_update_result(timeout=0.5)
+ info["update_command"] = recommended_update_command()
if live_agent and (warn := _probe_credentials(agent)):
info["credential_warning"] = warn
return info