Bugfix: Why does the Vitto Studio preview show blank after module ge...
Documentation for Sessions
🐛 Bugfix: Why does the Vitto Studio preview show blank after module ge...
Date: 2026-03-18
Time: 21:07:00 UTC
Session: gspace1-237.2
Agent: backend
Confidence: 98%
Status: ✅ Documented
📋 Decision Context
Question:
Why does the Vitto Studio preview show blank after module generation reports success?
Task: S234.2: Fix generation pipeline — files not reaching frontend VFS
🎯 Decision Made
Chosen:
Include actual file content (path, content, language, moduleName) in the module-gen.module-generated SSE event, and forward the files field through the tool.progress SSE wrapper in module-gen.plugin.ts. The frontend handleModuleGenerated() already expects data.files[] and writes to VFS via fileWriter.receiveGeneratedFiles() — the data was simply never populated.
Options Considered:
- Include files in module-gen.module-generated SSE (chosen — minimal, correct)
- Include files in module-gen.completed SSE (too late — all modules at once, large payload)
- Fix VFS refresh to wait for GitLab commit (fragile — race condition with DEPLOY phase)
- Add a separate SSE event type for file content delivery (over-engineering)
💭 Reasoning
Root cause chain: (1) execute.phase.ts emitted module-gen.module-generated with {moduleName, filesGenerated: N} but NO file content. (2) module-gen.plugin.ts forwarded the event as tool.progress but cherry-picked specific fields, excluding any files field. (3) Frontend handleModuleGenerated() checked data.files — always undefined, returned early. (4) handleCompleted() tried vfsSync.refreshModule() as fallback, but in repo mode files aren't committed to GitLab yet, and in disk mode files aren't accessible from the frontend's backend-ai-api endpoint. (5) VFS stayed empty → detectModulesInVfs() returned [] → compileRspack() returned early → preview showed nothing. The fix adds ~10 lines total across 2 files. No architectural change needed — the frontend code was already correct, it was just never fed data.
📁 Files Involved
APIs/backend-vitto-api/src/app/module-generation/phases/execute.phase.tsAPIs/backend-vitto-api/src/app/tools/plugins/module-gen.plugin.tslibs/libs-structural/vitto-studio/src/lib/services/studio-generation-listener.service.ts
🔗 Related
- Decision ID:
dev_1773868020547_tvtyeuy - Session: 237
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation