Repository navigation
Hide the console window of zmx children spawned by the Windows shell - #640
Merged
Merged
Conversation
graphcode-windows.exe is a GUI-subsystem process, so every console-subsystem zmx.exe child it spawns without CREATE_NO_WINDOW gets a brand-new console. On hosts where Windows Terminal is the default console host, the zmx attach child opened a visible, empty window titled .\zmx.exe that stole foreground. Route the attach, resize, and kill children through ZmxSession.child, which keeps each child's existing stdio contract (attach pipes stdin and stdout) and always sets create_no_window. The resize child already set the flag; attach and kill did not. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens <coneilen@microsoft.com>
3 of 5 tasks
coneilen
added a commit
that referenced
this pull request
Oct 7, 2026
Record the immutable, unpublished 0.1.78-windows.beta12 candidate built from 1199de5 with the beta10 Dev Box fixes (#640-#643). Beta10 is failed/superseded and beta11 is unbuilt/superseded; both are kept unchanged. Exact artifact stays complete and the other six gates stay open. The parity count is updated to the ledger's current 98 surfaces: 60 Validated / 38 Partial. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens <coneilen@microsoft.com>
2 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Windows shell spawned
zmx.exe attach(a console-subsystem program) from the GUI-subsystemgraphcode-windows.exewithoutCREATE_NO_WINDOW, so Windows gave it a new console. On the beta10 Dev Box qualification (Windows 11, Windows Terminal as default console host) this opened a visible, empty window titled.\zmx.exethat stole foreground every time a loop's terminal attached. This PR makes every zmx child the shell spawns run without a console window.Changes
ZmxSession.child, which builds thestd.process.Childfor a zmx command, keeps each caller's existing stdio contract (attach: stdin/stdout piped, stderr ignored; control: all ignored), and always setscreate_no_window = true.TerminalSurface.Workspace.startSession(attach, the reported window) andpollResizeControl(resize, which already set the flag) now spawn through it. The stdinPIPE_NOWAITsetup and stdout reading are unchanged.WorkspaceTeardown.Live.killSessions(zmx kill, which could also pop a console during workspace deletion) now spawns through it.src\ZmxSession.zig(an already-registered root) and a static source contract inTools\windows\Tests\WindowsShell.Tests.ps1requiring the three zmx spawn sites to go throughZmxSession.child.Audit of the other child spawns in
graphcode-windows\src:DaemonSupervisoralready usesCREATE_NO_WINDOW;WorktreeStatusgit children already setcreate_no_window;App.zigCreateProcessWcalls relaunch the GUI shell itself;App.zigChild.runcalls are test fixtures. Left out of scope because they are not zmx/terminal work:Codespaces.capture(gh),WindowsRepositoryDialogsclone (git) and SSH validation (ssh), andWindowsUpdateInstall.runPowerShell(powershell.exe). They are console programs started withoutcreate_no_windowand may show a console window the same way; that should be a separate change.Test plan
RED: zig 0.15.2 test src\ZmxSession.zig (helper routed through, flag not yet set) -> 1 passed; 0 skipped; 1 failed. "zmx children keep their stdio contract and never open a console window...expected true, found false" at ZmxSession.zig:47 (attach.create_no_window)
GREEN: zig 0.15.2 test src\ZmxSession.zig -> All 2 tests passed.
REGRESSION: zig 0.15.2 test src\TerminalSurface.zig with the WindowsShell.Tests.ps1 target, link and include flags -> All 141 tests passed; zig 0.15.2 test src\WorkspaceTeardown.zig with its WindowsShell.Tests.ps1 flags -> All 229 tests passed
Additional evidence, exactly as run:
WindowsShell.Tests.ps1static contracts only (Zig removed fromPATH, so the script stops atResolve-TestZig, which follows every static contract) failed withWindows shell contract: zmx children must be created without a console window. After the change the same run passes every static contract and stops atA working Zig executable is required for executable Windows shell tests.startSession,pollResizeControl, orkillSessions, so Zig's lazy analysis does not compile them in the runs above. I verified this with a deliberate invalid enum tag at theTerminalSurface.zigcall sites, which the normalTerminalSurface.zigruns (with and without-fno-emit-bin) accepted. With a temporary, uncommittedtestblock that references those functions, the invalid tags were rejected atTerminalSurface.zig:1567,:1703andWorkspaceTeardown.zig:345. With the real tags,WorkspaceTeardown.zigpassed andTerminalSurface.zigcompiled and failed only at link (lld-link: undefined symbol: winghostty_..., because the scratch reference pulls in Winghostty host symbols the section does not link). That is compile-level evidence only.TerminalSurface.zigrun linkedghostty-vt-static.libfrom another local worktree built at the same Winghostty pin (6286560d), copied read-only into a scratch directory. I did not runzig build prepare-terminal-vt.Limits: no live window observation was made, and GraphCode is not installed on this machine. This PR does not show that the
.\zmx.exewindow no longer appears on a Dev Box, or thatzmx attach --sizebehaves the same at runtime without a console. That needs a re-run of the Dev Box qualification. The full shell build (zig build),validate.ps1 -Task windows-shell, and the otherWindowsShell.Tests.ps1sections were not run locally and are left to CI.Checklist
git commit -s) per the DCOmake test): not run. This is a Windows-only change andmake testis the macOS Xcode suite. The focused Zig runs above are the local evidence.make check): not run.make checklints Swift only, and this PR changes no Swift.