startup: close the rendered session from the output window #2336

Open
SuperCraft3M wants to merge 2 commits from upstream-pr/2344 into main
SuperCraft3M commented 2026-11-25 13:03:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SuperCraft3M on 2026-11-25T13:03:21Z.


Change

Closing the output window of a rendered run.ps1 session signals its debugger. The debugger owns the Windows job, terminates the child and verifies that the process handle becomes signaled before returning. Minimize keeps the session active. In a direct shim host, Close hides the output and the host remains active.

The source-built presenter exercises minimize, restore and Close in both modes. The managed probe requires a debugger return and a zero child exit. The direct probe verifies that the window is hidden and the host can continue issuing presents.

Verification

Changes at 0465ba6d on 18f2f85c. Release, MSVC 19.44.35230, Windows 11 build 26300.9711. Hardware used an NVIDIA RTX 4070 with driver 32.0.16.2114. The D3D12 debug layer was unavailable.

cmake --build --preset release --target startup_present_producer --parallel 3
ctest --preset release --no-tests=error -R '^(startup_output_window_close|startup_present_producer_(warp|hardware)|startup_run_ps1)$' --output-on-failure

4 passed, 0 failed, 0 skipped. The launcher check ran on Windows PowerShell 5.1 and PowerShell 7.

AI-assisted (Codex).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5491857313 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344). Originally posted by [SuperCraft3M](https://github.com/SuperCraft3M) on 2026-11-25T13:03:21Z. --- ## Change Closing the output window of a rendered `run.ps1` session signals its debugger. The debugger owns the Windows job, terminates the child and verifies that the process handle becomes signaled before returning. Minimize keeps the session active. In a direct shim host, Close hides the output and the host remains active. The source-built presenter exercises minimize, restore and Close in both modes. The managed probe requires a debugger return and a zero child exit. The direct probe verifies that the window is hidden and the host can continue issuing presents. ## Verification Changes at `0465ba6d` on `18f2f85c`. Release, MSVC 19.44.35230, Windows 11 build 26300.9711. Hardware used an NVIDIA RTX 4070 with driver 32.0.16.2114. The D3D12 debug layer was unavailable. ```powershell cmake --build --preset release --target startup_present_producer --parallel 3 ctest --preset release --no-tests=error -R '^(startup_output_window_close|startup_present_producer_(warp|hardware)|startup_run_ps1)$' --output-on-failure ``` 4 passed, 0 failed, 0 skipped. The launcher check ran on Windows PowerShell 5.1 and PowerShell 7. AI-assisted (Codex).
tedin7 commented 2026-11-25 13:05:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:05:47Z.

Review: COMMENTED


Review of head 5633a0d3f2b75f32ffcfb7a536d502d0f05fe9f5 (Linux host; no PowerShell, no Windows).

Commands executed locally (in a worktree of the PR head):

git diff --stat origin/main...HEAD            -> 6 files, +84/-10
python3 tests/docs_links_check.py             -> Checked 19 Markdown files and 453 links
python3 tests/bidi_controls_check.py          -> no bidirectional controls
git diff --check origin/main...HEAD           -> clean
python3 tests/startup_run_ps1_check.py        -> "text only: not a Windows host" (0 failed)

CI at review time: Windows and Linux jobs still pending. The PR is mergeable.

Findings: P1=0, P2=0.

Read-through:

  • run.ps1: -not $env:X2W_HIDE_TITLE_WINDOW treats the string "0" as set (non-empty string is truthy), so an explicit 0 still opts out. The new test case with -Render -LiveConsole and hide_env="0" covers that. --console 0 matches debug_launch.py (opts.get("--console", "1") == "1").
  • d3d12_present.inl: WM_CLOSE now calls ExitProcess(0) after logging. Minimize is unaffected because it goes through WM_SYSCOMMAND. Nit: the exit skips any flush of the shader cache or logs, which the PR text already says is intended.
  • startup_present_producer.cpp (window-close): the fixture finds the output window by class and PID, checks that the guest window is hidden, then minimize, restore and SC_CLOSE. Reaching the 5 s sleep and returning 19 means the process did not exit, so the test fails closed. startup_output_window_close runs with the new CMake line, which links user32 and adds the src include path.
  • startup_run_ps1_check.py: the expectations (--console 0 unless -LiveConsole, and the inherited env value) match run.ps1.

Nits:

  • The -Translate path only gets the --console 0 and hide default through $Render. That is correct, since -Translate needs -Render. The test's rendering = translate or ... is a slightly looser model than the script, but it is harmless.

Not done:

  • No mutation run. The launcher test needs PowerShell and the close probe needs Windows, and neither is available on this host. The claimed Win2025 results in the PR body were not re-run here.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058143172 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#pullrequestreview-6058143172). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:05:47Z. **Review:** COMMENTED --- Review of head `5633a0d3f2b75f32ffcfb7a536d502d0f05fe9f5` (Linux host; no PowerShell, no Windows). Commands executed locally (in a worktree of the PR head): ``` git diff --stat origin/main...HEAD -> 6 files, +84/-10 python3 tests/docs_links_check.py -> Checked 19 Markdown files and 453 links python3 tests/bidi_controls_check.py -> no bidirectional controls git diff --check origin/main...HEAD -> clean python3 tests/startup_run_ps1_check.py -> "text only: not a Windows host" (0 failed) ``` CI at review time: Windows and Linux jobs still pending. The PR is mergeable. Findings: P1=0, P2=0. Read-through: - `run.ps1`: `-not $env:X2W_HIDE_TITLE_WINDOW` treats the string "0" as set (non-empty string is truthy), so an explicit `0` still opts out. The new test case with `-Render -LiveConsole` and `hide_env="0"` covers that. `--console 0` matches `debug_launch.py` (`opts.get("--console", "1") == "1"`). - `d3d12_present.inl`: `WM_CLOSE` now calls `ExitProcess(0)` after logging. Minimize is unaffected because it goes through `WM_SYSCOMMAND`. Nit: the exit skips any flush of the shader cache or logs, which the PR text already says is intended. - `startup_present_producer.cpp` (`window-close`): the fixture finds the output window by class and PID, checks that the guest window is hidden, then minimize, restore and `SC_CLOSE`. Reaching the 5 s sleep and returning 19 means the process did not exit, so the test fails closed. `startup_output_window_close` runs with the new CMake line, which links `user32` and adds the `src` include path. - `startup_run_ps1_check.py`: the expectations (`--console 0` unless `-LiveConsole`, and the inherited env value) match `run.ps1`. Nits: - The `-Translate` path only gets the `--console 0` and hide default through `$Render`. That is correct, since `-Translate` needs `-Render`. The test's `rendering = translate or ...` is a slightly looser model than the script, but it is harmless. Not done: - No mutation run. The launcher test needs PowerShell and the close probe needs Windows, and neither is available on this host. The claimed Win2025 results in the PR body were not re-run here. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-25 13:16:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T13:16:18Z.

Review: CHANGES_REQUESTED


The presenter is inside the shared D3D12 shim. WM_CLOSE currently calls ExitProcess in every host that creates that window, including hosts launched without run.ps1. That also runs DLL detach after stopping the other threads, which can hang if a stopped thread holds a lock needed by detach. Keep session shutdown owned by the launcher or an explicitly enabled session owner. In other hosts, closing the presenter should leave the host alive.

Please keep the existing minimize check and add both close cases: a managed source-built child whose process handle becomes signaled and whose launcher returns, and a direct shim host that stays alive on presenter close. The window visibility and live-console change can proceed independently if you want to land that first. Microsoft ExitProcess documentation

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058298588 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#pullrequestreview-6058298588). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T13:16:18Z. **Review:** CHANGES_REQUESTED --- The presenter is inside the shared D3D12 shim. WM_CLOSE currently calls ExitProcess in every host that creates that window, including hosts launched without run.ps1. That also runs DLL detach after stopping the other threads, which can hang if a stopped thread holds a lock needed by detach. Keep session shutdown owned by the launcher or an explicitly enabled session owner. In other hosts, closing the presenter should leave the host alive. Please keep the existing minimize check and add both close cases: a managed source-built child whose process handle becomes signaled and whose launcher returns, and a direct shim host that stays alive on presenter close. The window visibility and live-console change can proceed independently if you want to land that first. [Microsoft ExitProcess documentation](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess)
KelboLive commented 2026-11-25 17:01:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-25T16:06:44Z.


APPROVED. Closes rendered session from the output window.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167603534 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#issuecomment-7167603534). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-25T16:06:44Z. --- APPROVED. Closes rendered session from the output window.
pigalot commented 2026-11-28 01:01:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T01:01:24Z.


I merged main 38129ba3 into this branch as 44f14769 (a merge commit on top of 0465ba6d; no rebase and no force-push). It also merges cleanly with the current main 86beae95.

Conflicts and how I resolved them.

  • src/startup_stubs/d3d12_present.inl: I kept main's plane-surface present_to_window and added this branch's output_closed check to its early return:
    if (p.failed || !queue || !steps || !count || !plane_surfaces || InterlockedCompareExchange(&output_closed, 0, 0)) return false;
  • tests/startup_run_ps1_check.py: I kept this branch's --managed-window expectation and main's longer debugger record. main's native-shader case also runs with -Render, so the condition is now if "-Render" in switches or translate or native:.
  • tools/startup/debug_launch.py: I kept main's grab_window/capture_window split and capture-thread shutdown. The final capture keeps this branch's condition, if exit_code is None and not window_close:.
  • tools/startup/run.ps1: both argument lists are passed, @traceArgs @captureArgs @windowArgs.

What I ran. I built the whole tree in dev and release, then ran (under the shared GPU lock, -j 1):

ctest --test-dir out/build/<preset> --no-tests=error -j 1 --output-on-failure -R '^(startup_output_window_close|startup_present.*|startup_plane.*|startup_debug.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$'
  • 35 of 36 pass in Debug and in Release /O2.
  • startup_run_sh reports a capability skip (77), as on every Windows host.
  • startup_run_ps1 failed on my first resolution of its check, because an assignment was mis-indented. I fixed that before committing. On 44f14769 it reports 0 failed with both powershell and pwsh.
  • git diff --check origin/main...HEAD is clean.

This needs a review from someone other than me before it can be merged.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7231361963 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#issuecomment-7231361963). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T01:01:24Z. --- I merged `main` `38129ba3` into this branch as `44f14769` (a merge commit on top of `0465ba6d`; no rebase and no force-push). It also merges cleanly with the current `main` `86beae95`. **Conflicts and how I resolved them.** - `src/startup_stubs/d3d12_present.inl`: I kept `main`'s plane-surface `present_to_window` and added this branch's `output_closed` check to its early return: `if (p.failed || !queue || !steps || !count || !plane_surfaces || InterlockedCompareExchange(&output_closed, 0, 0)) return false;` - `tests/startup_run_ps1_check.py`: I kept this branch's `--managed-window` expectation and `main`'s longer debugger record. `main`'s native-shader case also runs with `-Render`, so the condition is now `if "-Render" in switches or translate or native:`. - `tools/startup/debug_launch.py`: I kept `main`'s `grab_window`/`capture_window` split and capture-thread shutdown. The final capture keeps this branch's condition, `if exit_code is None and not window_close:`. - `tools/startup/run.ps1`: both argument lists are passed, `@traceArgs @captureArgs @windowArgs`. **What I ran.** I built the whole tree in `dev` and `release`, then ran (under the shared GPU lock, `-j 1`): ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 1 --output-on-failure -R '^(startup_output_window_close|startup_present.*|startup_plane.*|startup_debug.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$' ``` - 35 of 36 pass in Debug and in Release `/O2`. - `startup_run_sh` reports a capability skip (77), as on every Windows host. - `startup_run_ps1` failed on my first resolution of its check, because an assignment was mis-indented. I fixed that before committing. On `44f14769` it reports `0 failed` with both `powershell` and `pwsh`. - `git diff --check origin/main...HEAD` is clean. This needs a review from someone other than me before it can be merged. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. This reply was AI-assisted.
pigalot commented 2026-11-28 02:31:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T02:31:24Z.

Review: APPROVED


Reviewed 44f14769 (0465ba6d plus a merge of main) trial-merged over current main 7364e6a9. The merge is clean and git diff --cached --check is clean.

R0Y00's request on 5633a0d3. 0465ba6d answers all three points:

  • The shared presenter no longer ends the process. WM_CLOSE calls neither ExitProcess nor ShowWindow(SW_MINIMIZE). If X2W_SESSION_CLOSE_EVENT names an event it can open and set, it returns, and the launcher ends the run. Otherwise it hides the output window, stops the hide-title timer, shows any hidden title windows again, and sets output_closed so present_to_window refuses from then on. The host keeps running.
  • The launcher owns the session's end. debug_launch.py --managed-window 1 creates a random Local\X2W-session-close-<uuid> event and passes its name only to its child; an inherited value is dropped first. When the event is set, the launcher calls TerminateJobObject(job, 0), which skips the DLL detach R0Y00 pointed at. It then keeps reading debug events for up to 10 s, until EXIT_PROCESS. It returns 2 if the process handle hasn't signalled within 2 s.
  • run.ps1 passes --managed-window 1 only with -Render. -Translate and -NativeShaders both need -Render.
  • Tests: both close cases now have one. window-close in startup_present_producer minimizes, restores and closes the window, then checks the direct host survives and the managed child is ended. The existing minimize check is kept.

The merge of main (44f14769, three files):

  • d3d12_present.inl: present_to_window keeps main's plane-steps signature and adds the output_closed check. That's right.
  • startup_run_ps1_check.py: the condition becomes "-Render" in switches or translate or native. The or native part is needed: the native case passes -Render -NativeShaders inside run_case, not through switches. The tuple keeps main's fields.
  • debug_launch.py: main moved capture_window out of this spot. The merge keeps main's version and adds this PR's and not window_close guard.

What I ran. I did a full build in dev and release, then ran

ctest --test-dir out/build/<preset> --no-tests=error -j 4 -E '(_hardware$|startup_audio_)' -R '^(startup_output_window_close|startup_present.*|startup_run_ps1|startup_debug.*|startup_title_window.*|startup_overlay.*|startup_hide.*)$'
# with X2W_TEST_DEBUG_LAYER=1, one at a time
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^startup_present.*_hardware$'
  • Without _hardware: 21 of 21 pass in each preset, including startup_output_window_close and startup_run_ps1.
  • _hardware: startup_present_producer_hardware and startup_present_view_hardware pass in each preset.
  • Full non-hardware suite (dev, -j 6 -E '(_hardware$|startup_audio_)'): 1977 of 1980 pass. The other three are startup_inflate, shader_sgd5_effects_cli_check and pixel_aot_comparisons_warp. All three timed out under load and pass when rerun alone with -j 1.

Mutants. For each, I rebuilt dev where needed and ran startup_output_window_close, startup_run_ps1 and startup_present_producer_warp:

Mutant Result
Close minimizes instead of hiding killed (startup_output_window_close)
launcher ignores the close event killed (startup_output_window_close)
event name not passed to the child killed (startup_output_window_close)
no grace wait after TerminateJobObject killed (no exit 0x00000000 in events.txt)
run.ps1 never passes --managed-window killed (startup_run_ps1)
present_to_window ignores output_closed survives
direct Close doesn't show the title windows again (title_hider.step removed) survives
hide-title timer kept after Close survives
launcher returns 0 when the child doesn't signal exit survives
an inherited X2W_SESSION_CLOSE_EVENT not dropped survives (the test drops it itself)

Restored and rebuilt afterwards; git diff --quiet is clean.

Non-blocking.

  1. After Close, a direct host goes down the "not shown" path. present_to_window refuses, so shown_in_window is false. The title windows the hider hid come back, and every sixth frame does read_back_presented and draw_overlay into them. That's a reasonable way to keep a direct host visible, but no test pins it, and the docs line says only "Close hides the output". A direct-mode check that a present after Close doesn't reach the output window, and that a hidden title window is shown again, would pin the first two survivors.
  2. The launcher's "process did not signal exit" path (return 2) is unpinned. It can't be reached with the current child. A note in the PR text that it's only a safeguard would be enough.
  3. startup_output_window_close sets SKIP_RETURN_CODE 77, but nothing in it returns 77. That's harmless, but it may mislead a reader.

Verdict: approve on 44f14769. R0Y00's changes request on 5633a0d3 still stands, so this needs R0Y00's re-review before it can merge.

Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; D3D12 WARP; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; debug layer on for the hardware runs.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 44f14769.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6095201543 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#pullrequestreview-6095201543). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T02:31:24Z. **Review:** APPROVED --- Reviewed `44f14769` (`0465ba6d` plus a merge of `main`) trial-merged over current `main` `7364e6a9`. The merge is clean and `git diff --cached --check` is clean. **R0Y00's request on `5633a0d3`.** `0465ba6d` answers all three points: - **The shared presenter no longer ends the process.** `WM_CLOSE` calls neither `ExitProcess` nor `ShowWindow(SW_MINIMIZE)`. If `X2W_SESSION_CLOSE_EVENT` names an event it can open and set, it returns, and the launcher ends the run. Otherwise it hides the output window, stops the hide-title timer, shows any hidden title windows again, and sets `output_closed` so `present_to_window` refuses from then on. The host keeps running. - **The launcher owns the session's end.** `debug_launch.py --managed-window 1` creates a random `Local\X2W-session-close-<uuid>` event and passes its name only to its child; an inherited value is dropped first. When the event is set, the launcher calls `TerminateJobObject(job, 0)`, which skips the DLL detach R0Y00 pointed at. It then keeps reading debug events for up to 10 s, until `EXIT_PROCESS`. It returns 2 if the process handle hasn't signalled within 2 s. - **`run.ps1` passes `--managed-window 1` only with `-Render`.** `-Translate` and `-NativeShaders` both need `-Render`. - **Tests:** both close cases now have one. `window-close` in `startup_present_producer` minimizes, restores and closes the window, then checks the direct host survives and the managed child is ended. The existing minimize check is kept. **The merge of `main`** (`44f14769`, three files): - `d3d12_present.inl`: `present_to_window` keeps `main`'s plane-steps signature and adds the `output_closed` check. That's right. - `startup_run_ps1_check.py`: the condition becomes `"-Render" in switches or translate or native`. The `or native` part is needed: the native case passes `-Render -NativeShaders` inside `run_case`, not through `switches`. The tuple keeps `main`'s fields. - `debug_launch.py`: `main` moved `capture_window` out of this spot. The merge keeps `main`'s version and adds this PR's `and not window_close` guard. **What I ran.** I did a full build in `dev` and `release`, then ran ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 4 -E '(_hardware$|startup_audio_)' -R '^(startup_output_window_close|startup_present.*|startup_run_ps1|startup_debug.*|startup_title_window.*|startup_overlay.*|startup_hide.*)$' # with X2W_TEST_DEBUG_LAYER=1, one at a time ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^startup_present.*_hardware$' ``` - **Without `_hardware`:** 21 of 21 pass in each preset, including `startup_output_window_close` and `startup_run_ps1`. - **`_hardware`:** `startup_present_producer_hardware` and `startup_present_view_hardware` pass in each preset. - **Full non-hardware suite** (`dev`, `-j 6 -E '(_hardware$|startup_audio_)'`): 1977 of 1980 pass. The other three are `startup_inflate`, `shader_sgd5_effects_cli_check` and `pixel_aot_comparisons_warp`. All three timed out under load and pass when rerun alone with `-j 1`. **Mutants.** For each, I rebuilt `dev` where needed and ran `startup_output_window_close`, `startup_run_ps1` and `startup_present_producer_warp`: | Mutant | Result | |---|---| | Close minimizes instead of hiding | killed (`startup_output_window_close`) | | launcher ignores the close event | killed (`startup_output_window_close`) | | event name not passed to the child | killed (`startup_output_window_close`) | | no grace wait after `TerminateJobObject` | killed (no `exit 0x00000000` in `events.txt`) | | `run.ps1` never passes `--managed-window` | killed (`startup_run_ps1`) | | `present_to_window` ignores `output_closed` | **survives** | | direct Close doesn't show the title windows again (`title_hider.step` removed) | **survives** | | hide-title timer kept after Close | **survives** | | launcher returns 0 when the child doesn't signal exit | **survives** | | an inherited `X2W_SESSION_CLOSE_EVENT` not dropped | **survives** (the test drops it itself) | Restored and rebuilt afterwards; `git diff --quiet` is clean. **Non-blocking.** 1. **After Close, a direct host goes down the "not shown" path.** `present_to_window` refuses, so `shown_in_window` is false. The title windows the hider hid come back, and every sixth frame does `read_back_presented` and `draw_overlay` into them. That's a reasonable way to keep a direct host visible, but no test pins it, and the docs line says only "Close hides the output". A direct-mode check that a present after Close doesn't reach the output window, and that a hidden title window is shown again, would pin the first two survivors. 2. **The launcher's "process did not signal exit" path (return 2) is unpinned.** It can't be reached with the current child. A note in the PR text that it's only a safeguard would be enough. 3. **`startup_output_window_close` sets `SKIP_RETURN_CODE 77`, but nothing in it returns 77.** That's harmless, but it may mislead a reader. **Verdict:** approve on `44f14769`. R0Y00's changes request on `5633a0d3` still stands, so this needs R0Y00's re-review before it can merge. Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; D3D12 WARP; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; debug layer on for the hardware runs. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `44f14769`. This reply was AI-assisted.
R0Y00 commented 2026-11-28 02:50:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T02:50:01Z.


I verified the earlier close handling feedback with 44f14769 integrated over main 4d7265c0 (local tree b4db0b8895ee06c4109f4c2b1ecffa9af90813f5). The only conflict is in tools/startup/run.ps1. Keep #2867's scoped Continue and script:debuggerExit capture, and append @windowArgs to the debugger call inside that scope. The existing -Render guard and managed-window argument stay.

Release /O2: all four checks passed with no skips. The synthetic managed presenter exits through the debugger, the direct presenter hides and keeps the host alive, and minimize/restore still works. The launcher fixture passed in Windows PowerShell 5.1 and PowerShell 7, including stderr status handling and the managed flag.

cmake --build <release-build> --target startup_present_producer d3d12_xs_shim
ctest --test-dir <release-build> --no-tests=error --output-on-failure -j 1 -R "^(startup_output_window_close|startup_present_producer_(warp|hardware))$"
python -B tests/startup_run_ps1_check.py

Windows 11 26200.9974, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. Please merge current main into this PR and retain both launcher behaviors. I can then recheck and update my earlier review on the published head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7232622880 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#issuecomment-7232622880). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-28T02:50:01Z. --- I verified the earlier close handling feedback with 44f14769 integrated over main 4d7265c0 (local tree b4db0b8895ee06c4109f4c2b1ecffa9af90813f5). The only conflict is in tools/startup/run.ps1. Keep #2867's scoped Continue and script:debuggerExit capture, and append @windowArgs to the debugger call inside that scope. The existing -Render guard and managed-window argument stay. Release /O2: all four checks passed with no skips. The synthetic managed presenter exits through the debugger, the direct presenter hides and keeps the host alive, and minimize/restore still works. The launcher fixture passed in Windows PowerShell 5.1 and PowerShell 7, including stderr status handling and the managed flag. ``` cmake --build <release-build> --target startup_present_producer d3d12_xs_shim ctest --test-dir <release-build> --no-tests=error --output-on-failure -j 1 -R "^(startup_output_window_close|startup_present_producer_(warp|hardware))$" python -B tests/startup_run_ps1_check.py ``` Windows 11 26200.9974, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. Please merge current main into this PR and retain both launcher behaviors. I can then recheck and update my earlier review on the published head.
JohnConnorNPC commented 2026-11-28 08:10:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T08:10:34Z.


Thanks for the close-handling rework. I reviewed head 44f14769 against current main (1f07b2c1). The code answers R0Y00's changes request on 5633a0d3 (grep -c ExitProcess src/startup_stubs/d3d12_present.inl → 0), but one thing still blocks the merge:

  1. Please merge current main and resolve tools/startup/run.ps1 as R0Y00 asked at 02:50Z. git merge-tree --write-tree 1f07b2c1 44f14769 exits 1 with CONFLICT (content): Merge conflict in tools/startup/run.ps1. Keep #2867's scoped & { $ErrorActionPreference = "Continue" ... $script:debuggerExit } block and append @windowArgs after @captureArgs inside it. Please merge rather than rebase. On a scratch resolution done that way, startup_run_ps1_check.py (text-only on Linux), docs_links_check.py and bidi_controls_check.py pass. R0Y00 then needs to re-review, because the changes request still stands.

Also worth fixing:

  • CI runs none of the affected tests. The pr test preset's regex matches none of startup_output_window_close, startup_run_ps1 or startup_present_producer_warp, and grep -c startup_output_window_close on the Windows job log → 0. On Linux, a mutant that drops @windowArgs from run.ps1 still passes startup_run_ps1_check.py (0 failed (text only: not a Windows host)). That is the conflicted line, so please post Windows startup_run_ps1 (powershell and pwsh) and startup_output_window_close runs on the new head.
  • Nothing pins the direct-host case. Its last step, present(), is ok(call(queue, 32, ...)) && finish(), which observes the queue fence and not the window. That leaves three of pigalot's surviving mutants unpinned: present_to_window ignores output_closed, title_hider.step removed, and the hide-title timer kept. Asserting that the output window gets no new frame after Close, and that a hidden title window is shown again, would pin them.
  • Minor: the process did not signal exit path (return 2) can't be reached with the test child, so please say in a comment or the PR text that it is only a safeguard. SKIP_RETURN_CODE 77 is set, but the check never returns 77 (grep -c 77 → 0). --managed-window and X2W_SESSION_CLOSE_EVENT appear in neither debug_launch.py's docstring nor docs/ (0 and 0). Dropping an inherited X2W_SESSION_CLOSE_EVENT is pinned only by the test's own env.pop; a case that sets a stale name before launch would pin it.

Environment: Linux, static review of git objects, git merge-tree, a scratch merge (never pushed) and the CI job logs. I did no Windows, WARP or GPU run.

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7236412043 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#issuecomment-7236412043). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-28T08:10:34Z. --- Thanks for the close-handling rework. I reviewed head `44f14769` against current `main` (`1f07b2c1`). The code answers R0Y00's changes request on `5633a0d3` (`grep -c ExitProcess src/startup_stubs/d3d12_present.inl` → `0`), but one thing still blocks the merge: 1. **Please merge current `main` and resolve `tools/startup/run.ps1` as R0Y00 asked at 02:50Z.** `git merge-tree --write-tree 1f07b2c1 44f14769` exits 1 with `CONFLICT (content): Merge conflict in tools/startup/run.ps1`. Keep #2867's scoped `& { $ErrorActionPreference = "Continue" ... $script:debuggerExit }` block and append `@windowArgs` after `@captureArgs` inside it. Please merge rather than rebase. On a scratch resolution done that way, `startup_run_ps1_check.py` (text-only on Linux), `docs_links_check.py` and `bidi_controls_check.py` pass. R0Y00 then needs to re-review, because the changes request still stands. Also worth fixing: - CI runs none of the affected tests. The `pr` test preset's regex matches none of `startup_output_window_close`, `startup_run_ps1` or `startup_present_producer_warp`, and `grep -c startup_output_window_close` on the Windows job log → `0`. On Linux, a mutant that drops `@windowArgs` from `run.ps1` still passes `startup_run_ps1_check.py` (`0 failed (text only: not a Windows host)`). That is the conflicted line, so please post Windows `startup_run_ps1` (powershell and pwsh) and `startup_output_window_close` runs on the new head. - Nothing pins the direct-host case. Its last step, `present()`, is `ok(call(queue, 32, ...)) && finish()`, which observes the queue fence and not the window. That leaves three of pigalot's surviving mutants unpinned: `present_to_window` ignores `output_closed`, `title_hider.step` removed, and the hide-title timer kept. Asserting that the output window gets no new frame after Close, and that a hidden title window is shown again, would pin them. - Minor: the `process did not signal exit` path (return 2) can't be reached with the test child, so please say in a comment or the PR text that it is only a safeguard. `SKIP_RETURN_CODE 77` is set, but the check never returns 77 (`grep -c 77` → `0`). `--managed-window` and `X2W_SESSION_CLOSE_EVENT` appear in neither `debug_launch.py`'s docstring nor `docs/` (`0` and `0`). Dropping an inherited `X2W_SESSION_CLOSE_EVENT` is pinned only by the test's own `env.pop`; a case that sets a stale name before launch would pin it. Environment: Linux, static review of git objects, `git merge-tree`, a scratch merge (never pushed) and the CI job logs. I did no Windows, WARP or GPU run. This comment was AI-assisted.
JohnConnorNPC commented 2026-11-29 13:11:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T13:11:04Z.


The head is still 44f14769, so my 11-28 comment stands and I haven't re-reviewed it in depth. Since then main has moved further, and the conflict has grown. Against main c04e0dd6, git merge-tree --write-tree c04e0dd6 44f14769 exits 1 in two files:

  • tools/startup/run.ps1, two hunks. First, keep main's $mapArgs setup (#1251) and add your $windowArgs lines after it. Second, keep main's scoped & { $ErrorActionPreference = "Continue" ... $script:debuggerExit = $LASTEXITCODE } *> "$LogDir.out" block, with --assert-sites $AssertSites @mapArgs @traceArgs @captureArgs @holdArgs (#2867, #2916 and the hook-thread hold), and append @windowArgs to it.
  • tests/startup_run_ps1_check.py, one hunk. Keep main's native_default = (native or "-Render" in switches) and not translate line from #3449, and add your --managed-window 1 expectation after it. expected still uses native_default on both sides.

Since #3449, -Render runs default to native shaders. Your --managed-window 1 sits under -Render too, so every default rendered launcher run gets the managed close. Please rebase (or merge main, as R0Y00 asked). Then post Windows startup_run_ps1 (powershell and pwsh) and startup_output_window_close runs on the new head, and R0Y00 can re-review.

Environment: Linux only: git objects and git merge-tree. I did no Windows run.

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256349826 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#issuecomment-7256349826). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-29T13:11:04Z. --- The head is still `44f14769`, so my 11-28 comment stands and I haven't re-reviewed it in depth. Since then `main` has moved further, and the conflict has grown. Against `main` `c04e0dd6`, `git merge-tree --write-tree c04e0dd6 44f14769` exits 1 in two files: - **`tools/startup/run.ps1`, two hunks.** First, keep `main`'s `$mapArgs` setup (#1251) and add your `$windowArgs` lines after it. Second, keep `main`'s scoped `& { $ErrorActionPreference = "Continue" ... $script:debuggerExit = $LASTEXITCODE } *> "$LogDir.out"` block, with `--assert-sites $AssertSites @mapArgs @traceArgs @captureArgs @holdArgs` (#2867, #2916 and the hook-thread hold), and append `@windowArgs` to it. - **`tests/startup_run_ps1_check.py`, one hunk.** Keep `main`'s `native_default = (native or "-Render" in switches) and not translate` line from #3449, and add your `--managed-window 1` expectation after it. `expected` still uses `native_default` on both sides. Since #3449, `-Render` runs default to native shaders. Your `--managed-window 1` sits under `-Render` too, so every default rendered launcher run gets the managed close. Please rebase (or merge `main`, as R0Y00 asked). Then post Windows `startup_run_ps1` (powershell and pwsh) and `startup_output_window_close` runs on the new head, and R0Y00 can re-review. Environment: Linux only: git objects and `git merge-tree`. I did no Windows run. This comment was AI-assisted.
R0Y00 commented 2026-12-03 09:35:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T09:35:56Z.


I trial-merged 44f14769 over main d2e6a4ed and tested the four-file conflict resolution locally. In present_to_window, keep the current failed-present diagnostic and return separately when output_closed is set. In the producer fixture, retain both main's color readback flags and the new close_test flag. In the launcher, keep mapArgs, holdArgs and the PowerShell 5.1 stderr scope, then append windowArgs to the same invocation. In the launcher fixture, keep native_default and the managed-window argument assertion.

MSVC Debug on Windows build 26300, inbox WARP, debug layer enabled: ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^(startup_output_window_close|startup_present_producer_warp|startup_run_ps1)$' passed 3/3 without skips. The launcher self-test exercised both powershell and pwsh.

I also exercised the inherited-event control raised on #3342. Start debug_launch.py without --managed-window, set X2W_SESSION_CLOSE_EVENT to a real initially unsignaled parent event, and let the existing producer fixture minimize, restore and close. With the merged code the child exited 0 and the event stayed unsignaled. Removing env.pop("X2W_SESSION_CLOSE_EVENT", None) made the child exit 21 and signal that event. Please include that unmanaged case when updating this original branch. #3342 carries the same implementation, so the runtime review can stay here.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7373918563 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2344#issuecomment-7373918563). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T09:35:56Z. --- I trial-merged 44f14769 over main d2e6a4ed and tested the four-file conflict resolution locally. In present_to_window, keep the current failed-present diagnostic and return separately when output_closed is set. In the producer fixture, retain both main's color readback flags and the new close_test flag. In the launcher, keep mapArgs, holdArgs and the PowerShell 5.1 stderr scope, then append windowArgs to the same invocation. In the launcher fixture, keep native_default and the managed-window argument assertion. MSVC Debug on Windows build 26300, inbox WARP, debug layer enabled: ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^(startup_output_window_close|startup_present_producer_warp|startup_run_ps1)$' passed 3/3 without skips. The launcher self-test exercised both powershell and pwsh. I also exercised the inherited-event control raised on #3342. Start debug_launch.py without --managed-window, set X2W_SESSION_CLOSE_EVENT to a real initially unsignaled parent event, and let the existing producer fixture minimize, restore and close. With the merged code the child exited 0 and the event stayed unsignaled. Removing env.pop("X2W_SESSION_CLOSE_EVENT", None) made the child exit 21 and signal that event. Please include that unmanaged case when updating this original branch. #3342 carries the same implementation, so the runtime review can stay here.
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/2344:upstream-pr/2344'
git switch 'upstream-pr/2344'

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/2344'
git switch 'upstream-pr/2344'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2344'
git switch 'upstream-pr/2344'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2344'
git switch 'main'
git merge --squash 'upstream-pr/2344'
git switch 'main'
git merge --ff-only 'upstream-pr/2344'
git switch 'main'
git merge 'upstream-pr/2344'
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
R0Y00/Xbox2Windows!2336
No description provided.