Skip to content

fix(scenes): no importar una escena del Wizard tras cambiar de workspace - #310

Merged
IAnMove merged 1 commit into
developmentfrom
cursor/critical-bug-management-8dc3
Sep 10, 2026
Merged

fix(scenes): no importar una escena del Wizard tras cambiar de workspace#310
IAnMove merged 1 commit into
developmentfrom
cursor/critical-bug-management-8dc3

Conversation

@cursor

@cursor cursor Bot commented Sep 10, 2026

Copy link
Copy Markdown

Resumen ejecutivo

Qué cambia

open_3d_scene ya 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 + importScene sin ese guard: un cambio de carpeta a media carga revocaba blobs y vaciaba el historial.

Impacto para el usuario

  • Pedir al Wizard «abre la escena Concierto» y cambiar de workspace ya no pisa el compositor ni borra el undo.
  • Una apertura válida en el mismo workspace sigue abriendo la escena y seleccionando la capa pedida.
  • Nombres ausentes o ambiguos siguen fallando en cerrado, sin importar nada.

Riesgo

  • Bajo
  • Medio
  • Alto

Estado

  • En desarrollo
  • Listo para revisión
  • Bloqueado por CI o revisión
  • Requiere migración o acción manual

Summary

Wizard open_3d_scene listed every saved scene and called importScene with no galleryWorkspaceEpoch / galleryWorkspaceName check. listenForAgentSceneControl unsubscribe does not cancel an in-flight listener, and fetchOutputs is 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.

loadAgentLibraryScene now captures the request workspace and refuses to return a document after current() 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

  1. User edits an unsaved compositor scene in workspace A (Scene Animator open).
  2. Wizard runs open_3d_scene for a saved scene in A (navigate('video_3d')scene3d).
  3. While fetchOutputs(0, 0, { mediaType: 'scene' }) is in flight, the user switches to workspace B. The panel stays mounted; scene state is not workspace-scoped.
  4. Before: the stale handler imports A's file, wipes undo, revokes blobs.
  5. After: the load returns stale and 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: listenForAgentSceneControl uses that helper plus the existing generationRef token before importScene.
  • en/es copy for the stale-open error.

Data, provenance and compatibility

Reads the same mediaType: 'scene' listing. World3D native JSON still throws in sceneFromLibraryPayload (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), workflow create_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.py

  • python -m compileall -q app/services app/launch.py scripts

  • Focused 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 passed

  • cd ui && npm run lint -- --max-warnings=0

  • cd ui && npm run build

  • git diff --check — clean

  • E2E/smoke checks: N/A (no live Wizard + dual-workspace session in this environment; covered by deferred-fetch fixtures)

Code quality

  • Score: pending CI
  • Complexity trend: pending CI
  • Production LOC trend: pending CI
  • Regression versus main: pending CI
  • Ratchet: pending CI

CI 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

  • Tests simulados: 0 tokens externos
  • Tests reales: N/A
  • Llamadas LLM externas: 0
  • Tokens de prompt: N/A
  • Tokens de respuesta: N/A
  • Tokens totales: N/A
  • Generaciones de imágenes/audio/vídeo: 0
  • Tiempo transcurrido: N/A
  • Proveedores/modelos: N/A

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

  • Agent save/export still resolve persistScene / publishRecording through refs that pick up the latest workspace if the footer moves mid-upload. Not filed: slower path, no silent wipe of the open document.
  • Conversation merge can hide mid-window turns in the UI when stale localStorage 1–40 meets a 50-message server; three-way persist keeps the server canonical. Below the permanent-loss bar.

Checklist

  • The executive summary is understandable without reading the code.
  • The detailed Summary/Overview has not been removed or shortened.
  • Tests and their actual results are recorded.
  • Generated assets, secrets and local-only files are not committed.
  • Required CI and Cursor/Bugbot review are complete, or the PR is clearly marked as waiting for them.
Open in Web View Automation 

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 importScene if the footer workspace (or a concurrent library generation) changes while the scene list or JSON is still loading.

The inline fetchOutputs + fetch + parse path in SceneAnimatorPanel is replaced by loadAgentLibraryScene, which re-checks a current() guard after the listing, HTTP fetch, and JSON parse. The panel builds stillCurrent from galleryWorkspaceEpoch, the captured workspace name, and generationRef, and bails with a new workspaceChangedOpen message 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.

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

PR Review — Loreframe Studio

Risk: medium
Scope: 36 file(s); +1628/-168; Pinokio installer, Pinokio updater, React UI, backend services, docs

Automated review from scripts/analyze_pr.py. This is a heuristic pass (no LLM) so humans still own the merge decision.

Findings

  • medium — Large pull request
    1628 additions / 168 deletions. Reviewers will have an easier time with smaller, focused PRs.
  • medium — Very large file change (ui/src/features/sceneFx/worldRuntime.ts)
    ui/src/features/sceneFx/worldRuntime.ts adds 419 lines. Consider splitting the PR.
  • low — UI changed — rebuild before merge
    Run cd ui && npm run build (CI already does this). Pinokio Update rebuilds for end users; keep ui/dist untracked.

Changed files

  • added: app/services/hunyuan3d/build_mesh_painter.py, hunyuan_native.js, ui/e2e/specs/world-sfx-worldspace.spec.ts, ui/src/features/sceneFx/WorldSfxControls.tsx, ui/src/features/sceneFx/world.ts, ui/src/features/sceneFx/worldDemo.ts, ui/src/features/sceneFx/worldRuntime.ts, ui/src/lib/agentSceneOpen.ts, ui/tests/agentSceneOpen.test.mjs, ui/tests/worldSfxRuntime.test.ts
  • modified: app/requirements.txt, app/services/hunyuan3d/requirements.txt, app/services/scene_commands.py, docs/development/SCENE_EFFECTS_AND_MCP.md, docs/development/WANGP_1272_ADOPTION.md, install.js, tests/fixtures/architecture_wire_inventory.json, tests/test_launcher_compatibility.py, tests/test_scene_effect_commands.py, ui/src/components/Sidebar/SceneAnimatorPanel.tsx, ui/src/features/scene3d/Scene3DStage.tsx, ui/src/features/scene3d/Scene3DWorkspace.tsx, ui/src/features/scene3d/document.ts, ui/src/features/scene3d/gpu.ts, ui/src/features/scene3d/publish.ts, ui/src/features/scene3d/speech/audio.ts, ui/src/features/scene3d/transformGizmo.ts, ui/src/features/scene3d/types.ts, ui/src/features/sceneFx/SceneFxOverlay.tsx, ui/src/features/sceneFx/showcase.ts
    … and 6 more

CONTRIBUTING checklist

  • python scripts/verify_clean_repo.py
  • python -m compileall -q app/services app/launch.py scripts
  • cd ui && npm run build if the UI changed
  • No weights, CivitAI sidecars, or generated guides
  • Stays local-first (no required accounts / telemetry)

Posted by the repo PR review workflow. Re-runs on each push to the PR.

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

Code health

Quality score: 59.4/100

Higher is better. The score is a trend dashboard; the independent ratchet below remains the CI gate.

Component Weight Current Change
Cyclomatic health 45% 56.6 +0.0
File concentration 25% 67.3 +0.0
Oversized-file debt 20% 43.3 +0.0
Modularity 10% 85.0 +0.1

Change vs PR base: +0.0 points.

Metric Value
Production LOC 286,300
Production files 899
Test LOC 113,943
Functions measured 19,062
Functions complexity ≥ 15 874
Maximum complexity 674
Policy code-health-policy-v1
HEAD b5d1f5f1fdfc8dfb87fca40cff130e080d5886fd
Base cde67d3983a7e1f2e79433be2ff90385e0576285
UI measurement complete

Markdown, JSON catalogs and tests are out of this table. Only app/ runtime + ui/src TS/JS count.

Most complex functions

Complexity Where
674 app/wgp.py:7221 generate_video
381 ui/src/stores/useStore.ts:4122 Async method 'startGeneration'
355 app/_launch_runtime.py:23653 _run_generation
308 app/wgp.py:12363 generate_video_tab
266 ui/src/components/Sidebar/SceneAnimatorPanel.tsx:506 Function 'SceneAnimatorPanel'
264 ui/src/stores/useStore.ts:8670 Async method 'loadSettingsFromOutput'
258 app/services/director/planners/short_film.py:3433 ShortFilmPlanner._plan_story_driven
248 app/services/director_pipeline.py:13607 _run_video_generation
245 app/services/director_pipeline.py:7712 _run_pipeline
233 ui/src/features/agent/agentActions.ts:1152 Function 'parseAction'
226 app/services/director_pipeline.py:6541 update_comic_preview
225 ui/src/features/agent/agentActions.ts:2998 Async function 'executeAgentActions'

Trend vs baseline

Metric Δ
Production LOC +47
Test LOC +100
Functions ≥ 15 +0
Maximum complexity +0

Warnings

  • production LOC increased by +47
  • hotspot ui/src/components/Sidebar/SceneAnimatorPanel.tsx increased by +11 lines

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>
@IAnMove
IAnMove marked this pull request as ready for review September 10, 2026 15:38
@IAnMove
IAnMove force-pushed the cursor/critical-bug-management-8dc3 branch from ea50add to 31b7a13 Compare September 10, 2026 15:38
@cursor

cursor Bot commented Sep 10, 2026

Copy link
Copy Markdown
Author

Bugbot couldn't run - usage limit reached

Bugbot 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)

@IAnMove
IAnMove merged commit 6c4d8e3 into development Sep 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants