- Create rate_limit_utils.py with shared constants and functions
- Update agent.py to import from shared module
- Update test_agent.py to import from shared module (removes duplication)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When Claude API hits rate limits via HTTP 429 exceptions (rather than
response text), the agent now properly detects and handles them:
- Add RATE_LIMIT_PATTERNS constant for comprehensive detection
- Add parse_retry_after() to extract wait times from error messages
- Add is_rate_limit_error() helper for pattern matching
- Return new "rate_limit" status from exception handler
- Implement exponential backoff: 60s → 120s → 240s... (max 1 hour)
- Improve generic error backoff: 30s → 60s → 90s... (max 5 minutes)
- Expand text-based detection patterns in response handling
- Add unit tests for new functions
Fixes#41
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>