# Liminalia Studio

## When the window crashes or freezes (desktop app)

`packages/studio-desktop/src/main/crash-guard.ts` (`guardCrashes()` in `main.ts`). Everything is recorded in the log ("Help → Open Log").

- If a window's process ends abnormally (`render-process-gone`; a normal end on closing is excluded), that window is reopened. Studio returns to the file and line it had open.
  If the same window ends abnormally 3 times within 1 minute, it stops reopening and tells you ("Reopen," "Open Log," "Close")
- If a window stops responding (`unresponsive`), it waits 30 seconds, and if it doesn't recover, asks for pending saves, then stops the process and reopens it (counted the same way as above)
- Unhandled exceptions and Promise rejections in the main process, and abnormal ends of the GPU and other processes, are recorded in the log, and the app keeps running

What reopening loses: Studio saves every time typing pauses for 1 second (the change history is in `.liminalia/history/`), and nothing can be taken out of a window that ended abnormally.
What is lost is less than the last 1 second of typing before the crash, the undo history, a panel in the middle of choosing between overlapping changes, and unsaved work in plugin screens that keep their own pending saves.
