Skip to content

cmux-tui: pass the zig target on a native windows-gnu host - #12416

Merged
teamleaderleo merged 2 commits into
manaflow-ai:mainfrom
Somuuuu007:cmux-tui-windows-gnu-zig-target
Sep 27, 2026
Merged

teamleaderleo merged 2 commits into
manaflow-ai:mainfrom
Somuuuu007:cmux-tui-windows-gnu-zig-target

Conversation

@Somuuuu007

@Somuuuu007 Somuuuu007 commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

What's broken

ghostty-vt-sys/build.rs forwards -Dtarget to zig build only when the cargo target differs from the host:

if target != host
    && let Some(zig_target) = zig_target_for_rust_target(&target)

On a native x86_64-pc-windows-gnu toolchain the two match, so zig gets no target and falls back to its Windows default, the msvc ABI:

zig build-lib ... -target native-native-msvc ...
error: failed to find libc installation: WindowsSdkNotFound

A machine with no Visual Studio is exactly why its Rust host is windows-gnu to begin with, so the msvc fallback can never succeed. cargo build -p cmux-tui fails before any crate compiles.

CI doesn't hit this: its Windows runners build from an msvc host to a gnu target, so target != host holds and the target is forwarded.

Fix

Forward the target on a native windows-gnu host too.

zig_target_for_rust_target already maps x86_64-pc-windows-gnu → x86_64-windows-gnu; this just lets the native case reach it. The file already branches on target.contains("windows-gnu") a few lines down for the MinGW archive name, so the shape matches what's there.

Verification

Windows 11, Rust 1.95.0 (gnu host), zig 0.16.0, MSYS2 mingw-w64 gcc 16.2.0 + lld 22.1.8.

Before: zig build fails with WindowsSdkNotFound.

After: cargo build -p cmux-tui finishes, and the binary actually works:

$ cmux --version
cmux 0.1.0

$ cmux server status --session wintest
status   running
socket   C:\Users\...\AppData\Local\Temp\cmux-tui-somes\wintest.sock

$ cmux --session wintest terminal list
TITLE      C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
LIFECYCLE  running   RUNNING true   80x24

$ cmux --session wintest terminal <id> screen read
PS C:\...\cmux-tui>
>> echo WINDOWS_PTY_WORKS
WINDOWS_PTY_WORKS
PS C:\...\cmux-tui>

cargo fmt -p ghostty-vt-sys -- --check is clean.

Blast radius

Only the native windows-gnu case changes:

case before after
macOS / Linux native no target passed unchanged
windows-msvc native no target passed unchanged
CI msvc host → gnu target target passed unchanged
any cross-compile target passed unchanged
windows-gnu native no target → fails target passed → builds

Note on the docs

cmux-tui/docs/getting-started.md says Windows support via ConPTY is planned for phase 2, and cmux-tui-artifacts.yml carries "no Windows PTY backend yet". With this build fix the PTY path already works through portable-pty's ConPtySystem — the round-trip above is a real PowerShell child. Happy to send a docs update separately if that reading is right.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes cmux-tui builds on native Windows GNU hosts by passing the zig target even when not cross-compiling.

  • Previously, ghostty-vt-sys forwarded -Dtarget only when the Cargo target differed from the host, so a native x86_64-pc-windows-gnu toolchain got no target and zig fell back to the msvc ABI, failing with WindowsSdkNotFound.
  • Now the target is passed for any Windows GNU target, matching the existing condition for MinGW archive names. Only the native windows-gnu case changes; other native and cross-compile cases are unaffected.

Written for commit 5a0009a. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Fixed build failures on native Windows GNU environments caused by incorrect target selection.
    • Improved build reliability by ensuring supported Rust targets use the appropriate platform configuration.

Changelog

Fixed: cmux-tui builds on a native Windows GNU host

ghostty-vt-sys forwards `-Dtarget` to `zig build` only when the cargo
target differs from the host. On a native `x86_64-pc-windows-gnu`
toolchain the two match, so zig receives no target and falls back to its
Windows default, the msvc ABI:

    zig build-lib ... -target native-native-msvc ...
    error: failed to find libc installation: WindowsSdkNotFound

That machine has no Visual Studio, which is the reason its Rust host is
windows-gnu in the first place, so the msvc fallback can never succeed
and `cargo build -p cmux-tui` fails before any crate compiles.

CI does not hit this: its Windows runners build from an msvc host to a
gnu target, so `target != host` holds and the target is forwarded.

`zig_target_for_rust_target` already maps `x86_64-pc-windows-gnu` to
`x86_64-windows-gnu`; this just lets the native case use it. The file
already branches on `target.contains("windows-gnu")` a few lines later
for the MinGW archive name.

Verified on Windows 11 (Rust 1.95.0 gnu host, zig 0.16.0, MSYS2
mingw-w64 gcc 16.2.0 + lld 22.1.8):

- before: zig build fails with WindowsSdkNotFound
- after:  `cargo build -p cmux-tui` finishes, and the binary runs -
          `cmux server start` comes up, `workspace create` spawns
          PowerShell through ConPTY, and `terminal write` + `screen read`
          round-trip its output
- `cargo fmt -p ghostty-vt-sys -- --check` is clean

Only the native windows-gnu case changes. Native macOS, Linux and
windows-msvc builds pass no target as before, and every cross-compile
still takes the `target != host` branch.
@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

@Somuuuu007 is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 23c261e7-7b6e-4c52-8f3e-2f592f1f3450

📥 Commits

Reviewing files that changed from the base of the PR and between f733ceb and 1ff7b32.

📒 Files selected for processing (1)
  • cmux-tui/crates/ghostty-vt-sys/build.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The build script now passes -Dtarget= to Zig for known Rust targets, including native *-windows-gnu targets.

Changes

Windows GNU target propagation

Layer / File(s) Summary
Zig target selection
cmux-tui/crates/ghostty-vt-sys/build.rs
The target condition now includes windows-gnu hosts, preventing Zig from defaulting to the MSVC ABI.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: lawrencecchen

Merge Risk: ⚪ Minimal · up to 1ff7b

The target propagation change is verified for native Windows GNU builds and does not introduce an outstanding merge-blocking risk.

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Cmux Swift Actor Isolation ✅ Passed PASS: The reviewed range changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. The diff contains no Swift files or Swift actor-isolation constructs. Therefore, the custom check'…
Cmux Swift Blocking Runtime ✅ Passed PASS: The review-scoped diff changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. No Swift file or Swift runtime synchronization code changed, so the Swift blocking-runtime fai…
Cmux Browser Automation Off-Main ✅ Passed PASS: The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs. The diff adds Zig target selection for native windows-gnu builds and contains no browser.* commands, WebKit/AppKit ac…
Cmux Expensive Synchronous Load ✅ Passed PASS. The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. It adds Zig target forwarding for native windows-gnu builds. It does not change production Swift c…
Cmux Cache Substitution Correctness ✅ Passed PASS: The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. The diff does not contain production Swift, TypeScript, or JavaScript changes, and it does not repla…
Cmux No Hacky Sleeps ✅ Passed PASS. The PR changes only cmux-tui/crates/ghostty-vt-sys/build.rs and widens the Zig target condition for native windows-gnu builds. The added lines contain no sleep, timer, polling, fixed backoff…
Cmux Algorithmic Complexity ✅ Passed PASS. The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs, which is Rust build-script code. The algorithmic-complexity check applies to production Swift, TypeScript, JavaScript, sh…
Cmux Swift Concurrency ✅ Passed The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. The diff introduces no cmux-owned Swift code and therefore introduces or expands none of the listed legacy…
Cmux Swift @Concurrent ✅ Passed PASS: The authoritative pull-request diff changes only cmux-tui/crates/ghostty-vt-sys/build.rs and contains no Swift files or Swift declarations. The cmux Swift @concurrent conditions are therefor…
Cmux Swift Package Boundaries ✅ Passed PASS. The authoritative pull-request diff contains only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. It contains no Swift source, SwiftPM manifest, or app-target change. Therefore t…
Cmux Swiftpm Lockfiles ✅ Passed The pull-request diff changes only cmux-tui/crates/ghostty-vt-sys/build.rs. It contains no Package.swift, Package.resolved, .gitignore, workflow, or Xcode project/package-reference changes. Th…
Cmux Swift Logging ✅ Passed PASS: The review-scoped diff changes only cmux-tui/crates/ghostty-vt-sys/build.rs. It adds Rust comments and target-selection logic for Zig. It adds no Swift code or Swift logging, so the Swift logg…
Cmux User-Facing Error Privacy ✅ Passed PASS. The only changed file is the developer build script. The diff changes the condition that adds the internal Zig -Dtarget argument and adds developer-only comments. It does not add or modify use…
Cmux Full Internationalization ✅ Passed PASS. The PR changes only cmux-tui/crates/ghostty-vt-sys/build.rs. The diff adds Zig target-selection logic and developer comments for a Windows build failure. It does not add or change Swift UI tex…
Cmux Swiftui State Layout ✅ Passed PASS. The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. The diff introduces no SwiftUI code or state/layout patterns, so the SwiftUI state-layout check does…
Cmux Architecture Rethink ✅ Passed PASS. The authoritative diff changes only cmux-tui/crates/ghostty-vt-sys/build.rs; it contains no Swift files or Swift architecture changes. The change adds a target argument for native `windows-gnu…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs. The diff contains no Swift or window declaration changes, so the cmux auxiliary-window close-shortcut rule is not applica…
Cmux Source Artifacts ✅ Passed The PR changes only cmux-tui/crates/ghostty-vt-sys/build.rs. The diff adds source comments and widens a Rust build-script condition. This is intentional hand-written build source, not local tool out…
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS: The authoritative PR diff changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust file. It contains no Swift file under a production Sources/ path, so the no-test/debug-seam check is no…
Cmux No Ambient Global State ✅ Passed PASS: The pull request changes only cmux-tui/crates/ghostty-vt-sys/build.rs, a Rust build script. The authoritative diff contains no Swift or Swift interface files, so the production Swift ambient-g…
Title check ✅ Passed The title clearly and concisely states the primary change: passing the Zig target on a native Windows GNU host.
Description check ✅ Passed The description explains the failure, fix, affected cases, verification commands, observed results, and changelog entry. It uses equivalent sections instead of the template headings and omits the chec…
Linked Issues check ✅ Passed No linked issue is provided, but the description clearly documents the problem, scope, and verification. The supplied template does not require an issue link.
Out of Scope Changes check ✅ Passed The changes are limited to the stated native Windows GNU build fix and match the pull request objectives. No unrelated changes are reported.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teamleaderleo
teamleaderleo merged commit 03b191d into manaflow-ai:main Sep 27, 2026
57 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Merge receipt for 5a0009aa70: every check was green at merge (12 verified; 15 skipped by policy). Full suite runs on main after merge.

@teamleaderleo

Copy link
Copy Markdown
Collaborator

Merged, thanks @Somuuuu007 :)

rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 27, 2026
82c26b3 ci: take the gui token in the app-host shard's restore, not at job start (manaflow-ai#15012)
3761671 iOS: fix stale team nightly floor expectation in What's New copy test (manaflow-ai#14917)
5e19a98 docs: focus custom sidebar tabs by surfaceId in the actions example (manaflow-ai#15002)
294ee6e sidebar: Strip inline Markdown from notification previews (manaflow-ai#12030)
ceb3030 Keep detached workspace process titles updateable (manaflow-ai#4947)
8be7364 test: kill hosted test shells before freeing their terminals (manaflow-ai#14957)
da291df cmux-tui: do not query the host terminal when the reply cannot be read (manaflow-ai#12419)
98767c8 ci: keep earlier reviewed CLA policies valid for branches behind main (manaflow-ai#15008)
7167b77 feat(custom-sidebars): fixedSize and reactive frame specs for JS sidebars (manaflow-ai#14845)
716bbb5 Fix notification hook descriptor inheritance (manaflow-ai#11649)
03b191d cmux-tui: pass the zig target on a native windows-gnu host (manaflow-ai#12416)
c9a6a0e docs: load the deep review protocol only when needed (manaflow-ai#15007)
e5af879 Match pane indicator strokes and the file path header to shared chrome metrics (manaflow-ai#14982)
0def9e1 Show one fixed subtitle for each Settings row and fix localized labels (manaflow-ai#14883)
1921636 ci: route picker-less macOS lanes to the owned minis for trusted events (manaflow-ai#14794)

# Conflicts:
#	.github/workflows/app-host-test-rerun.yml
#	.github/workflows/auth-refresh-tests.yml
#	.github/workflows/ci-health-report.yml
#	.github/workflows/ci-macos.yml
#	.github/workflows/ci-owned-pool-rescue.yml
#	.github/workflows/ci-repo-variables.yml
#	.github/workflows/cloud-command-deadlines.yml
#	.github/workflows/cloud-machine-tests.yml
#	.github/workflows/cloud-task-local-tests.yml
#	.github/workflows/cmux-tui.yml
#	.github/workflows/iroh-v2.yml
#	.github/workflows/relay-tls.yml
#	.github/workflows/reload-build.yml
#	.github/workflows/remote-daemon.yml
#	.github/workflows/resolve-dispatch-ref.yml
#	.github/workflows/terminal-hang-diagnostics.yml
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.

2 participants