Bugfix: Anonymous users see 'No sessions found' because VittoChatEng...
Documentation for Sessions
🐛 Bugfix: Anonymous users see 'No sessions found' because VittoChatEng...
Date: 2026-02-21
Time: 20:58:30 UTC
Session: gspace1-133.18
Agent: backend
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Anonymous users see 'No sessions found' because VittoChatEngineService.effect() never calls setScope() for anonymous userId. Guest sessions are also silently abandoned when user logs in.
Task: Not specified
🎯 Decision Made
Chosen:
Fix engine to always call setScope + add migrateAnonymousSessions()
Options Considered:
- Fix engine to always call setScope + add migrateAnonymousSessions()
- Backend-sync sessions like ai-panel does
- Ignore anonymous sessions entirely
💭 Reasoning
Root cause: the effect() guarded setScope() behind contextUserId !== 'anonymous', so anonymous users got no session created. Fix: (1) Always call setScope() with effectiveUserId = contextUserId || 'anonymous', so anonymous users get sessions immediately. (2) Add migrateAnonymousSessions(newUserId, newSpaceId) to VittoChatPersistenceService — re-scopes non-empty anonymous sessions to the real user. (3) Call migration before setContext() in the engine effect when AuthService resolves a real user. This is the minimal fix — backend-sync would be ideal long-term but is over-engineering for now.
📁 Files Involved
- No files specified
🔗 Related
- Decision ID:
dev_1771707510115_z6qgrsc - Session: 133
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation