Skip to content

startup: close the rendered session from the output window - #2344

Open
SuperCraft3M wants to merge 1 commit into
R0Y00:mainfrom
SuperCraft3M:codex/startup-output-window
Open

SuperCraft3M wants to merge 1 commit into
R0Y00:mainfrom
SuperCraft3M:codex/startup-output-window

Conversation

@SuperCraft3M

@SuperCraft3M SuperCraft3M commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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).

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@KelboLive

Copy link
Copy Markdown
Contributor

APPROVED. Closes rendered session from the output window.

@SuperCraft3M
SuperCraft3M force-pushed the codex/startup-output-window branch from 5633a0d to 0465ba6 Compare November 25, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants