Skip to content

reload: add explicit build-only validation mode - #12971

Open
teamleaderleo wants to merge 2 commits into
manaflow-ai:mainfrom
teamleaderleo:feat/explicit-build-only
Open

teamleaderleo wants to merge 2 commits into
manaflow-ai:mainfrom
teamleaderleo:feat/explicit-build-only

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Problem

The tagged reload command intentionally keeps the running app and cmuxd aligned with the most recently built artifact. An environment-variable opt-out would let a build replace files on disk while leaving an older process running, which makes the active tag state ambiguous.

Change

Add an explicit --build-only mode for compile/validation work that must not reload the active tag:

  • requires the existing tagged workflow and cannot be combined with --launch;
  • keeps the active app, cmuxd, socket ownership, and tag discovery state untouched;
  • keeps the newly built, signed bundle in a separate staging path instead of replacing the active app bundle;
  • reports clearly that the active runtime remains on its previous revision;
  • documents when to use the mode and preserves the normal replacement behavior for reload.sh --tag <tag>.

This keeps “reload/build” exact-current semantics while providing an explicit escape hatch for callers that only need compilation or artifact validation.

Validation

  • bash -n scripts/reload.sh
  • ./scripts/reload.sh --help exposes the mode
  • ./scripts/reload.sh --tag test --build-only --launch fails before build with the invalid-combination error
  • git diff --check

A full tagged Xcode build was not run in this environment.


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

Adds a --build-only mode to scripts/reload.sh so tagged builds compile and validate without touching the running app, cmuxd, socket, or tag state.

  • Requires --tag and fails if combined with --launch.
  • Skips tag cleanup, daemon and app termination, log-path writes, and reload-state publication; the active runtime stays on its previous revision.
  • Stages the new bundle separately and removes the temporary artifact after validation instead of replacing the active bundle.
  • Plain --tag still replaces the same-tag runtime by default.
  • Updates CLAUDE.md and the tagged-builds reference to document the mode.

Written for commit f032c25. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added a --build-only option to validate a tagged build without replacing or stopping the currently running app.
    • Build-only validation keeps the active app, daemon, and tag state unchanged while staging the new bundle separately.
  • Documentation

    • Added usage guidance and examples for the new build-only workflow.
    • Clarified that the option cannot be combined with launch behavior.

@github-actions

github-actions Bot commented Sep 19, 2026

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Sep 19, 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: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c1cb535a-cd69-4e62-993b-8b08f7a8a5bb

📥 Commits

Reviewing files that changed from the base of the PR and between 9c2ba78 and 8f41300.

📒 Files selected for processing (3)
  • CLAUDE.md
  • scripts/reload.sh
  • skills/cmux-dev-workflow/references/tagged-builds.md

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


📝 Walkthrough

Walkthrough

The reload script adds --build-only validation. This mode builds and stages a bundle without replacing the active app, stopping cmuxd, publishing tagged state, or creating compatibility links. Documentation describes the new invocation and behavior.

Changes

Tagged reload workflow

Layer / File(s) Summary
Build-only mode contract
scripts/reload.sh, CLAUDE.md, skills/cmux-dev-workflow/references/tagged-builds.md
The command accepts --build-only, rejects it with --launch, and documents the explicit validation workflow.
Staged bundle and runtime preservation
scripts/reload.sh
Build-only mode uses the staged bundle for embedded paths, skips cleanup and publication, preserves cmuxd and the running tagged app, and does not replace the final tagged bundle.
Validation completion and state publication
scripts/reload.sh
Build-only mode suppresses normal output, reports completion, removes the temporary staged artifact, and prevents reload-state publication.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant reload.sh
  participant StagedBundle
  participant TaggedApp
  participant cmuxd
  Developer->>reload.sh: Run --tag --build-only
  reload.sh->>StagedBundle: Build and stage bundle
  reload.sh->>TaggedApp: Keep active app unchanged
  reload.sh->>cmuxd: Keep daemon and socket unchanged
  reload.sh-->>Developer: Report validation completion
Loading

Suggested reviewers: lawrencecchen

🚥 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 2 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: adding an explicit build-only validation mode to reload.
Description check ✅ Passed The description clearly explains the problem, implementation, behavior, and validation. It covers the template's summary and testing requirements, although it uses different headings and omits the che…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Cloud Persistent Session And Early Input ✅ Passed PASS: The pull request changes only scripts/reload.sh and build documentation. The diff adds a tagged --build-only build path, staging cleanup, and reload-state safeguards. It does not change Clou…
Cmux Swift Actor Isolation ✅ Passed PASS: The authoritative PR diff changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It contains no .swift files or Swift declarations. The isol…
Cmux Swift Blocking Runtime ✅ Passed PASS: The reviewed diff changes only scripts/reload.sh and two Markdown files. It introduces no Swift file or production Swift synchronization code. The shell change is outside this check's stated s…
Cmux Browser Automation Off-Main ✅ Passed PASS: The PR changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. The policy applies to browser socket automation commands in `Sources/TerminalCon…
Cmux Expensive Synchronous Load ✅ Passed PASS. The authoritative pull-request diff changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It adds no Swift source, Xcode project, or Swift wo…
Cmux Cache Substitution Correctness ✅ Passed PASS: The pull request changes only scripts/reload.sh and Markdown documentation. The authoritative diff contains no production Swift, TypeScript, or JavaScript changes, and it does not replace an a…
Cmux No Hacky Sleeps ✅ Passed PASS: The pull request adds no fixed sleep, timer, polling loop, delayed dispatch, or wall-clock retry. The changed scripts/reload.sh preserves the existing sleep calls; the base and head contain th…
Cmux Algorithmic Complexity ✅ Passed PASS. The pull request changes only scripts/reload.sh and documentation. The shell changes add flag checks, conditional cleanup/publication suppression, staging-path selection, and artifact removal.…
Cmux Swift Concurrency ✅ Passed The review range changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It changes no Swift files and adds no Swift concurrency patterns. The cmux S…
Cmux Swift @Concurrent ✅ Passed PASS: The reviewed range changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It has no changed .swift paths and no added Swift concurrency decl…
Cmux Swift Package Boundaries ✅ Passed PASS — The authoritative pull-request diff changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It contains no .swift files, Package.swift, or…
Cmux Swiftpm Lockfiles ✅ Passed PASS. The review-scoped diff changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It contains no SwiftPM package manifest, Package.resolved, `.g…
Cmux Swift Logging ✅ Passed PASS: The pull request changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md; it adds no Swift files or Swift logging statements. The added echo l…
Cmux User-Facing Error Privacy ✅ Passed PASS: The changed user-facing text adds only the --build-only option, a generic invalid-combination error, and build-status messages. The new text does not expose vendor/provider names, provider-spe…
Cmux Full Internationalization ✅ Passed The pull request changes only scripts/reload.sh and developer workflow documentation. It adds shell CLI messages and operational guidance, not Swift UI/text, web UI/API data, metadata, changelog, or…
Cmux Swiftui State Layout ✅ Passed PASS: The pull request changes only scripts/reload.sh and two Markdown files. The authoritative diff contains no Swift, SwiftUI, or view-state changes, and no added SwiftUI/state-layout tokens. Ther…
Cmux Architecture Rethink ✅ Passed PASS. The authoritative diff changes only CLAUDE.md, scripts/reload.sh, and a Markdown reference. It contains no Swift, SwiftUI, AppKit, or Swift lifecycle code. The new BUILD_ONLY shell flag an…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS: The authoritative pull-request diff changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It changes no Swift source and adds or changes no N…
Cmux Source Artifacts ✅ Passed The pull request changes only three intentional text paths: CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. The diff adds documentation and hand-written b…
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS. The review-scoped diff changes only CLAUDE.md, scripts/reload.sh, and skills/cmux-dev-workflow/references/tagged-builds.md. It contains no changed Swift file under a production `**/Sources…
Full details: Docstring Coverage

Explanation

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 2 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@teamleaderleo
teamleaderleo force-pushed the feat/explicit-build-only branch from eb2257b to af1290e Compare September 19, 2026 00:27
@teamleaderleo

Copy link
Copy Markdown
Contributor Author

Follow-up polish after self-review:

  • build-only now skips stale CLI/tag cleanup, so it cannot delete or rewrite existing discovery state before the build;
  • it no longer updates /tmp/cmux-<tag> or /tmp/cmux-last-debug-log-path;
  • successful validation removes its temporary staged app bundle, while failure cleanup remains intact;
  • the success output avoids advertising paths that have already been removed.

Validation: bash -n scripts/reload.sh, invalid --build-only --launch guard, git diff --check, and node scripts/lib/reload-shim.test.mjs (11/11). A full tagged Xcode build remains unavailable in this environment.

@teamleaderleo

Copy link
Copy Markdown
Contributor Author

Verified on the local Mac mini after initializing the pinned submodules:

  • CMUX_DEV_BACKEND_MODE=local CMUX_DEV_BACKEND_URL=https://cmux-dev-backend-1.tail137216.ts.net:4170/ ./scripts/reload.sh --tag codex-build-only-local --build-only
  • full Debug Xcode build completed successfully in 980s;
  • build-only completion reported the running app, cmuxd, and tag state unchanged;
  • temporary staged artifact was removed on success;
  • worktree remains clean.

@teamleaderleo

Copy link
Copy Markdown
Contributor Author

Performance measurements on the same local Mac:

  • Baseline (9c2ba78, normal tagged reload, isolated DerivedData): 1320.69s wall time.
  • PR (8f413003, first full build-only validation): 980s wall time.
  • PR warm build-only rerun with the same DerivedData cache: 59.51s wall time.

The cold numbers are not a claimed compile-speed regression/improvement: they were run at different times under different concurrent machine load, and build-only skips runtime teardown/publication by design. The useful result is that the build-only path preserves the expensive compile behavior while avoiding runtime-state churn; its cached validation pass completed in about one minute.

@teamleaderleo
teamleaderleo force-pushed the feat/explicit-build-only branch from 8f41300 to f032c25 Compare September 19, 2026 01:45
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