Files
ajarbot/agent.py
Jordan Ramos 20b7b9f7c4 Fix error handling to preserve detailed timeout messages
**Problem**: User got generic "Sorry, I encountered an error" (80 chars)
instead of the detailed timeout message with progress info and suggestions.

**Root Cause**: agent.py error handlers were replacing exception messages
with hardcoded generic text, discarding the detailed timeout info from
llm_interface.py.

**Solution**:
1. TimeoutError handler: Use str(e) to preserve detailed message from
   llm_interface.py (message count, last tool, suggestions)
2. General Exception handlers: Include actual error text (limited to 500
   chars) instead of "Please try again"
3. Applied to both Agent SDK and Direct API code paths

**Impact**: Users now see the actual error details including:
- Progress when task timed out (message count, last tool used)
- Actionable suggestions (break into sub-tasks, use delegate_task)
- Actual error messages for debugging instead of generic text

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 16:17:37 -07:00

32 KiB