Release 1.0.0 - #5
Conversation
… all prompt context fields - ProfileSerializer: expose password as write-only field so it flows through to the model's save() hashing logic (was excluded entirely before) - PromptBuilder: apply Jinja2 rendering to company_bot.context, state_machine.context, and completion_criteria (not just tag_context); extract shared _render_template helper and compute profile/address context once - audio_provider_utils: prevent TTS from reading "1: 30"-style patterns as time by replacing colon with comma
|
Warning Review limit reached
More reviews will be available in 45 minutes and 58 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors chat session status tracking so ChangesSession Status Refactor, LLM Routing, Prompt Builder, and Utility Fixes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AsyncSocketConsumer
participant AsyncBaseConsumer
participant ChatSession
Client->>AsyncSocketConsumer: WebSocket receive(message)
AsyncSocketConsumer->>AsyncSocketConsumer: create_chat_session() → (cs, cs_created)
alt session already existed
AsyncSocketConsumer->>AsyncBaseConsumer: determine_company_chat_status_async()
AsyncBaseConsumer->>ChatSession: query existing chats & Max(step)
ChatSession-->>AsyncBaseConsumer: status result
AsyncBaseConsumer-->>AsyncSocketConsumer: company_chat_status
AsyncSocketConsumer->>AsyncBaseConsumer: update_session_status(company_chat_status)
AsyncBaseConsumer->>ChatSession: save session_status (if not COMPLETED)
end
alt non-auth path & status == IN_PROGRESS
AsyncSocketConsumer->>AsyncBaseConsumer: update_session_status(IN_PROGRESS)
AsyncBaseConsumer->>ChatSession: save session_status
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
chatbot/consumers/async_base_consumer.py (1)
92-103:⚠️ Potential issue | 🟠 Major | ⚡ Quick winCOMPLETED status check is unreachable for sessions with user chats.
The
elifchain has a logic flaw: when user chats exist (existing_chats.exclude(sender_id=1).count() > 0), line 92's condition is False. Since those chats are part ofexisting_chats, line 96'sexisting_chats.exists()will be True, causing line 100's COMPLETED check to never execute.This means sessions already marked COMPLETED by the response handler (per context snippet 3) will incorrectly return
IN_PROGRESSinstead of preservingCOMPLETED.🐛 Proposed fix: check COMPLETED status earlier
+ if chat_session and chat_session.session_status == ChatStatus.COMPLETED: + return ChatStatus.COMPLETED + if existing_chats.exclude(sender_id=1).count() == 0: return ChatStatus.STARTED elif state_machine and not is_last_step and is_disconnected: return ChatStatus.PAUSED elif existing_chats.exists(): last_chat = existing_chats.last() if last_chat and last_chat.status == ChatStatus.PAUSED: return ChatStatus.RESUME - elif chat_session and chat_session.session_status == ChatStatus.COMPLETED: - return ChatStatus.COMPLETED return ChatStatus.IN_PROGRESS🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@chatbot/consumers/async_base_consumer.py` around lines 92 - 103, The COMPLETED status check is unreachable because when user chats exist in existing_chats, the condition on line 96 (existing_chats.exists()) evaluates to True and prevents line 100's chat_session.session_status check from executing. Move the COMPLETED status check to an earlier position in the elif chain, before the existing_chats.exists() condition, so that chat_session sessions marked as COMPLETED are detected and returned regardless of whether user chats exist in the queryset.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@chatbot/services/response_handlers/base_response_handler.py`:
- Around line 852-853: The custom_model value extracted from
company_bot.other_params is not being normalized before being used as an
override, which allows invalid values like whitespace-only strings to be
returned and break gateway calls. Normalize the custom variable by stripping
whitespace and validating it is a non-empty string before returning it; only
return the normalized custom value if it passes validation, otherwise fall back
to returning company_bot.llm_model as the default.
In `@chatbot/utils/audio_provider_utils.py`:
- Around line 66-67: The regex pattern in the text normalization at the re.sub
call is requiring whitespace after the colon using \s+, which misses common time
formats like 1:30 that have no space. Modify the regex pattern to make the
whitespace optional by replacing \s+ with \s* so that it matches both formats
with and without spaces after the colon (e.g., both "1:30" and "1: 30" will be
normalized to "1, 30").
---
Outside diff comments:
In `@chatbot/consumers/async_base_consumer.py`:
- Around line 92-103: The COMPLETED status check is unreachable because when
user chats exist in existing_chats, the condition on line 96
(existing_chats.exists()) evaluates to True and prevents line 100's
chat_session.session_status check from executing. Move the COMPLETED status
check to an earlier position in the elif chain, before the
existing_chats.exists() condition, so that chat_session sessions marked as
COMPLETED are detected and returned regardless of whether user chats exist in
the queryset.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1b242a67-72a0-4d4f-ba63-ffe259f3d61c
📒 Files selected for processing (9)
chatbot/admin/company_admin.pychatbot/consumers/async_base_consumer.pychatbot/consumers/async_consumer.pychatbot/models/enums.pychatbot/serializer/profile_serializer.pychatbot/services/core/prompt_builder.pychatbot/services/response_handlers/base_response_handler.pychatbot/utils/audio_provider_utils.pychatbot/utils/media_preview/media_creation.py
|
@CodeRabbit review |
✅ Action performedReview finished.
|
95fdddb
into
ELEVATE-Project:release-1.0.0
Summary by CodeRabbit
New Features
Bug Fixes
Improvements