Skip to content

Add CMUX_SKIP_ZIG_BUILD flag to reload.sh - #2726

Closed
ueg1990 wants to merge 2 commits into
manaflow-ai:mainfrom
ueg1990:skip-zig-build-reload
Closed

ueg1990 wants to merge 2 commits into
manaflow-ai:mainfrom
ueg1990:skip-zig-build-reload

Conversation

@ueg1990

@ueg1990 ueg1990 commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds CMUX_SKIP_ZIG_BUILD=1 environment variable to skip the Zig builds of cmuxd and ghostty CLI helper in reload.sh
  • Speeds up the edit-build-test cycle when iterating on Swift/Xcode-only changes that don't touch Zig-built binaries
  • Usage: CMUX_SKIP_ZIG_BUILD=1 ./scripts/reload.sh --tag my-feature

Context

Zig 0.15.2 does not yet support the macOS 26 (Tahoe) SDK (macOS SDK 26.4 / Xcode 26.4). Zig build steps fail when the system xcrun resolves to the macOS 26 SDK, which is the default on machines running the macOS 26 beta. Until Zig ships a release with macOS 26 SDK support, developers on macOS 26 need a way to skip the Zig build steps in reload.sh and rely on pre-built binaries.

  • Zig version: 0.15.2
  • macOS version: macOS 26.2 (Tahoe, build 25C56)
  • Xcode version: Xcode 26.4 (build 17E192)
  • macOS SDK: 26.4 (macosx26.4)

Test plan

  • Run ./scripts/reload.sh --tag test without the env var — Zig builds should execute as before
  • Run CMUX_SKIP_ZIG_BUILD=1 ./scripts/reload.sh --tag test — Zig builds should be skipped, existing binaries used
  • Verify the built .app launches correctly in both cases

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved build process consistency by consolidating control mechanisms for helper components. Previously, helper binaries had separate build configuration methods; they now respond uniformly to the same setting, providing more predictable build behavior and clearer control over component compilation.

Allow skipping the Zig builds of cmuxd and ghostty CLI helper
during reload by setting CMUX_SKIP_ZIG_BUILD=1. This speeds up
the edit-build-test cycle when iterating on Swift/Xcode changes
that don't touch the Zig-built binaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 8, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cb300e17-a2d3-4e93-8ee8-e178c03f0962

📥 Commits

Reviewing files that changed from the base of the PR and between cd03b04 and 58f32e5.

📒 Files selected for processing (1)
  • scripts/reload.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/reload.sh

📝 Walkthrough

Walkthrough

The scripts/reload.sh script now gates both zig build steps for the cmuxd and ghostty helper binaries behind the CMUX_SKIP_ZIG_BUILD environment variable; when CMUX_SKIP_ZIG_BUILD="1" neither helper's Zig build is executed.

Changes

Cohort / File(s) Summary
Build Script Control Flow
scripts/reload.sh
Unified conditional: both cmuxd and ghostty Zig build invocations are now skipped when CMUX_SKIP_ZIG_BUILD=1. Adjusted log message and gating previously applied inconsistently between the two helpers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 I hopped through scripts with a cheeky grin,

I taught two builds a way to not begin,
Flag set to one and both take a nap,
Faster reloads now — time for a snack! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a CMUX_SKIP_ZIG_BUILD flag to reload.sh to conditionally skip Zig builds.
Description check ✅ Passed The description covers the summary, context, and test plan sections well, but the Testing section is incomplete and the checklist items are not marked as completed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

@vercel

vercel Bot commented Apr 8, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a CMUX_SKIP_ZIG_BUILD=1 environment variable to scripts/reload.sh that bypasses the cmuxd and ghostty CLI helper Zig builds, allowing faster iteration on Swift/Xcode-only changes. The implementation is clean and follows the existing conditional-build pattern in the script.

Confidence Score: 5/5

Safe to merge; all findings are minor P2 style/UX suggestions that don't affect correctness.

The change is small and isolated to a developer script. The logic is correct — the guard condition != "1" defaults safely when the variable is unset, and the existing binary-copy guards handle the missing-binary case at runtime. Both findings are P2 quality improvements (usage docs, missing-binary warning), not correctness issues.

No files require special attention.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
scripts/reload.sh Adds CMUX_SKIP_ZIG_BUILD guard around Zig build steps; flag not documented in usage() and no warning emitted when binaries are missing while the flag is active.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[reload.sh invoked] --> B{CMUX_SKIP_ZIG_BUILD == 1?}
    B -- No --> C[zig build cmuxd]
    C --> D[zig build ghostty cli-helper]
    D --> E{cmuxd binary exists?}
    B -- Yes --> E
    E -- Yes --> F[cp cmuxd → app bundle]
    E -- No --> G[skip cmuxd copy]
    F --> H{ghostty helper exists?}
    G --> H
    H -- Yes --> I[cp ghostty → app bundle]
    H -- No --> J[skip ghostty copy]
    I --> K[xcodebuild]
    J --> K
Loading

Comments Outside Diff (2)

  1. scripts/reload.sh, line 103-117 (link)

    P2 CMUX_SKIP_ZIG_BUILD missing from usage text

    The new env-var flag isn't mentioned in the usage() function, so anyone running --help won't discover it. Adding a line there would make it self-documenting alongside the other options.

  2. scripts/reload.sh, line 421-440 (link)

    P2 Silent no-op when binaries haven't been built yet

    When CMUX_SKIP_ZIG_BUILD=1 is set and neither cmuxd/zig-out/bin/cmuxd nor ghostty/zig-out/bin/ghostty exist yet (e.g. first run after a clean checkout), the copy guards on lines 429 and 435 silently skip both binaries. The app will build and launch but be missing cmuxd and the Ghostty helper with no warning. A quick existence check after the guarded build would surface this early.

Reviews (1): Last reviewed commit: "Add CMUX_SKIP_ZIG_BUILD flag to reload.s..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
scripts/reload.sh (1)

421-428: LGTM — conditional gate correctly implemented.

The logic properly skips Zig builds when CMUX_SKIP_ZIG_BUILD=1, and the ${CMUX_SKIP_ZIG_BUILD:-} default handles the unset-variable case. The -Doptimize=ReleaseFast flags are retained per project conventions.

Consider adding a brief echo when skipping (similar to build-ghostty-cli-helper.sh) so developers have visibility:

💡 Optional: Add feedback when skipping Zig builds
 if [[ "${CMUX_SKIP_ZIG_BUILD:-}" != "1" ]]; then
   if [[ -d "$PWD/cmuxd" ]]; then
     (cd "$PWD/cmuxd" && zig build -Doptimize=ReleaseFast)
   fi
   if [[ -d "$PWD/ghostty" ]]; then
     (cd "$PWD/ghostty" && zig build cli-helper -Dapp-runtime=none -Demit-macos-app=false -Demit-xcframework=false -Doptimize=ReleaseFast)
   fi
+else
+  echo "Skipping Zig builds (CMUX_SKIP_ZIG_BUILD=1)"
 fi

Based on learnings: "When rebuilding cmuxd for release/bundling, always use ReleaseFast optimization" — the code correctly uses -Doptimize=ReleaseFast.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/reload.sh` around lines 421 - 428, Add a short echo when Zig builds
are skipped so developers see why builds were omitted: inside the existing
conditional that checks CMUX_SKIP_ZIG_BUILD (the block containing the cmuxd and
ghostty checks and the zig build invocations), add an echo statement executed
when CMUX_SKIP_ZIG_BUILD is "1" (or when the conditional branch that would skip
the builds is taken) that prints a concise message like "Skipping Zig builds
(CMUX_SKIP_ZIG_BUILD=1)". Reference the existing symbols CMUX_SKIP_ZIG_BUILD,
cmuxd, ghostty, and the zig build commands to locate the code to modify; ensure
the echo is only printed when skipping and does not change the current build
behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/reload.sh`:
- Around line 421-428: Add a short echo when Zig builds are skipped so
developers see why builds were omitted: inside the existing conditional that
checks CMUX_SKIP_ZIG_BUILD (the block containing the cmuxd and ghostty checks
and the zig build invocations), add an echo statement executed when
CMUX_SKIP_ZIG_BUILD is "1" (or when the conditional branch that would skip the
builds is taken) that prints a concise message like "Skipping Zig builds
(CMUX_SKIP_ZIG_BUILD=1)". Reference the existing symbols CMUX_SKIP_ZIG_BUILD,
cmuxd, ghostty, and the zig build commands to locate the code to modify; ensure
the echo is only printed when skipping and does not change the current build
behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ee92fd8d-8072-470c-b548-2ba2e3896a84

📥 Commits

Reviewing files that changed from the base of the PR and between ca39ddb and cd03b04.

📒 Files selected for processing (1)
  • scripts/reload.sh

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

Merges the main branch approach (echo message, ghostty-only skip) with
our branch's approach (skip both cmuxd and ghostty). The resolved version
wraps both zig builds in the skip guard and adds an informational echo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teamleaderleo

Copy link
Copy Markdown
Collaborator

This is shipped on current main in scripts/reload.sh with CMUX_SKIP_ZIG_BUILD. Thank you! :)

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