Skip to content

fix: resolve pre-production bugs in LLM provider infrastructure - #13

Merged
Teng91 merged 1 commit into
masterfrom
fix/pre-production-bugs
May 26, 2026
Merged

fix: resolve pre-production bugs in LLM provider infrastructure#13
Teng91 merged 1 commit into
masterfrom
fix/pre-production-bugs

Conversation

@Teng91

@Teng91 Teng91 commented May 26, 2026

Copy link
Copy Markdown
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>
@Teng91 Teng91 self-assigned this May 26, 2026
@github-actions

Copy link
Copy Markdown

Coverage

Test Coverage
FileStmtsMissCoverMissing
src/chatbot_plugin
   __init__.py00100% 
   config.py130100% 
   db.py14378%26–28
   routers.py30486%36–38, 43
   service.py440100% 
src/chatbot_plugin/contracts
   __init__.py30100% 
   requests.py100100% 
   responses.py210100% 
src/chatbot_plugin/llm
   __init__.py60100% 
   base_provider.py29196%85
   bootstrap.py420100% 
   claude_provider.py160100% 
   config.py10190%22
   gemini_provider.py320100% 
   openrouter_provider.py230100% 
   resilient_llm_service.py330100% 
src/chatbot_plugin/llm/rate_limit
   __init__.py40100% 
   no_op_strategy.py60100% 
   quota_strategy.py70100% 
   sliding_window_strategy.py60395%39, 68, 70
src/chatbot_plugin/models
   __init__.py20100% 
   article.py23195%49
src/chatbot_plugin/rag
   __init__.py20100% 
   chain.py80100% 
   prompt.py290100% 
   retriever.py150100% 
TOTAL4821397% 

Tests Skipped Failures Errors Time
136 0 💤 0 ❌ 0 🔥 15.813s ⏱️

@Teng91
Teng91 merged commit 7735eaa into master May 26, 2026
1 check passed
@Teng91
Teng91 deleted the fix/pre-production-bugs branch May 26, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant