Bugfix: Why doesn't Vitto on WhatsApp know who the user is, and how ...
Documentation for Sessions
🐛 Bugfix: Why doesn't Vitto on WhatsApp know who the user is, and how ...
Date: 2026-02-28
Time: 20:15:52 UTC
Session: gspace1-155.3
Agent: backend
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Why doesn't Vitto on WhatsApp know who the user is, and how to fix the data pipeline?
Task: Session 155: Fix Vitto WhatsApp data pipeline so Vitto knows user identity
🎯 Decision Made
Chosen:
Fix 3 compounding failures: (1) Add @Get('memories/:userId') endpoint to backend-ai-api chat.controller.ts with system token auth — the existing call from backend-vitto-api was hitting a 404; (2) Extend ResolvedUser interface and pass email/name from backend-api resolution through channel-gateway metadata; (3) Inject resolved GoGrab identity (name, email) into vitto-engine system prompt, preferring it over WhatsApp display name
Options Considered:
- Fix the 3 failures in the data pipeline (chosen)
- Add a new dedicated internal API for user profile enrichment
- Have the LLM use http_request tool to self-query user data on every message
💭 Reasoning
Root cause was 3 compounding failures: (a) backend-ai-client.service.ts:456 calls GET /ai-api/chat/memories/{userId} but chat.controller.ts only had GET /chat/memories (no :userId param) → 404, fetchUserFacts() always returned []; (b) Even if URL existed, existing endpoint used @CurrentUser() from JWT but Vitto sends SYSTEM_TOKEN — JwtAuthGuard already maps system tokens to role='system', so new endpoint checks authUser.role; (c) resolveChannelIdentity returns name/email from backend-api but channel-user.service.ts dropped them, channel-gateway never passed them to metadata, and vitto-engine only used profileName from WhatsApp. Fix is surgical: 4 files, ~32 lines, no structural changes.
📁 Files Involved
APIs/backend-ai-api/src/app/chat/chat.controller.tsAPIs/backend-vitto-api/src/app/connectivity/channel-user.service.tsAPIs/backend-vitto-api/src/app/connectivity/channel-gateway.service.tsAPIs/backend-vitto-api/src/app/engine/vitto-engine.service.ts
🔗 Related
- Decision ID:
dev_1772309748958_kmn406v - Session: 155
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation