fix(menu,victory): prevent headless restart stdin deadlocks and clear stale restart exit code #407

Manually merged
github merged 3 commits from github-bot/gh-407 into gh-pr/407/base 2026-12-03 19:53:11 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-03 19:20 UTC · original
Androtim:fix/silent-restart-headless-safety → main · +76 −14 · 2 files · 3 commits · merged 2026-12-03 19:50 UTC

Follow-up to #406 addressing both the [P0] and [P1] issues identified in the Gate 2 audit:

Summary

  1. [P0] Prevent invisible stdin deadlocks on headless CREATE_NO_WINDOW restarts:
    • Added interactive_console() (backed by pure testable is_interactive_console + GetConsoleWindow() on Windows) in apps/victory/src/play.rs and replaced all raw std::io::stdin().is_terminal() prompt gates (offer_dlss, offer_fsr, offer_mfg, check_shader_model, hold_window). Interactive prompts are now skipped when VICTORY_NO_CONSOLE=1, when GetConsoleWindow() is null (such as a CREATE_NO_WINDOW windowless console whose CONIN$ still reports is_terminal() == true), or when stdin is not a terminal.
    • Updated the headless branch of restart_command_line in crates/victory-gpu/src/host/menu.rs to pass -NonInteractive to powershell.exe and pipe $null | & '{play}' {args} so child processes receive closed/EOF stdin instead of CONIN$.
  2. [P1] Clear stale VICTORY_RESTART_EXIT_CODE across self-spawned PowerShell restarts:
    • Prepended Remove-Item Env:VICTORY_RESTART_EXIT_CODE -ErrorAction SilentlyContinue; in both console and headless branches of restart_command_line so that after a preload == true self-restart (where the original parent launcher saw exit code 0 and stopped supervising), subsequent restarts in the child session self-relaunch instead of exiting with the stale code into an unsupervised PowerShell host.

Verification

  • cargo test -p victory-gpu --lib host::menu — 8 passed
  • cargo test -p victory — 49 unit + 2 integration passed
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo xtask policy — asset policy: 354 files ok
**@⁠Androtim** on GitHub · 2026-12-03 19:20 UTC · [original](https://github.com/Androtim/MiniVI/pull/407) `Androtim:fix/silent-restart-headless-safety` → `main` · +76 −14 · 2 files · 3 commits · merged 2026-12-03 19:50 UTC Follow-up to #406 addressing both the `[P0]` and `[P1]` issues identified in the Gate 2 audit: ### Summary 1. **`[P0]` Prevent invisible stdin deadlocks on headless `CREATE_NO_WINDOW` restarts:** - Added `interactive_console()` (backed by pure testable `is_interactive_console` + `GetConsoleWindow()` on Windows) in `apps/victory/src/play.rs` and replaced all raw `std::io::stdin().is_terminal()` prompt gates (`offer_dlss`, `offer_fsr`, `offer_mfg`, `check_shader_model`, `hold_window`). Interactive prompts are now skipped when `VICTORY_NO_CONSOLE=1`, when `GetConsoleWindow()` is null (such as a `CREATE_NO_WINDOW` windowless console whose `CONIN$` still reports `is_terminal() == true`), or when stdin is not a terminal. - Updated the headless branch of `restart_command_line` in `crates/victory-gpu/src/host/menu.rs` to pass `-NonInteractive` to `powershell.exe` and pipe `$null | & '{play}' {args}` so child processes receive closed/EOF stdin instead of `CONIN$`. 2. **`[P1]` Clear stale `VICTORY_RESTART_EXIT_CODE` across self-spawned PowerShell restarts:** - Prepended `Remove-Item Env:VICTORY_RESTART_EXIT_CODE -ErrorAction SilentlyContinue;` in both console and headless branches of `restart_command_line` so that after a `preload == true` self-restart (where the original parent launcher saw exit code `0` and stopped supervising), subsequent restarts in the child session self-relaunch instead of exiting with the stale code into an unsupervised PowerShell host. ### Verification - `cargo test -p victory-gpu --lib host::menu` — 8 passed - `cargo test -p victory` — 49 unit + 2 integration passed - `cargo clippy --workspace --all-targets -- -D warnings` — clean - `cargo xtask policy` — `asset policy: 354 files ok`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 19:24:25 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-03 19:32 UTC · original

Read-only full diff audit (4cd20c2d, apps/victory/src/play.rs + crates/victory-gpu/src/host/menu.rs, 100% title-neutral): VERIFIED CLEAN (0 P0/P1). Properly closes both #406 Gate 2 findings (interactive_console() via GetConsoleWindow() + VICTORY_NO_CONSOLE=1, -NonInteractive + $null | & stdin EOF, and clearing VICTORY_RESTART_EXIT_CODE on self-spawned PowerShell restarts) with zero GPU/shader surface touched. Queued for immediate squash-merge as soon as CI check completes green.

**@⁠Androtim** on GitHub · 2026-12-03 19:32 UTC · [original](https://github.com/Androtim/MiniVI/pull/407#issuecomment-7389858306) Read-only full diff audit (`4cd20c2d`, `apps/victory/src/play.rs` + `crates/victory-gpu/src/host/menu.rs`, 100% title-neutral): **VERIFIED CLEAN (0 P0/P1)**. Properly closes both `#406` Gate 2 findings (`interactive_console()` via `GetConsoleWindow()` + `VICTORY_NO_CONSOLE=1`, `-NonInteractive` + `$null | &` stdin EOF, and clearing `VICTORY_RESTART_EXIT_CODE` on self-spawned PowerShell restarts) with zero GPU/shader surface touched. Queued for immediate squash-merge as soon as CI `check` completes green.
github-bot changed target branch from main to gh-pr/407/base 2026-12-03 19:53:01 +00:00
github manually merged commit df3ff8fa1f into gh-pr/407/base 2026-12-03 19:53:11 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!407
No description provided.