From 61d9e3366d65f4dc628d9a96f10adf773df98e49 Mon Sep 17 00:00:00 2001 From: sprmn24 Date: Mon, 4 May 2026 21:55:01 +0300 Subject: [PATCH] fix(model_tools): log plugin hook exceptions instead of silently swallowing them --- model_tools.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/model_tools.py b/model_tools.py index 8721e9ee6a..679a0934c4 100644 --- a/model_tools.py +++ b/model_tools.py @@ -730,8 +730,8 @@ def handle_function_call( session_id=session_id or "", tool_call_id=tool_call_id or "", ) - except Exception: - pass + except Exception as _hook_err: + logger.debug("pre_tool_call hook error: %s", _hook_err) if block_message is not None: return json.dumps({"error": block_message}, ensure_ascii=False) @@ -782,8 +782,8 @@ def handle_function_call( tool_call_id=tool_call_id or "", duration_ms=duration_ms, ) - except Exception: - pass + except Exception as _hook_err: + logger.debug("post_tool_call hook error: %s", _hook_err) # Generic tool-result canonicalization seam: plugins receive the # final result string (JSON, usually) and may replace it by @@ -807,8 +807,8 @@ def handle_function_call( if isinstance(hook_result, str): result = hook_result break - except Exception: - pass + except Exception as _hook_err: + logger.debug("transform_tool_result hook error: %s", _hook_err) return result