fix: resolve pre-production bugs in LLM provider infrastructure - #13
Merged
Conversation
Teng91
commented
May 26, 2026
Owner
- SlidingWindowStrategy: reset _daily_count at calendar day boundary (was permanently stuck after hitting daily quota)
- ClaudeProvider: catch anthropic.RateLimitError → raise RateLimitExhausted so fallback chain activates
- OpenRouterProvider: detect HTTP 429 → raise RateLimitExhausted for fallback; add aclose() to close httpx client on shutdown
- GeminiProvider: return None instead of "" for safety-blocked/no- candidate responses so fallback chain works correctly
- BaseProvider: add async aclose() method (no-op default, override in subclasses with clients to close)
- service.py: narrow exception catch from broad Exception to ConnectionError/TimeoutError — programming bugs now propagate as 500 instead of being silently swallowed as 503
- conftest.py: add teardown to reset _llm_service after each test
- Tests: add daily counter reset, Claude rate limit, OpenRouter 429, aclose, and update Gemini/service tests for new behavior
- SlidingWindowStrategy: reset _daily_count at calendar day boundary (was permanently stuck after hitting daily quota) - ClaudeProvider: catch anthropic.RateLimitError → raise RateLimitExhausted so fallback chain activates - OpenRouterProvider: detect HTTP 429 → raise RateLimitExhausted for fallback; add aclose() to close httpx client on shutdown - GeminiProvider: return None instead of "" for safety-blocked/no- candidate responses so fallback chain works correctly - BaseProvider: add async aclose() method (no-op default, override in subclasses with clients to close) - service.py: narrow exception catch from broad Exception to ConnectionError/TimeoutError — programming bugs now propagate as 500 instead of being silently swallowed as 503 - conftest.py: add teardown to reset _llm_service after each test - Tests: add daily counter reset, Claude rate limit, OpenRouter 429, aclose, and update Gemini/service tests for new behavior Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.