Repository navigation
Issue #1854: Quit Anyway waits for the tasks to stop behind a modal card - #1855
Merged
emmertex merged 2 commits intoDec 3, 2026
Merged
Conversation
… card Quit Anyway used to set each task's cancel flag and close the window at once, so a task slow to stop could still be writing when the library closed. When a cancelled task is still listed, the prompt now turns into a wait: a modal card names what is stopping, shows a spinner after 0.5 s, and refuses control, MIDI, file-drop and keyboard input until the tasks have ended or the app's 5 s timer runs out (the log names what was still running). The window keeps answering the OS, and a second quit request does not restart the wait. A watchdog thread ends the process if the frame loop cannot (a minimised window draws no frames). A task started during the wait is asked to stop too and does not raise the tasks question again. Manual: none, no user-visible change beyond the quit prompt, which has no manual page. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
emmertex
enabled auto-merge
December 3, 2026 01:02
emmertex
approved these changes
Dec 3, 2026
emmertex
left a comment
Owner
There was a problem hiding this comment.
Looks good — careful design (drain gated on stopping(), watchdog stands down via finish() before the saves, wasm-safe clock), behaviour-level tests for each state, all 17 locales filled, release notes present. Updated the branch with staging and enabled auto-merge.
Non-blocking nits:
- Manual:
docs/manual-site/src/content/docs/platforms/performance.mdx:42already says "Quitting asks first while a stoppable task is running." — a follow-up sentence there about Quit Anyway waiting up to 5 s (spinner after 0.5 s) would keep the manual in step. LCC_QUIT_WATCHDOG_CHILD(test only) could use theCHROMAFORGE_prefix for consistency with the env-var convention.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1854
Problem
Quit Anyway (the "tasks are still running" prompt) set each task's cancel flag and closed the window at once. Nothing waited for the tasks to stop, so a task slow to honour its cancel could still be writing when the library closed. The prompt had no waiting state, and nothing refused control-channel, CLI or MIDI input, or dropped files, while the app shut down.
Change
crates/engine/src/activity.rs:Activity::stopping()lists tasks that were cancelled but are still on the stack; the named constantsQUIT_DRAIN(5 s),QUIT_SPINNER_AFTER(0.5 s) andPLUGIN_QUIT_WINDOW(2 s).crates/ui-egui/src/panels/notices.rs: Quit Anyway starts a drain only when a cancelled task is still listed; otherwise it closes at once as before. During the drain the card names what is stopping, shows a spinner after 0.5 s, and the prompt takes every click and key (keyboard::answer_waiting). The drain ends when the tasks have stopped or the 5 s timer runs out; the log names each task still running. A task started during the wait is asked to stop too, and does not raise the tasks question again (unsaved-changes and backup questions still come first).crates/ui-egui/src/lib.rs: control requests get"the app is shutting down", and MIDI and file drops are ignored, while the drain runs; a second close request is refused without restarting the wait. A watchdog thread ends the process if the frame loop cannot (a minimised or occluded window draws no frames): at the timer it wakes the UI, a grace period later it logs what is left and exits. The drain clock is egui's, becauseInstant::nowpanics on wasm; the thread is compiled out on wasm.crates/ui-egui/src/headless.rs: the test harness can send a host close request and recordsCancelClose.Waiting for {names} to stop…in all 17-formats.jsoncatalogs;docs/background-tasks.md; release notes.Not in this PR:
PLUGIN_QUIT_WINDOWis defined and ordered against the app timer by a test, but nothing applies it, because the app has no plug-in shutdown to govern yet (AC-6 cancelled). The watchdog's exit skips the usual save on exit (settings, window, the due backup, closing the library); it is the last resort for a UI that draws no frames. A Dock or system quit still bypasses the quit prompt altogether. No test sends a pointer click through the card or a MIDI message during the wait.Acceptance criteria
quit_anyway_with_nothing_left_running_closes_at_oncethe_wait_shows_a_spinner_after_half_a_second_and_refuses_input,the_wait_ignores_dropped_files_and_holds_the_native_menu_back(seen failing with the control gate off and with the drop gate off; MIDI is gated too but not tested)the_spinner_joins_the_card_at_half_a_second(seen failing with the threshold always off and always on)the_window_answers_the_os_during_the_wait(seen failing with the refusal inmay_closeremoved)crates/ui-egui/tests/quit_drain_log.rs(seen failing with the log line removed); the exit isthe_watchdog_really_ends_the_processquit_anyway_with_nothing_left_running_closes_at_once,quit_anyway_waits_for_a_task_that_stops_in_time,quit_anyway_ends_when_the_timer_runs_out_and_the_log_names_the_taskthe_wait_shows_a_spinner_after_half_a_second_and_refuses_input(seen failing with the modal flag removed)the_watchdog_ends_the_process_when_the_frame_loop_cannot,the_watchdog_wakes_the_ui_at_the_timer_before_it_ends_anything,a_drain_that_ends_normally_stops_the_watchdog,the_watchdog_really_ends_the_process(a child process, the realprocess::exit)a_task_started_during_the_wait_does_not_raise_the_tasks_question_again(seen failing without the answered flag and without thecancel_all())a_drain_the_frame_loop_has_ended_stops_the_watchdog_while_it_still_saves(seen failing without thefinish()call)How it was checked
cargo xtask ci --quick,cargo xtask silandcargo test -pfor the touched crates pass on this branch, up todate with
staging(merged in, not rebased)ci --quick, parity, layers, assets, deny, wasm, android); the branch is behindstagingby 7 commits on other files and merges cleanly.Merging
unsafe, build scripts, network access, spawned processes, deleted files, CI orxtaskgate changes: a new background thread (the watchdog) and one test that re-runs the test binary as a child process; no dependencies,unsafe, build scripts or network access (see Runs on CI).Manual: none, the quit prompt has no manual page.
Runs on CI
In the diff, only the touched crates' own tests run on the runners. Two things to know: the watchdog thread (native only, ends the process after the timer plus a grace period) and
the_watchdog_really_ends_the_process, which starts the test binary itself (Command::newoncurrent_exe, filtered to that one test) and checks that it ends within seconds; the child's only effect is to exit. No workflow, build-script, packaging or dependency changes, no network, and no files written outside a temp folder.Checklist
unwrap/expect/panic!, no indexing or unchecked arithmetic on anumber from a file, a person or an agent (
get,checked_mul, NaN and char boundaries handled)tr()and has its key incrates/ui-egui/locales/*.json; a new shortcut isfree in
docs/library-shortcuts.md🤖 Generated with Claude Code