Skip to content

Studio reloads itself once when its window never finishes starting, and says so - #1340

Merged
ccoventry merged 1 commit into
devfrom
fix/boot-watchdog
Nov 7, 2026
Merged

ccoventry merged 1 commit into
devfrom
fix/boot-watchdog

Conversation

@ccoventry

@ccoventry ccoventry commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Release note: Fixed: if Studio's window ever opens without finishing its start-up (every button dead), it now reloads itself once and tells you, instead of sitting there.

What happened

After a hard reset, npm run tauri dev opened a window where nothing worked: no error in the console, the backend answering get_settings at once. The page had loaded 76 of its 239 scripts and waited on the rest for good, so main.js never ran. Nothing said so anywhere.

What changes

  • studio/public/boot_watchdog.js, a classic script loaded from index.html before main.js, so it runs when the modules don't.
  • main.js calls window.dodStudioBoot.done() as the last step of its boot.
  • No done() within 20 s: a banner says Studio is reloading, the activity log gets [boot] Studio's page didn't finish starting in 20 s (N of its scripts loaded): reloading it once, and the page reloads.
  • Stuck again after that reload: the banner says to restart Studio, the log says so too, and it stops. It never reload-loops (a session-storage marker, cleared by the next start that finishes).
  • Every start logs one line: [boot] Studio's page started in N ms.

It catches any start that stops short, not just hung downloads: an exception in main.js's boot, or a start-up call that never answers, leaves done() uncalled too.

Decisions

  • Its text lives in the script, not strings.js. The catalog is a module, and this runs exactly when modules don't. Named constants at the top of the file.
  • 20 s, so a cold tauri dev start, Vite bundling every dependency first, isn't mistaken for a hang. A release start takes about a second.
  • One automatic reload, never more.
  • main_js_budget 523 → 525 for the done() call and its comment, which have to sit at the end of the boot itself.
  • Release builds: the hang behind this needs Vite's dev server, which a release doesn't use (its pages come from the app's own files). The watchdog ships anyway (checked in vite build: dist/boot_watchdog.js), for the other ways a start can stop.

Test done

  • boot_watchdog.test.js (6): a normal start, one reload, stuck again, the marker cleared, a late finish, a finish during the reload line.
  • Two new e2e tests in app-boot.spec.js: a normal boot reaches started with no banner; with one of main.js's imports never answering, the page reloads once and then shows the restart banner.
  • npm run test:unit (1,424 passed), all e2e (521 passed), eslint (no errors).
  • vite build: the watchdog is copied to dist and loaded before the bundle.

Not tested: inside a real Tauri window (the e2e harness is a plain browser with mocked IPC, so the log line goes to the console there).

Your test (2 min)

  1. Run npm run tauri dev from this branch.
  2. Open the activity log (Help > View Logs). The start's newest lines include [boot] Studio's page started in N ms.

🤖 Generated with Claude Code

…shes, and says so

A classic script in index.html, loaded before main.js, waits 20 s for
main.js's boot to call window.dodStudioBoot.done(). If it doesn't, the page
reloads once with a banner and an activity log line; stuck again, the banner
says to restart Studio and it stops there. A normal start logs how long it
took. Unit tests for the logic, e2e tests for a normal boot and for one whose
module never arrives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccoventry

Copy link
Copy Markdown
Owner Author

Tested in a real Studio window (tauri dev from a throwaway worktree with #1340 and #1341 merged, its own port, app-data folder and web view profile, driven over CDP; the user's settings.json hash unchanged after):

#1340, boot watchdog

  • Normal start: [boot] Studio's page started in 332 ms in the activity log, no banner.
  • src/players_ui.js held forever, deadline set to 3 s: ...didn't finish starting in 3 s (235 of its scripts loaded): reloading it once, the page reloaded, then ...after a reload either ...: restart Studio and the restart banner. No further reloads.
  • Request let go: the start finished, the banner went, and the log said started after a reload, which cleared the marker.

#1341, start-up prompts

  • A cut-short render batch seeded in the test app data: Render Batch Interrupted showed at start.
  • "Capture the rest?" asked while it was open (batch_resume.js's offer, the real module and dialogs): 2.5 s later still not shown, the render window still up.
  • Discard on the render window: "Capture the rest?" came up within 1.5 s. Not now started nothing.

@ccoventry
ccoventry merged commit 0d92a0d into dev Nov 7, 2026
10 checks passed
@ccoventry
ccoventry deleted the fix/boot-watchdog branch November 7, 2026 22:27
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.

1 participant