Repository navigation
Desktop: ask before quitting on top of a running install - #7550
Conversation
This is the trigger neither #7492 nor #7490 addresses -- both start from a venv that is already broken. Confirmed: neither PR touches cleanup_child_processes. Quitting runs cleanup_child_processes -> install::stop_install, which SIGTERMs the installer's process group. In the reported session that landed at "5/10 studio deps", so the venv kept the CLI's dependencies and lost the server stack, and the next launch died on `import structlog`. Three minutes of installing, destroyed with no warning and no way back. So ask. Only from the tray Quit item -- a deliberate action with a UI present. The RunEvent::Exit path (OS shutdown, SIGTERM) is left alone: it must never block on a dialog nobody can answer. The call already runs off the menu callback thread, which is also what blocking_show requires. Closing the window was already safe (it hides to tray); this closes the remaining way to lose an install by accident.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83996139d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| state | ||
| .lock() | ||
| .map(|install| install.child.is_some()) | ||
| .unwrap_or(false) |
There was a problem hiding this comment.
Track elevated package installs before quitting
On Linux, once the installer requests elevation, wait_for_exit clears InstallProcess.child, and install_system_packages subsequently runs apt-get update/install without restoring or otherwise marking that child state. Selecting tray Quit while those elevated commands are active therefore bypasses this confirmation and exits the parent while the package manager's captured pipes are still in use, potentially interrupting apt/dpkg and leaving the installation or package database incomplete. Track the elevated-install phase explicitly rather than treating child.is_some() as the complete definition of an active installation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
install_system_packages is a sync #[tauri::command] (commands.rs:405), unlike start_install which is async, so it blocks the GTK main thread and the tray Quit event cannot dispatch until apt returns. The state hole is real but unreachable. Worth revisiting if that command ever becomes async.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What happens today
Quitting the desktop app while it is installing destroys the install silently, with no warning and no way back. From a user's diagnostics:
The app relaunched two seconds later and the backend died with:
The kill landed during
deps [==========----------] 5/10 studio deps, which is the step that installsstudio/backend/requirements/studio.txt, andstructlogis declared only there. The tray Quit item callscleanup_child_processestostop_install, which SIGTERMs the installer's process group. The user had been installing for minutes and was given no indication that quitting would undo it.The change
confirm_quit_during_installasks first, offering "Keep installing" or "Quit anyway".Two deliberate limits:
RunEvent::Exitpath (OS shutdown, SIGTERM) must never block on a dialog nobody can answer, so it is left alone.std::thread::spawnin the Quit handler, becauseblocking_show()must not be called on the main thread.install::is_install_runningis a small accessor somain.rscan ask without reaching intoInstallState. When no install is running the dialog never appears and quit behaves exactly as before.Scope
This addresses the trigger. Detecting and repairing an already-damaged venv is #7492 (merged) and #7490, and they are complementary: this stops the damage happening, they handle the installs that were already damaged.
Deliberately kept small and clear of #7490, which rewrites
process.rsanduse-tauri-backend.ts. This touchesmain.rs, which #7490 does not, plus a 14-line addition toinstall.rs.Verification
cargo checkclean andcargo test101 passed on this branch. The two warnings emitted are both present on main already.