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

Open
github-bot wants to merge 1 commit from github-bot/gh-531 into main AGit
Owner

@⁠BrenoMazini on GitHub · 2026-12-03 02:48 UTC · original
BrenoMazini:launcher-close → main · +12 −1 · 2 files · 1 commits · open

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

**@⁠BrenoMazini** on GitHub · 2026-12-03 02:48 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/531) `BrenoMazini:launcher-close` → `main` · +12 −1 · 2 files · 1 commits · open ## 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)
The launcher's "Quit the game" and "Restart the game" call
Process.CloseMainWindow, which posts WM_CLOSE. The window procedure only took
SC_CLOSE (the close button) as the user's close: WM_CLOSE went to the title,
which did nothing with it, and the launcher ended the process 2.5 s later.
Neither the suspend nor the save of the host pipeline library at the end of
the run happened; logs of two runs ended that way show no "suspending the
title" line, and the pipelines made since the last timed save were lost.

WM_CLOSE now ends the title as SC_CLOSE does, and the launcher waits 15 s
(the suspend has 1 s at most, then the library of tens of MB is written)
before it ends the process itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 02:50:26 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/531/head:github-bot/gh-531'
git switch 'github-bot/gh-531'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-531'
git switch 'github-bot/gh-531'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-531'
git switch 'github-bot/gh-531'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-531'
git switch 'main'
git merge --squash 'github-bot/gh-531'
git switch 'main'
git merge --ff-only 'github-bot/gh-531'
git switch 'main'
git merge 'github-bot/gh-531'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.