Fix: chat/prompt not persisting scene changes — throw on missing active scene - #561
Fix: chat/prompt not persisting scene changes — throw on missing active scene#561Srujanreddy1234 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 23a2f04. Configure here.
| expect(m.content.text).toContain('load_scene') | ||
| expect(m.content.text).toContain('create_project') | ||
| expect(m.content.text).toContain('create_house_from_brief') | ||
| expect(m.content.text).toContain('no bound scene') |
There was a problem hiding this comment.
Prompt test substring mismatch
High Severity
The new binding-scene test expects the prompt to contain "no bound scene", but the actual prompt text uses "Without a bound scene". This string mismatch causes the test assertion to fail.
Reviewed by Cursor Bugbot for commit 23a2f04. Configure here.
| expect(events.length).toBe(1) | ||
| expect(events[0]!.kind).toBe('create_wall') | ||
| expect(events[0]!.version).toBe(2) | ||
| }) |
There was a problem hiding this comment.
Tests need missing store events
High Severity
New regression tests call store.listSceneEvents and expect publishLiveSceneSnapshot to save and emit events when using InMemorySceneStore, but that test store does not implement appendSceneEvent or listSceneEvents, so canAppendSceneEvents is false and publish returns without persisting.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 23a2f04. Configure here.


Problem
The chat/prompt interface in the Pascal 3D floor-plan editor wasn't building or editing anything based on user prompts. When a user submitted a prompt like "Add a bedroom to the current floor plan...", the AI agent's tool calls (create_room, add_door, add_window, furnish_room) executed and mutated the in-memory Zustand store, but no changes were persisted to SQLite and no SSE events were emitted — so the browser never received the updates. From the user's perspective, the assistant appeared to respond, but nothing was ever built.
Root Cause
publishLiveSceneSnapshot() in live-sync.ts was silently returning when no active scene was bound to the MCP session:
const active = operations.getActiveScene()
if (!(active && operations.canAppendSceneEvents)) return // silent no-op
This meant any mutation made without an actively bound scene was dropped with no error, no log, and no signal to the caller.
Compounding this, the from_brief MCP prompt never instructed the LLM to call load_scene / create_project / create_house_from_brief before invoking mutation tools. As a result, the LLM would frequently jump straight to create_room etc. on a fresh session — which then silently failed to persist due to the issue above.
Fix
Tests
How to verify
Note
Medium Risk
Changes core MCP persistence behavior for all mutation paths that call live sync; mis-bound sessions now error instead of silently dropping work, which is intentional but affects agent UX.
Overview
Fixes chat/prompt edits that appeared to succeed but never showed in the editor by making live sync fail loudly when a
SceneStoreis attached but no scene is bound, instead of silently skipping persistence and SSE events.publishLiveSceneSnapshotnow throwsno_active_scenewith guidance to callload_scene,create_project, orcreate_house_from_briefbefore mutation tools; headless mode (no store) still no-ops unchanged.The
from_briefMCP prompt adds a CRITICAL FIRST STEP to bind a scene first, restructures the task into bind → build → validate steps, and updates the prompt description away from implyingapply_patch-only workflows.Tests cover live-sync throw/success/versioning, prompt text for scene binding, and a bedroom-style regression that mutations persist and emit the expected scene events when an active scene is set. A root
test-flow.mjsscript exercises room tools over in-memory MCP transport.Reviewed by Cursor Bugbot for commit 23a2f04. Bugbot is set up for automated code reviews on this repo. Configure here.