Improve error handling #22
Open
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.
Improve error handling
Errors from E2B sandbox and web tools were propagating as unhandled exceptions, causing models to get stuck or receive misleading feedback.
Changes:
src/stirrup/tools/code_backends/e2b.py)- Added catch-all exception handler to run_command() that returns CommandResult with
error_kind="execution_error"
- Matches existing pattern in Docker and Local backends
src/stirrup/tools/web.py)- Extended exception handling to also catch httpx.InvalidURL and ValueError
src/stirrup/tools/web.py)- Wrapped search execution in try/except to handle httpx.HTTPError
- Returns proper error XML with success=False instead of crashing
tests/test_e2b_execution.py)- Added test case for unexpected exception handling in E2B