Skip to content

refactor(#129): separate Tool.run() exception handling from LLM error formatting#149

Merged
Oaklight merged 1 commit into
masterfrom
refactor/separate-tool-run-error-handling
May 14, 2026
Merged

refactor(#129): separate Tool.run() exception handling from LLM error formatting#149
Oaklight merged 1 commit into
masterfrom
refactor/separate-tool-run-error-handling

Conversation

@Oaklight
Copy link
Copy Markdown
Owner

Summary

  • Add run_raw()/arun_raw() methods to Tool that raise exceptions instead of catching them, giving programmatic callers access to full exception info
  • Deprecate error-swallowing in run()/arun() — they now emit DeprecationWarning when catching, directing users to run_raw()
  • Replace fragile response_str.startswith("Error") detection in execute_tool_calls() with a _ToolError sentinel dataclass
  • Enrich ExecutionLogEntry with exception_type and traceback fields for structured error logging
  • Add TIMEOUT status to ExecutionStatus enum
  • Add TOOL_ERROR event type to ChangeEventType, emitted on tool execution failures
  • 9 new tests covering all changes

Test plan

  • pytest tests/test_tool.py — run_raw/arun_raw success + raises, deprecation warnings
  • pytest tests/test_tool_registry.py — structured error logging, TOOL_ERROR events, success path
  • Full suite pytest tests/ — 874 passed, 1 pre-existing MCP failure (unrelated)

Closes #129

… 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
@Oaklight Oaklight force-pushed the refactor/separate-tool-run-error-handling branch from 9491d24 to d42a2c2 Compare May 14, 2026 08:16
@Oaklight Oaklight merged commit 7504e0b into master May 14, 2026
3 checks passed
@Oaklight Oaklight deleted the refactor/separate-tool-run-error-handling branch May 14, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: separate Tool.run() exception handling from LLM error formatting

1 participant