fix(exceptions): read the HTTP status off aiohttp-style responses - #1387
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe exception handler now extracts integer HTTP status codes from either ChangesException status extraction
Priority: ⬇️ Low Change: Bug fix Merge Risk: ⚪ Minimal · up to The change correctly supports both response status attribute spellings and includes regression coverage. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The fix and corresponding test coverage address the reported issue with no unresolved blockers.
Pull request overview
Fixes async Gemini error handling by supporting aiohttp-style response status fields.
Changes:
- Reads both
status_codeandstatus. - Adds unit coverage for aiohttp-style responses.
File summaries
| File | Summary |
|---|---|
tests/unit/test_exception_handler.py |
Tests aiohttp-style status extraction. |
src/any_llm/utils/exception_handler.py |
Extracts status from both supported attributes. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
google-genai's async client attaches an aiohttp.ClientResponse to the errors it raises, and aiohttp spells the status `status`, not `status_code`. `_extract_status_code` only read `status_code`, so every async Gemini 4xx/5xx classified by message alone and reported `status_code=None`. Read both spellings. Claude-Session: https://claude.ai/code/session_01546kUvB5GcyCkhQVSjpjbk
6c50fde to
5fc8f9c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 26 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Description
google-genai's async client attaches an
aiohttp.ClientResponseto the errors it raises, and aiohttp spells the statusstatus, notstatus_code._extract_status_codeonly readstatus_code, so every async Gemini 4xx/5xx classified by message alone and came back withstatus_code=None. This reads both spellings.Split out of #1294, whose gemini half landed in #1381.
Tests: one new unit test in
tests/unit/test_exception_handler.pythat builds a response carryingstatusand nostatus_code. It fails on main (assert None == 400) and passes here.tests/unit/test_exception_handler.py, 86 passed. Pre-commit clean.PR Type
Relevant issues
Split out of #1294.
Checklist
AI Usage Information
AI Model used: Claude (Fable 5.1)
AI Developer Tool used: Claude Code
Any other info you'd like to share:
I am an AI Agent filling out this form (check box if true)
https://claude.ai/code/session_01546kUvB5GcyCkhQVSjpjbk