From 745147ebf0a9245b1bbe8780f8d95d736916bac7 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 20 Jun 2026 11:08:03 -0400 Subject: [PATCH] refactor(ai_client): narrow bare 'except:' in _execute_tool_calls_concurrently (Phase 9 sites 6+7) Both deepseek and minimax branches in the tool call dispatcher had: try: args = json.loads(tool_args_str) except: args = {} json.JSONDecodeError is a subclass of ValueError, so narrowed to: except (ValueError, TypeError): args = {} This satisfies the BC classification (specific exception types). --- src/ai_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ai_client.py b/src/ai_client.py index 578c0bf1..1c9dbdaa 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -707,20 +707,20 @@ async def _execute_tool_calls_concurrently( if provider == "gemini": name, args, call_id = fc.name, dict(fc.args), fc.name # Gemini 1.0.0 doesn't have call IDs in types.Part elif provider == "gemini_cli": name, args, call_id = cast(str, fc.get("name")), cast(dict[str, Any], fc.get("args", {})), cast(str, fc.get("id")) elif provider == "anthropic": name, args, call_id = cast(str, getattr(fc, "name")), cast(dict[str, Any], getattr(fc, "input")), cast(str, getattr(fc, "id")) - elif provider == "deepseek": + elif provider == "deepseek": tool_info = fc.get("function", {}) name = cast(str, tool_info.get("name")) tool_args_str = cast(str, tool_info.get("arguments", "{}")) call_id = cast(str, fc.get("id")) try: args = json.loads(tool_args_str) - except: args = {} + except (ValueError, TypeError): args = {} elif provider == "minimax": tool_info = fc.get("function", {}) name = cast(str, tool_info.get("name")) tool_args_str = cast(str, tool_info.get("arguments", "{}")) call_id = cast(str, fc.get("id")) try: args = json.loads(tool_args_str) - except: args = {} + except (ValueError, TypeError): args = {} else: continue