Quit and Restart from the launcher end the title cleanly and keep its pipelines #531

Open
BrenoMazini wants to merge 1 commit from upstream-pr/531 into main
BrenoMazini commented 2026-12-03 02:48:50 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by BrenoMazini on 2026-12-03T02:48:50Z.


The bug

The launcher's "Quit the game" and "Restart the game" call Process.CloseMainWindow, which posts WM_CLOSE to the title's window.

The window procedure only treated SC_CLOSE as the user closing: the close button, Alt+F4, or the window or taskbar menu. A WM_CLOSE went on to the title, which did nothing with it. The launcher then ended the process 2.5 s later. So:

  • the title was never suspended;
  • the final save of the host pipeline library never ran, and the pipelines made since the last timed save were lost.

Logs of runs closed that way end with no "suspending the title" line.

The fix

  • lifecycle.rs: WM_CLOSE ends the title as SC_CLOSE does, through end_title. end_title already returns at once when it is called a second time, so a close that arrives both ways is safe.
  • Launcher.cs: EndGame waits up to 15 s, instead of 2.5 s, before it ends the process itself.
    • The suspend has 1 s at most; then the library, tens of MB, is written.
    • The process normally exits by itself well before that, so the launcher does not wait the full 15 s.

Tested

Eight sessions closed with the launcher's Quit, each logged on its own. Setup: Ryzen 7 5700X, RTX 4070 SUPER, a build of my fork based on v0.8.3.3 (main 7dbcdcb, the base of this PR). Each log ends with:

asked to close: suspending the title constrained=1 routines=2
title suspended; ending the title
host pipeline library saved bytes=... early=2516 made=1317 loaded=1188 started_early=2460
  • In seven sessions the title suspended in 0.07-0.11 s, and the library was saved.
  • In one session the title did not finish suspending within its 1 s. The log said "title did not finish suspending in time; ending the title", and the library was still saved.

Checks

  • The launcher compiles with scripts/build-launcher.ps1's compiler and flags.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
  • The same check with --all-features: clean.
  • cargo test --workspace --locked: all pass.
  • cargo xtask policy: ok.

🤖 Generated with Claude Code

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5618880393 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/531). Originally posted by [BrenoMazini](https://github.com/BrenoMazini) on 2026-12-03T02:48:50Z. --- ## The bug The launcher's "Quit the game" and "Restart the game" call `Process.CloseMainWindow`, which posts `WM_CLOSE` to the title's window. The window procedure only treated `SC_CLOSE` as the user closing: the close button, Alt+F4, or the window or taskbar menu. A `WM_CLOSE` went on to the title, which did nothing with it. The launcher then ended the process 2.5 s later. So: - the title was never suspended; - the final save of the host pipeline library never ran, and the pipelines made since the last timed save were lost. Logs of runs closed that way end with no "suspending the title" line. ## The fix - `lifecycle.rs`: `WM_CLOSE` ends the title as `SC_CLOSE` does, through `end_title`. `end_title` already returns at once when it is called a second time, so a close that arrives both ways is safe. - `Launcher.cs`: `EndGame` waits up to 15 s, instead of 2.5 s, before it ends the process itself. - The suspend has 1 s at most; then the library, tens of MB, is written. - The process normally exits by itself well before that, so the launcher does not wait the full 15 s. ## Tested Eight sessions closed with the launcher's Quit, each logged on its own. Setup: Ryzen 7 5700X, RTX 4070 SUPER, a build of my fork based on v0.8.3.3 (main `7dbcdcb`, the base of this PR). Each log ends with: ``` asked to close: suspending the title constrained=1 routines=2 title suspended; ending the title host pipeline library saved bytes=... early=2516 made=1317 loaded=1188 started_early=2460 ``` - In seven sessions the title suspended in 0.07-0.11 s, and the library was saved. - In one session the title did not finish suspending within its 1 s. The log said "title did not finish suspending in time; ending the title", and the library was still saved. ## Checks - The launcher compiles with `scripts/build-launcher.ps1`'s compiler and flags. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - The same check with `--all-features`: clean. - `cargo test --workspace --locked`: all pass. - `cargo xtask policy`: ok. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/531:upstream-pr/531'
git switch 'upstream-pr/531'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/531'
git switch 'upstream-pr/531'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/531'
git switch 'upstream-pr/531'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/531'
git switch 'main'
git merge --squash 'upstream-pr/531'
git switch 'main'
git merge --ff-only 'upstream-pr/531'
git switch 'main'
git merge 'upstream-pr/531'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
readmet3xt-lab/foxhound!531
No description provided.