Private
Public Access
0
0

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).
This commit is contained in:
2026-06-20 11:08:03 -04:00
parent ca4a78dcc1
commit 745147ebf0
+3 -3
View File
@@ -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