Conversation
📝 WalkthroughWalkthroughThe PR updates error retry logic to treat HTTP status codes 429 and 499 as retryable for Gemini TTS and LLM services, and corrects a comment reference in the fallback adapter from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (1)**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-01-22T03:28:16.289ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
🔇 Additional comments (2)
✏️ Tip: You can disable this entire section by setting Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/gemini_tts.py (1)
233-239: Remove HTTP 499 from retryable status codes and extract a shared constant.Google's Gemini/GenAI API documentation explicitly advises against auto-retrying HTTP 499 (CANCELLED), which represents client-driven cancellations (e.g., timeouts, stream disconnects). Only HTTP 429 (rate limit) should be automatically retried. Additionally, this pattern is duplicated across adapters in
llm.pyandbeta/gemini_tts.py.♻️ Suggested fix
+RETRYABLE_CLIENT_CODES = {429} ... - retryable=True if e.code in {429, 499} else False, + retryable=e.code in RETRYABLE_CLIENT_CODES,Apply this fix to both
llm.pyandbeta/gemini_tts.py.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
livekit-agents/livekit/agents/llm/fallback_adapter.pylivekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/gemini_tts.pylivekit-plugins/livekit-plugins-google/livekit/plugins/google/llm.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Format code with ruff
Run ruff linter and auto-fix issues
Run mypy type checker in strict mode
Maintain line length of 100 characters maximum
Ensure Python 3.9+ compatibility
Use Google-style docstrings
Files:
livekit-agents/livekit/agents/llm/fallback_adapter.pylivekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/gemini_tts.pylivekit-plugins/livekit-plugins-google/livekit/plugins/google/llm.py
🧠 Learnings (1)
📚 Learning: 2026-01-22T03:28:16.289Z
Learnt from: longcw
Repo: livekit/agents PR: 4563
File: livekit-agents/livekit/agents/beta/tools/end_call.py:65-65
Timestamp: 2026-01-22T03:28:16.289Z
Learning: In code paths that check capabilities or behavior of the LLM processing the current interaction, prefer using the activity's LLM obtained via ctx.session.current_agent._get_activity_or_raise().llm instead of ctx.session.llm. The session-level LLM may be a fallback and not reflect the actual agent handling the interaction. Use the activity LLM to determine capabilities and to make capability checks or feature toggles relevant to the current processing agent.
Applied to files:
livekit-agents/livekit/agents/llm/fallback_adapter.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: livekit-plugins-cartesia
- GitHub Check: unit-tests
- GitHub Check: livekit-plugins-openai
- GitHub Check: livekit-plugins-deepgram
- GitHub Check: type-check (3.9)
- GitHub Check: type-check (3.13)
🔇 Additional comments (2)
livekit-agents/livekit/agents/llm/fallback_adapter.py (1)
252-262: LGTM.
No behavioral change observed in this segment.livekit-plugins/livekit-plugins-google/livekit/plugins/google/llm.py (1)
512-519: Remove 499 from the retryable error codes.HTTP 499 (CANCELLED) indicates the client closed the connection before the response was delivered—a client-side issue, not a server error. Per Google's official guidance, 499 should not be blindly retried; the underlying cause (client timeout, premature cancellation, streaming disconnect) must be fixed first. Retrying 499 without addressing root causes will only repeat the failure.
HTTP 429 is correctly marked as retryable with exponential backoff, but 499 should be handled separately or removed from the automatic retry logic.
Likely an incorrect or invalid review comment.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
This allows retry on 499 errors w/ Google LLM.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.