Skip to content

Find the packaged zmx beside the Windows daemon - #638

Merged
coneilen merged 1 commit into
mainfrom
coneilen-windows-zmx-locator-pr
Oct 6, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-windows-zmx-locator-pr

Conversation

@coneilen

@coneilen coneilen commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

The packaged Windows daemon could not find zmx. The package installs zmx.exe
beside graphcoded.exe under %LOCALAPPDATA%\GraphCode\current\bin, and nothing
copies it into the support directory. ZmxLocator looked only at
%USERPROFILE%\.graphcode\bin\zmx.exe, so isInstalled was false.

As a result, the daemon silently skipped every zmx operation:

  • loop launches failed with "zmx is not installed";
  • stop requests could not be delivered;
  • kills and the condemned-session reaper did nothing;
  • Stop wrote "its session could not be reached, so it was killed" to the memory
    log while the session kept running.

That is the beta9 Dev Box section 6A TerminalSessionOwnership failure, and it
matches beta8's "Stop left the Copilot process alive".

Changes

  • GraphcodeKit/Sources/Sessions/ZmxLocator.swift: on Windows, resolve zmx.exe in
    the running executable's directory first, then fall back to the support bin. When
    neither exists, the support path is still reported, so isInstalled stays false.
    The pure helpers candidates(...) and resolve(...) compile on every platform.
    macOS keeps ~/.graphcode/bin/zmx exactly.
  • windows-tests/WindowsDaemonTests.swift: Windows XCTest for sibling-first order,
    the support-bin fallback, the neither-present case, and a missing executable
    directory.
  • graphcode/Tests/SupportDirectoryTests.swift: a macOS Swift Testing check of the
    same resolver, which also asserts that macOS binaryURL is still the support bin.

Test plan

Windows, pinned Swift 6.3.3 (process-local SDKROOT/PATH as in
Tools/windows/validate.ps1):

RED: swift-test --package-path . --filter WindowsDaemonTests.testZmxLocator -> 1 of 3 failed, candidates returned only C:/Users/u/.graphcode/bin/zmx.exe and the packaged sibling was not preferred
GREEN: swift-test --package-path . --filter WindowsDaemonTests.testZmxLocator -> 3/3 passed
REGRESSION: swift-test --package-path . on Windows -> 103 XCTest and 6 Swift Testing tests passed, 0 failures

Also run:

  • swift-format lint --strict --configuration .swift-format on the three changed
    files -> exit 0.
  • swift-build --configuration release --product graphcoded and --product graphcode -> both built.
  • End-to-end in the packaged layout: graphcoded.exe, graphcode.exe and
    zmx.exe side by side, an isolated support directory with no bin\zmx.exe, a
    main loop with a live graphcode-UUID session, then graphcode node stop:
    • beta9 daemon (sha256 2eb05ba3…): memory log "could not be reached, so it
      was killed", but the session survived with the same PID. Fails the Dev Box
      Stop contract (Correct the Dev Box Stop qualification contract #637).
    • this branch's daemon (sha256 4a68a2a2…): memory log "asked to stop
      looping", the session kept its PID, and zmx history showed
      [graphcode] Stop requested from the graph in that session only. Passes the
      Stop contract.
  • macOS: the maintainer ran the branch on a Mac and reported the macOS tests
    passed. Exact counts were not supplied here.

Not run: the Windows shell/UIA live gates and packaging validation (no shell
code changed), and a fresh packaged Dev Box run. That requalification needs a new
candidate.

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test) — reported passing on macOS by the maintainer
  • Code follows the existing style (make check) — swift-format strict passed on Windows; SwiftLint result not separately reported
  • I added the test/contract before the implementation and observed the intended RED failure

The Windows package installs zmx.exe beside graphcoded.exe and never copies it into the support directory, so ZmxLocator (support bin only) reported zmx as missing. The packaged daemon then could not launch, message or kill any loop session, and Stop logged a kill that never happened (beta9 Dev Box).

On Windows, prefer zmx.exe in the running executable's directory, then fall back to the support bin. macOS keeps resolving the support bin unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen force-pushed the coneilen-windows-zmx-locator-pr branch from c8cb157 to 5ea8dfc Compare October 6, 2026 06:56
@coneilen
coneilen merged commit 1ae1c25 into main Oct 6, 2026
24 checks passed
coneilen added a commit that referenced this pull request Oct 6, 2026
Record the immutable, unpublished 0.1.78-windows.beta10 candidate built from
1ae1c25 with #638's packaged zmx discovery fix and #637's corrected Stop
contract. Beta9 is failed/superseded and kept unchanged. Exact artifact stays
complete; the other six gates and the 98/62/36 parity ledger are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen coneilen mentioned this pull request Oct 6, 2026
2 of 5 tasks
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