refactor(#129): separate Tool.run() exception handling from LLM error formatting#149
Merged
Merged
Conversation
… formatting
- Add run_raw()/arun_raw() that raise exceptions instead of catching
- Deprecate error-swallowing in run()/arun() with DeprecationWarning
- Replace fragile startswith("Error") detection with _ToolError sentinel
- Add exception_type and traceback fields to ExecutionLogEntry
- Add TIMEOUT status to ExecutionStatus enum
- Add TOOL_ERROR event type to ChangeEventType
- Emit TOOL_ERROR events on tool execution failures
- Add 9 new tests covering run_raw, deprecation warnings, structured
error logging, and TOOL_ERROR event emission
Closes #129
9491d24 to
d42a2c2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_raw()/arun_raw()methods toToolthat raise exceptions instead of catching them, giving programmatic callers access to full exception inforun()/arun()— they now emitDeprecationWarningwhen catching, directing users torun_raw()response_str.startswith("Error")detection inexecute_tool_calls()with a_ToolErrorsentinel dataclassExecutionLogEntrywithexception_typeandtracebackfields for structured error loggingTIMEOUTstatus toExecutionStatusenumTOOL_ERRORevent type toChangeEventType, emitted on tool execution failuresTest plan
pytest tests/test_tool.py— run_raw/arun_raw success + raises, deprecation warningspytest tests/test_tool_registry.py— structured error logging, TOOL_ERROR events, success pathpytest tests/— 874 passed, 1 pre-existing MCP failure (unrelated)Closes #129