Skip to content

Resolve zmx against the shell's directory so beta18 loop opens, New Tab, and splits attach - #667

Merged
coneilen merged 1 commit into
mainfrom
coneilen-fix-beta18-loop-terminal-open
Oct 9, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-fix-beta18-loop-terminal-open

Conversation

@coneilen

@coneilen coneilen commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

On the installed 0.1.78-windows.beta18 shell, every sidebar loop open, native New Tab, and Split Right failed (Unable to open selected loop, Unable to create tab, empty pane, no zmx attach child). #663 began starting each zmx attach in the loop's worktree or project folder, but the installed shell names zmx bare (zmx.exe, no GRAPHCODE_ZMX) and found it only through its own working directory, the install bin. Windows child creation resolves a relative program against the child's working directory and then PATH, and on the Dev Box the shell's inherited PATH does not name the install, so every attach failed with FileNotFound. This PR resolves zmx against the shell's directory before spawning.

Changes

  • TerminalSurface.zig: zmxExecutable() resolves a relative configured zmx name (by default zmx.exe) to an absolute path against the shell's working directory, once, before the attach spawns in the loop's folder. An absolute GRAPHCODE_ZMX is used unchanged; a name the shell's directory does not hold is still left to PATH. The listing and resize children already started in the shell's directory, so for them the resolved path changes nothing.
  • App.zig live terminal fixture: zmx is now the bare name zmx.cmd in the fixture's bin (the shell's working directory) instead of an absolute path. All four native-linked live tests now cover the installed layout.
  • New native-linked App test with real winghostty surfaces: a sidebar click on a fresh loop (the daemon starts the session after the click) and on a loop with a live session each attach a visible terminal in the workspace. A native New Tab then starts its shell in the loop's worktree, and Split Right adds a second visible terminal.
  • New TerminalSurface.zig unit test for the resolution rules.
  • investigation/ui-parity-matrix.md: the Tab pills row records the beta18 finding and the fix. It stays Partial.

Root cause, as reproduced: the shell's PEB showed cwd ...\GraphCode\current\bin, and its PATH (inherited from the harness pwsh) did not contain that directory. With a diagnostic build launched under the same PATH, both actions logged a spawn failure FileNotFound with zmx=zmx.exe dir=(loop folder) cwd=.. With the install on PATH, the same build opened the loop. Winghostty surface creation and the #663 visibility and focus changes were not involved.

Why CI missed it: every live fixture and gate passes an absolute zmx path. The App fixture used root\zmx.cmd, and uia-live-gate.ps1, terminal-gate.ps1, and windows-shell.ps1 set GRAPHCODE_ZMX to the provider's absolute zmx.exe. So the attach child's working directory never affected program lookup. The App fixture now uses the installed bare-name layout. The PowerShell live gates still set GRAPHCODE_ZMX; running the packaged shell without it, from its bin with a PATH that omits the install, is left as a follow-up for the gates.

Test plan

All runs used the pinned Zig 0.15.2 and Winghostty 6286560d, with -target x86_64-windows-msvc and the full App link line from Tools\windows\Tests\WindowsShell.Tests.ps1, run from graphcode-windows.

RED: zig test src\App.zig (App link line) --test-filter "workspace surface:" -> 1 passed; 4 failed: all four live loop tests TestTimedOut with status "Unable to open selected loop" (fixture using the installed bare zmx name, before the fix)
GREEN: zig test src\App.zig (App link line) --test-filter "workspace surface:" -> All 5 tests passed
REGRESSION: zig test src\App.zig (full App link line, no filter) -> All 901 tests passed; zig test src\TerminalSurface.zig -target x86_64-windows-msvc -lc -luser32 -lgdi32 -ladvapi32 -> All 166 tests passed

Limits:

  • The RED run fails at the loop open, so in that run New Tab and Split Right are not reached. Their failure is the same startSession spawn, and I reproduced it with a diagnostic build (FileNotFound on New Tab), but not in this PR's test before the fix.
  • No Dev Box rerun of the installed package with this fix has been done, and the live UIA gates were not run locally.
  • zig fmt --check reports these two files on main as well; that is pre-existing, and this PR does not change it.

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test) (macOS target; not run, since this is a Windows shell change, and the Windows tests above were run instead)
  • Code follows the existing style (make check) (macOS Swift lint; not applicable, no Swift changed)
  • I added the test/contract before the implementation and observed the intended RED failure

…s folder

#663 started each zmx attach in the loop's worktree or project folder. The
installed shell names zmx bare (zmx.exe) and found it only through its own
working directory (the install bin), and a child resolves a relative program
against its own working directory and then PATH. On a Dev Box whose PATH does
not name the install, every sidebar loop open, New Tab, and split failed with
FileNotFound (Unable to open selected loop / Unable to create tab).

Resolve the configured zmx name against the shell's directory once before the
attach spawns, and make the live App terminal fixture use the installed
bare-name layout so the gap that hid this is covered.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen merged commit f215738 into main Oct 9, 2026
24 checks passed
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.

1 participant