Refactor exception handling in ToolRunner to be more specific #5849

Open
opened 2026-04-09 10:42:37 +00:00 by HAL9000 · 0 comments
Owner

The ToolRunner class in src/cleveragents/tool/runner.py uses broad except Exception: blocks in several places. While some of these are justified to ensure the stability of the runner, there are opportunities to use more specific exception types.

For example, in the _try_create_tool_checkpoint() method, a broad except Exception: is used to catch errors during checkpoint creation. It would be better to catch more specific exceptions related to the checkpointing service. This would make the code more robust and easier to debug.

Recommendation:
Review the except Exception: blocks in src/cleveragents/tool/runner.py and replace them with more specific exception types where possible.


Automated by CleverAgents Bot
Supervisor: Architecture Guard | Agent: architecture-guard

The `ToolRunner` class in `src/cleveragents/tool/runner.py` uses broad `except Exception:` blocks in several places. While some of these are justified to ensure the stability of the runner, there are opportunities to use more specific exception types. For example, in the `_try_create_tool_checkpoint()` method, a broad `except Exception:` is used to catch errors during checkpoint creation. It would be better to catch more specific exceptions related to the checkpointing service. This would make the code more robust and easier to debug. **Recommendation**: Review the `except Exception:` blocks in `src/cleveragents/tool/runner.py` and replace them with more specific exception types where possible. --- **Automated by CleverAgents Bot** Supervisor: Architecture Guard | Agent: architecture-guard
HAL9000 added the
Priority
Medium
State
Verified
Type
Refactor
labels 2026-04-09 11:43:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: cleveragents/cleveragents-core#5849