Bugfix: Why does Vitto repeat the last sentence of its WhatsApp resp...
Documentation for Sessions
🐛 Bugfix: Why does Vitto repeat the last sentence of its WhatsApp resp...
Date: 2026-03-19
Time: 11:32:42 UTC
Session: gspace1-234.5
Agent: angular
Confidence: 97%
Status: ✅ Documented
📋 Decision Context
Question:
Why does Vitto repeat the last sentence of its WhatsApp responses as a separate message?
Task: S234: Fix WhatsApp message duplication
🎯 Decision Made
Chosen:
The sendWhatsAppQuickReply body used extractLastSentence(result.output) which duplicated the last line. Replaced with contextual body text from generateQuickReplyBody() that describes WHAT happened (e.g., 'Your modules are ready.') instead of echoing the response. Empty body = skip quick reply entirely. Also rewrote generateQuickReplies() with tool-specific suggestions instead of generic buckets.
Options Considered:
- Context-aware body + tool-specific buttons (chosen)
- Remove quick replies entirely (throws away useful UX)
- Send quick reply as reaction instead of message (WhatsApp API doesn't support this)
- Delay quick reply to avoid visual duplication (doesn't fix the content issue)
💭 Reasoning
Root cause: After routeTaskResponse() sent the full WhatsApp message, a separate sendWhatsAppQuickReply() call at line 403 of channel-processing.service.ts sent ANOTHER message with extractLastSentence(result.output) as the body text. This body appeared as a regular WhatsApp message bubble with buttons below it — users saw the same sentence twice. The fix has two parts: (1) body text is now contextual and distinct from the response (maps tool calls to short summaries like 'Your modules are ready.'), (2) button labels are tool-specific instead of generic ('Open preview' instead of 'More details'). When Vitto's response already ends with a question, body is empty and no quick reply is sent at all — the question IS the follow-up prompt.
📁 Files Involved
APIs/backend-vitto-api/src/app/engine/channel-processing.service.tsAPIs/backend-vitto-api/src/app/engine/channel-response-enricher.service.ts
🔗 Related
- Decision ID:
dev_1773919962493_f82mq3t - Session: 234
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation