fix(whatsapp): use private system prompt for natural assistant replies#402
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 22 minutes and 6 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR introduces a new ChangesWhatsApp Answer Intent Feature
Sequence Diagram(s)sequenceDiagram
participant User
participant WhatsAppService
participant IntentService
participant GeminiClient
participant SafeValidator
User->>WhatsAppService: send "how do I verify account"
WhatsAppService->>IntentService: parseMessage()
IntentService->>GeminiClient: parseFunctionCall(systemPrompt)
GeminiClient-->>IntentService: { functionName: "answer_twizrr_question", params: { topic: "verification", answer: "..." } }
IntentService-->>WhatsAppService: return parsed intent
WhatsAppService->>SafeValidator: getSafeNaturalAnswer(params)
SafeValidator->>SafeValidator: validate answer (no JSON, emoji, forbidden terms)
SafeValidator-->>WhatsAppService: return safe answer or fallback
WhatsAppService->>User: send validated text response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
PR #402 follow-up: support_handoff remains declared and is now handled deterministically in WhatsAppService with safe Twizrr support copy that does not claim live human handoff. Added/updated focused WhatsAppService coverage for Gemini selecting support_handoff; existing WhatsApp channel tests still cover consent before AI/search, guest product discovery after consent, account/order/checkout/payment/delivery gates, product-like buy phrasing, natural-answer validation, and no private prompt logging. Branch was refreshed from latest origin/dev via merge before the follow-up commit. Validation passed: pnpm --filter @twizrr/backend test -- channels/whatsapp; pnpm --filter @twizrr/backend test -- modules/auth/auth.service.spec.ts -t 'WhatsApp phone'; npx tsc -p apps/backend/tsconfig.build.json --noEmit; pnpm --filter @twizrr/backend run build; touched-file ESLint; git diff --check; staged security-sentinel scan. Confirmed no .env.local changes, no silent User.phone identity matching changes, and no unrelated delivery/auth/payment/web code edits in the follow-up commit. |
Summary
Scope
Behavior
Validation
Tests
Security Notes
Summary by CodeRabbit
New Features
Tests