Repository navigation
fix(desktop): gate last-window quit until startup settles - #2287
Conversation
- Problem: the startup splash is the only window during boot, and its recovery timers destroy it when the loading renderer stalls; the empty window set then fires window-all-closed and the app quits silently ~10s after launch, before the server child forks (issue milind-soni#2028). - Fix: hold the window-all-closed quit until the boot chain settles, and re-check the drained window set once at settle so a boot that ends windowless still exits instead of idling. - Verification: node --test electron/window-all-closed.node-test.mjs (5/5, sabotage run with the gate removed fails them); pnpm test:electron 555/560 pass 0 fail; pnpm check:electron 148 modules; pnpm typecheck clean.
|
@santhiprakash is attempting to deploy a commit to the SupaMaus Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe main process now delegates last-window quit decisions to a coordinator. The coordinator checks whether startup has settled, whether the platform is macOS, and whether any windows remain. Node tests cover these conditions. ChangesWindow lifecycle
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to If the last window closes during startup, the app waits for startup to settle before applying its platform-specific quit behavior. No actionable merge-blocking risk is established. Architecture SummaryArchitecture risk: 🟡 Medium · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Reliability and maintainability
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What changed
window-all-closedno longer quits the app while the boot chain is still running. The quit decision now lives inelectron/window-all-closed.mjs, gated on startup having settled; when the boot promise settles it re-checks the window set once, so a boot that genuinely ends with no window still exits instead of idling headless. Behavior after startup and on macOS is unchanged.Why
Refs #2028 — the AppImage exits silently ~10.6s after launch under a Hyprland/systemd-user session but runs fine from SSH.
The startup splash is the app's only window while boot runs.
e169719b("recover from a stalled loading window") added arender-process-gonehandler and a 10s fallback thatdispose()the splash so a stalled renderer can't hold boot — butdispose()callssplash.destroy(), which empties the window set, fireswindow-all-closed, and the unconditionalapp.quit()atelectron/main.mjsturns the recovery into a silent exit ~10.5s in: no window ever showed, the server child was never forked (8799/8800 never come up), and nothing reaches stdout/stderr because startup logging goes to the log file. That matches the reporter's ~10.6s wall-clock / ~1s CPU signature on a session where the splash renderer stalls beforeready-to-show.With this change the drain mid-boot is survivable exactly as the recovery intended: boot continues, the server forks, and the main window (or the bounded error page) still gets delivered.
How it was verified
node --test electron/window-all-closed.node-test.mjs— 5/5 pass, incl. the Linux AppImage exits silently after ~10s when started by the desktop/systemd-user, but stays up when started from an SSH session #2028 sequence (drain mid-boot → boot creates the main window → settle keeps the app up → last close quits)startupSettledgate fails the new tests; restored they passpnpm test:electron— 555 pass / 0 fail / 5 skipped (560 total)pnpm check:electron— 148 modules syntax-checkedpnpm typecheck— clean;oxlint --deny-warningscleantsc -b+i18n:check) — greenScreenshots (UI changes)
No UI change — desktop lifecycle only.
Checklist
pnpm typecheckandpnpm testpass locally (pnpm test:electron; touched surface is the Electron shell)electron/window-all-closed.node-test.mjsdist-server/edits (it's build output)shell: true/ cmd.exe string-building — darwin keeps never-quitting on the drainNotes
server.logand viaELECTRON_ENABLE_LOGGINGinstead of a silent exit. NosafeStoragepath was changed.window-all-closedregistration).AI-assisted. I wrote and verified this change.
Summary by CodeRabbit