Architecture: What additional wiring was needed after the initial cross-ch...
Documentation for Sessions
🏗️ Architecture: What additional wiring was needed after the initial cross-ch...
Date: 2026-03-14
Time: 04:46:30 UTC
Session: gspace1-217.4
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
What additional wiring was needed after the initial cross-channel bridge to make chat persistence fully connected?
Task: Close cross-channel persistence gaps after initial bridge implementation
🎯 Decision Made
Chosen:
Fixed 5 gaps: (1) spaceId+source not persisted in appendMessages (CRITICAL - caused duplicate sessions), (2) No auto-discovery of channel sessions in web UI (CRITICAL - messages lost), (3) Dossier brief missing from web chat prompts (IMPORTANT - Vitto forgot users on web), (4) No genome compilation for channel sessions (IMPORTANT - invisible to session memory), (5) Missing source field in session list types
Options Considered:
- No alternatives documented
💭 Reasoning
The initial bridge correctly POSTs messages to ai-api, but the receiving side had gaps: appendMessages didn't save spaceId (so findByUserAndSpace never found existing sessions), the frontend never subscribed to onSessionUpdated (so channel sessions were invisible in real-time), the web prompt builder skipped the Dossier (so Vitto had less context on web than WhatsApp), and genome compilation never triggered for appended messages (so session memory awareness excluded channel sessions). Each gap was verified by tracing the full data flow from bridge POST through to frontend rendering.
📁 Files Involved
APIs/backend-ai-api/src/app/sessions/sessions.service.tsAPIs/backend-ai-api/src/app/sessions/sessions.controller.tsAPIs/backend-vitto-api/src/app/engine/context-assembly/web-prompt-builder.service.tslibs/libs-ai/vitto-chat/src/lib/services/vitto-chat-engine.service.tslibs/libs-ai/vitto-chat/src/lib/services/vitto-chat-persistence.service.ts
🔗 Related
- Decision ID:
dev_1773463590369_j8xhqae - Session: 217
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation