fix(scenes): no importar una escena del Wizard tras cambiar de workspace - #310
Conversation
PR Review — Loreframe StudioRisk: medium Automated review from Findings
Changed files
CONTRIBUTING checklist
Posted by the repo PR review workflow. Re-runs on each push to the PR. |
Code healthQuality score: 59.4/100Higher is better. The score is a trend dashboard; the independent ratchet below remains the CI gate.
Change vs PR base: +0.0 points.
Markdown, JSON catalogs and tests are out of this table. Only Most complex functions
Trend vs baseline
Warnings
Ratchet passed. |
open_3d_scene fetched the library without the gallery epoch guard used by openSavedScene and prepareWizardScene, so a late import could wipe undo and replace the open compositor after the footer workspace moved. Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
ea50add to
31b7a13
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_2ceba3ab-bf73-41b5-a750-c1740d6c1811) |
Resumen ejecutivo
Qué cambia
open_3d_sceneya no sustituye la escena abierta si el workspace del pie cambia mientras el Wizard carga la receta. La importación tardía se aborta y el undo se conserva.Para qué sirve
Tras #302 y #308, abrir desde la galería o preparar un showcase comprueba la época del workspace. El control de escenas del Wizard seguía haciendo
fetchOutputs+importScenesin ese guard: un cambio de carpeta a media carga revocaba blobs y vaciaba el historial.Impacto para el usuario
Riesgo
Estado
Summary
Wizard
open_3d_scenelisted every saved scene and calledimportScenewith nogalleryWorkspaceEpoch/galleryWorkspaceNamecheck.listenForAgentSceneControlunsubscribe does not cancel an in-flight listener, andfetchOutputsis not tied to the gallery abort controller. Switching workspaces while Scene Animator stays mounted let the late import revoke live blob URLs, clear undo, and replace the open project.loadAgentLibraryScenenow captures the request workspace and refuses to return a document aftercurrent()goes false (list fetch, scene fetch, or JSON parse). The panel also ignores a stale generation (a concurrent library import). Ordinary same-workspace opens are unchanged.Overview
open_3d_scenefor a saved scene in A (navigate('video_3d')→scene3d).fetchOutputs(0, 0, { mediaType: 'scene' })is in flight, the user switches to workspace B. The panel stays mounted; scene state is not workspace-scoped.staleand throws; the open scene and undo remain.Detailed changes
Backend
No backend changes.
UI and Wizard
agentSceneOpen.ts: list + fetch a named compositor scene, aborting when the captured workspace is no longer current.SceneAnimatorPanel:listenForAgentSceneControluses that helper plus the existinggenerationReftoken beforeimportScene.Data, provenance and compatibility
Reads the same
mediaType: 'scene'listing. World3D native JSON still throws insceneFromLibraryPayload(fail-loud, no stub import). Save/export agent paths are unchanged.Files and ownership
ui/src/lib/agentSceneOpen.ts— guarded library resolve.ui/src/components/Sidebar/SceneAnimatorPanel.tsx— Wizard open path.ui/src/i18n/locales/{en,es}/scene3d.json— stale-open copy.ui/tests/agentSceneOpen.test.mjs— stale list/payload, happy path, missing/ambiguous.Left untouched:
prepareWizardScene/openSavedScene(already guarded), workflowcreate_3d_scene(synchronous), save/export agent commands.Validation
Date (UTC): 2026-09-10
Base SHA: f70813f
Head SHA: ea50add
Validation scope: focused
python scripts/verify_clean_repo.pypython -m compileall -q app/services app/launch.py scriptsFocused Python tests: N/A (UI-only)
cd ui && npm run i18n:check— catalogs ok (20 namespaces, en/es)UI tests:
npx tsx --tsconfig tsconfig.app.json --import ./tests/setupI18n.ts --test tests/agentSceneOpen.test.mjs tests/sceneLibrary.test.mjs tests/sceneOutputOpen.test.tsx tests/wizardScenePrepare.test.tsx— 16 passedcd ui && npm run lint -- --max-warnings=0cd ui && npm run buildgit diff --check— cleanE2E/smoke checks: N/A (no live Wizard + dual-workspace session in this environment; covered by deferred-fetch fixtures)
Code quality
main: pending CICI and review
CI of this HEAD: pending
Independent agent review of this HEAD: pending
Human merge click (operational, not code review): pending
Reviewed at current HEAD
Earlier review; HEAD has changed since (stale)
Pending
Unavailable
Coste de la tarea
Notes and limitations
Could not run a live Wizard turn against two workspaces here. The race is locked with the same deferred-fetch pattern as
wizardScenePrepare.test.tsx.Follow-up work
persistScene/publishRecordingthrough refs that pick up the latest workspace if the footer moves mid-upload. Not filed: slower path, no silent wipe of the open document.Checklist
Note
Low Risk
UI-only guard around Wizard scene loading; no auth, persistence, or backend behavior changes beyond preventing an incorrect import.
Overview
Wizard-driven open saved scene no longer runs a late
importSceneif the footer workspace (or a concurrent library generation) changes while the scene list or JSON is still loading.The inline
fetchOutputs+ fetch + parse path inSceneAnimatorPanelis replaced byloadAgentLibraryScene, which re-checks acurrent()guard after the listing, HTTP fetch, and JSON parse. The panel buildsstillCurrentfromgalleryWorkspaceEpoch, the captured workspace name, andgenerationRef, and bails with a newworkspaceChangedOpenmessage instead of importing. Missing, ambiguous, and load failures keep the same user-facing errors; same-workspace opens are unchanged.Unit tests cover stale list/payload races, the happy path, and missing/ambiguous names.
Reviewed by Cursor Bugbot for commit 31b7a13. Configure here.