Skip to content

Add scripts/cleanup-dev-builds.sh for safely reclaiming tagged DerivedData - #4837

Merged
azooz2003-bit merged 4 commits into
mainfrom
feat-cleanup-dev-builds
May 27, 2026
Merged

azooz2003-bit merged 4 commits into
mainfrom
feat-cleanup-dev-builds

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented May 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

./scripts/reload.sh --tag <tag> produces a multi-GB DerivedData/cmux-<tag>/ plus per-tag sockets and logs. Across many slices these accumulate fast. On my machine right now: 34.3 GB across 11 tags safely reclaimable.

This script removes those artifacts for tags the user has explicitly marked done.

Behavior

Defaults to dry-run. Pass --apply to delete.

Cleans for each tag:

  • ~/Library/Developer/Xcode/DerivedData/cmux-<tag>/
  • /tmp/cmux-<tag>/ (build scratch)
  • /tmp/cmux-debug-<tag>.{sock,log}
  • /tmp/cmux-reload-<tag>.log
  • ~/Library/Application Support/cmux/cmuxd-dev-<tag>.sock

Safety rules (always on)

  • Skip any tag whose cmux DEV <tag> app is currently running
  • Skip the tag pointed at by /tmp/cmux-last-cli-path (the most recent reload, what cmux-dev resolves to)
  • Skip any tag tied to a live git worktree (via git worktree list)

Filters

  • --older-than DAYS (mtime-based)
  • --keep TAG (repeatable)
  • --apply (default off; previews otherwise)

Test plan

  • ./scripts/cleanup-dev-builds.sh prints a sized preview and exits without changing anything.
  • Currently-running cmux DEV <tag> is listed under skipping: with reason app running.
  • The tag matching /tmp/cmux-last-cli-path is listed under skipping: with reason active (most recent reload).
  • --keep <tag> protects that tag.
  • --older-than N only marks tags older than N days for deletion.
  • --apply actually deletes and the freed-bytes report matches du before/after.

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


Summary by cubic

Adds a safe cleanup script to reclaim disk space from tagged dev builds, plus a /cleanup-builds command for guided preview → confirm → apply. It shows reclaimable space, protects active tags, and also cleans orphaned sockets/logs.

  • New Features
    • Added scripts/cleanup-dev-builds.sh to remove per-tag artifacts from scripts/reload.sh --tag (e.g., DerivedData/cmux-<tag>/, /tmp/cmux-<tag>/, per-tag sockets/logs).
    • Defaults to dry-run; use --apply to delete. Reports total reclaimable bytes and final "freed (estimated)".
    • Safety: skips running cmux DEV <tag> and the tag in /tmp/cmux-last-cli-path. Worktrees are not a protection; use --keep.
    • Filters: --older-than DAYS, --keep TAG (repeatable). Orphan sockets/logs are still cleaned even if DerivedData was already removed.

Written for commit 47a6265. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Chores
    • Added a safe cleanup utility for development build artifacts and temporary caches. Runs in dry‑run by default, supports an apply mode, explicit keep rules, and age‑based pruning; skips active or running builds and reports per‑tag reclaimable and freed disk space.
  • Documentation
    • Added guidance describing the preview→confirm→apply workflow, safety checks, and recommended usage for reclaiming multi‑GB dev artifacts.

Review Change Stack

@vercel

vercel Bot commented May 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment May 27, 2026 3:31pm
cmux-staging Building Building Preview, Comment May 27, 2026 3:31pm

@coderabbitai

coderabbitai Bot commented May 27, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds a Bash script and docs to locate per-tag cmux dev-build artifacts, compute reclaimable sizes, skip active/running/protected tags, preview deletions (dry-run), and optionally remove planned artifact paths when invoked with --apply.

Changes

Build Artifact Cleanup

Layer / File(s) Summary
CLI, usage, and command docs
scripts/cleanup-dev-builds.sh (lines 1–63), .claude/commands/cleanup-builds.md
Script header, strict shell options, usage/examples, and argument parsing for --apply, --older-than <DAYS>, repeatable --keep <TAG>; command guide describing preview/apply workflow.
Tag discovery and helpers
scripts/cleanup-dev-builds.sh (lines 65–120)
Discovers cmux-<tag> DerivedData directories, enumerates candidate artifact paths per tag, computes sizes via du, formats human-readable bytes, and computes DerivedData mtime age in days.
Active/run detection
scripts/cleanup-dev-builds.sh (lines 122–143)
Reads active tag from /tmp/cmux-last-cli-path and detects running cmux DEV <tag> processes via pgrep -fl for skip logic.
Deletion plan computation
scripts/cleanup-dev-builds.sh (lines 144–195)
Iterates discovered tags, accumulates skip reasons (--keep, active tag, running processes, --older-than), sums reclaimable bytes per tag, and partitions tags into planned deletions and skips.
Dry-run reporting and delete execution
scripts/cleanup-dev-builds.sh (lines 196–241)
Prints skipped tags with reasons and “would delete” entries with sizes and totals; when --apply is provided, removes artifact paths with rm -rf and reports the previously estimated freed space.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through DerivedData rows,

sniffed tags where old build tumble grows.
A cautious paw — a dry-run glance,
then, if you ask, I’ll clear the expanse.
Tiny bunny, tidy devs, happy flows.

🚥 Pre-merge checks | ✅ 3 | ❌ 15

❌ Failed checks (1 warning, 14 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers Summary and Behavior sections with clear details, but is missing the Testing and Checklist sections required by the template. Add the Testing section with how the change was tested, and complete the Checklist section by checking off verified items from the test plan.
Cmux Swift Actor Isolation ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Swift Blocking Runtime ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux No Hacky Sleeps ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Algorithmic Complexity ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Swift Concurrency ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Swift @Concurrent ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Swift File And Package Boundaries ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Swift Logging ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux User-Facing Error Privacy ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Full Internationalization ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Swiftui State Layout ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Architecture Rethink ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Cmux Swift Auxiliary Window Close Shortcuts ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically summarizes the main change: adding a script for safely reclaiming disk space from tagged DerivedData artifacts.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-cleanup-dev-builds

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.

@greptile-apps

greptile-apps Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds scripts/cleanup-dev-builds.sh to reclaim disk space from tagged dev builds produced by reload.sh --tag, plus a /cleanup-builds slash-command guide. The script defaults to dry-run, computes reclaimable bytes per tag, and applies three always-on safety guards before any deletion.

  • New script scans DerivedData/cmux-<tag>/ directories, plans deletions with --older-than/--keep filters, and only applies with --apply; both previously reported bugs (the -1 mtime sentinel and the "estimated" bytes label) are correctly addressed in this version.
  • Running-app guard uses pgrep -fl to detect live cmux DEV <tag> processes, but the .app suffix capture bug means the guard silently passes for a running app (see inline comment).
  • Slash-command doc accurately reflects the script's actual behavior, including the note that worktrees are not a protection.

Confidence Score: 4/5

The script is safe to merge after fixing the running-app guard; without the fix, --apply can delete DerivedData for an actively running cmux DEV app.

The only real defect is in the running-app safety check: pgrep -fl on macOS emits the full binary path, so the captured tag includes the .app suffix and never matches the discovered tag, silently bypassing the guard. A one-character fix (%.app strip) resolves it.

scripts/cleanup-dev-builds.sh — running-app detection near line 140

Important Files Changed

Filename Overview
scripts/cleanup-dev-builds.sh Cleanup script for tagged dev artifacts. Two previously reported issues are addressed (--older-than -1 sentinel, estimated freed-bytes label). One remaining bug: the running-app safety check captures the .app suffix in the tag name when pgrep -fl outputs the full binary path on macOS, causing the guard to silently fail.
.claude/commands/cleanup-builds.md Slash-command guide for guided cleanup workflow. Correctly documents that worktrees are not a protection and that --apply requires explicit user confirmation. No issues found.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Start cleanup-dev-builds.sh] --> B[Parse args\n--apply / --older-than / --keep]
    B --> C[discover_tags\nscan DerivedData/cmux-*/]
    C --> D[Probe safety signals\nactive_tag from cmux-last-cli-path\nrunning_tags from pgrep -fl]
    D --> E{For each tag}
    E --> F{Any skip reason?\nrunning / active / --keep / age}
    F -- yes --> G[plan_skip\nwith reason string]
    F -- no --> H[plan_delete\naccumulate tag_bytes]
    G --> I[Print skipping: list]
    H --> J[Print would delete: list\n+ total reclaimable]
    J --> K{--apply?}
    K -- no --> L[Dry-run exit]
    K -- yes --> M[rm -rf each artifact path\nif still present]
    M --> N[Print freed estimated bytes]
Loading

Reviews (3): Last reviewed commit: "Address review feedback on cleanup-dev-b..." | Re-trigger Greptile

Comment on lines +187 to +191
if (( older_than_days > 0 )); then
age="$(derived_data_mtime_days "$DERIVED_DATA_ROOT/cmux-${tag}")"
if (( age < older_than_days )); then
reasons+=("age ${age}d < ${older_than_days}d")
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 --older-than incorrectly skips tags when derived_data_mtime_days returns -1

derived_data_mtime_days returns -1 as a sentinel when the DerivedData directory does not exist. Since -1 is always less than any positive older_than_days, the condition (( age < older_than_days )) fires, adding the misleading reason "age -1d < Nd" and permanently skipping that tag. If Xcode's "Delete Derived Data" button (or another concurrent process) removes $DERIVED_DATA_ROOT/cmux-<tag> between discover_tags and the planning loop, any remaining sockets and log files for that tag will never be cleaned — --older-than silently blocks them indefinitely. The -1 sentinel should be treated as "no DerivedData directory; age filter does not apply".

Suggested change
if (( older_than_days > 0 )); then
age="$(derived_data_mtime_days "$DERIVED_DATA_ROOT/cmux-${tag}")"
if (( age < older_than_days )); then
reasons+=("age ${age}d < ${older_than_days}d")
fi
if (( older_than_days > 0 )); then
age="$(derived_data_mtime_days "$DERIVED_DATA_ROOT/cmux-${tag}")"
if (( age >= 0 && age < older_than_days )); then
reasons+=("age ${age}d < ${older_than_days}d")
fi
fi

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 47a6265. --older-than now treats age == -1 (DerivedData already gone) as "no age signal" so orphan sockets/logs still get cleaned.

— Claude Code

Comment thread scripts/cleanup-dev-builds.sh Outdated
done < <(artifact_paths_for_tag "$tag")
printf ' removed: %s\n' "$tag"
done
printf '\nfreed: %s\n' "$(human_bytes "$total_bytes")"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Freed total is a pre-deletion estimate, not measured post-deletion

total_bytes is accumulated from du -sk during the planning phase, before any files are removed. If a planned file disappears between planning and execution (e.g., a concurrent rm or Xcode cleanup), rm -rf will skip it (correctly guarded by [[ -e "$p" ]]), but the freed total still includes those bytes. Labelling it "estimated" keeps the output honest and matches the test plan expectation more accurately.

Suggested change
printf '\nfreed: %s\n' "$(human_bytes "$total_bytes")"
printf '\nfreed (estimated): %s\n' "$(human_bytes "$total_bytes")"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 47a6265. Renamed to "freed (estimated)" with a comment explaining the measurement happens at planning time.

— Claude Code

@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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/cleanup-dev-builds.sh`:
- Around line 120-124: The current extraction only matches when last_path starts
with "$DERIVED_DATA_ROOT/cmux-", which misses other locations; change the check
to detect "cmux-" anywhere in last_path (e.g., test for presence of "cmux-"),
then extract the tag using a suffix removal from the last occurrence of "cmux-"
(use parameter expansion like rest="${last_path##*cmux-}") and then derive
active_tag="${rest%%/*}" so it works for paths under tmp or other directories as
well; apply this logic around the existing LAST_CLI_PATH_FILE/last_path handling
to replace the strict "$DERIVED_DATA_ROOT/cmux-" check.
- Line 123: The assignment computing rest from last_path uses an unquoted
pattern with DERIVED_DATA_ROOT in the parameter expansion (the expression that
currently looks like ${last_path#$DERIVED_DATA_ROOT/cmux-}), which can treat
glob metacharacters in DERIVED_DATA_ROOT; fix it by quoting the pattern portion
so DERIVED_DATA_ROOT is not expanded as a glob (i.e., ensure the pattern inside
the # expansion uses a quoted DERIVED_DATA_ROOT followed by /cmux-), updating
the expression that references last_path and DERIVED_DATA_ROOT accordingly.
- Around line 70-72: discover_tags currently uses find "$DERIVED_DATA_ROOT" ...
-print0 | xargs -0 -n1 basename which on systems with no cmux-* directories
causes basename: missing operand and a non-zero exit; replace that pipeline so
it gracefully handles zero results (e.g., iterate over find -print0 with a
portable read loop: while IFS= read -r -d '' dir; do basename "$dir"; done <
<(find "$DERIVED_DATA_ROOT" -maxdepth 1 -type d -name 'cmux-*' -print0)) so
discover_tags no longer fails when there are no cmux-* DerivedData dirs
(alternatively use xargs -0 -r basename on GNU systems, but prefer the portable
read-loop).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c8b9b858-6a7b-467d-bceb-eed01c095b39

📥 Commits

Reviewing files that changed from the base of the PR and between 3bb505e and 5fce0a8.

📒 Files selected for processing (1)
  • scripts/cleanup-dev-builds.sh

Comment thread scripts/cleanup-dev-builds.sh Outdated
Comment thread scripts/cleanup-dev-builds.sh Outdated
Comment thread scripts/cleanup-dev-builds.sh Outdated

@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.

Actionable comments posted: 1

♻️ Duplicate comments (2)
scripts/cleanup-dev-builds.sh (2)

123-126: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Broaden active-tag parsing from /tmp/cmux-last-cli-path.

The current prefix check only captures tags when the path starts with "$DERIVED_DATA_ROOT/cmux-", so the safety skip can miss valid tagged paths in other locations.

Suggested fix
 if [[ -r "$LAST_CLI_PATH_FILE" ]]; then
     last_path="$(cat "$LAST_CLI_PATH_FILE" 2>/dev/null || true)"
-    if [[ "$last_path" == "$DERIVED_DATA_ROOT/cmux-"* ]]; then
-        rest="${last_path#$DERIVED_DATA_ROOT/cmux-}"
-        active_tag="${rest%%/*}"
-    fi
+    if [[ "$last_path" =~ /cmux-([A-Za-z0-9._-]+) ]]; then
+        active_tag="${BASH_REMATCH[1]}"
+    fi
 fi
#!/bin/bash
set -euo pipefail

# Inspect current extraction logic
awk 'NR>=119 && NR<=127 {printf "%d:%s\n", NR, $0}' scripts/cleanup-dev-builds.sh

# Inspect upstream writer/read contracts around CLI path and tag derivation
rg -n -C3 'cmux-last-cli-path|CLI_PATH|DerivedData/cmux-' scripts/reload.sh
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/cleanup-dev-builds.sh` around lines 123 - 126, The active-tag
extraction only handles paths that start with "$DERIVED_DATA_ROOT/cmux-" so
tagged paths elsewhere are missed; update the logic around
last_path/rest/active_tag to detect "/cmux-" anywhere in the path (e.g., test if
last_path contains */cmux-* or cmux- and then set rest="${last_path#*/cmux-}" or
rest="${last_path#*cmux-}" accordingly) and derive active_tag="${rest%%/*}" only
when a match is found, leaving behavior unchanged when no cmux- segment exists.

71-73: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make tag discovery safe when no cmux-* directories exist.

The current pipeline can fail on empty input and exit the script under set -euo pipefail, which breaks dry-run on clean machines.

Suggested fix
 discover_tags() {
     [[ -d "$DERIVED_DATA_ROOT" ]] || return 0
-    find "$DERIVED_DATA_ROOT" -maxdepth 1 -type d -name 'cmux-*' -print0 \
-        | xargs -0 -n1 basename \
-        | sed 's/^cmux-//'
+    while IFS= read -r -d '' dir; do
+        basename "$dir"
+    done < <(find "$DERIVED_DATA_ROOT" -maxdepth 1 -type d -name 'cmux-*' -print0) \
+        | sed 's/^cmux-//'
 }
#!/bin/bash
set -euo pipefail

# Verify current implementation still uses xargs in discover_tags:
awk 'NR>=69 && NR<=74 {printf "%d:%s\n", NR, $0}' scripts/cleanup-dev-builds.sh

# Verify empty-input behavior on this environment:
set +e
printf '' | xargs -0 -n1 basename >/tmp/xargs_out.txt 2>/tmp/xargs_err.txt
rc=$?
set -e
echo "xargs_exit_code=$rc"
echo "--- stderr ---"
cat /tmp/xargs_err.txt
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/cleanup-dev-builds.sh` around lines 71 - 73, The pipeline that
discovers tags (used in discover_tags) can fail with set -euo pipefail when no
cmux-* dirs exist; make it safe by preventing xargs from exiting non-zero:
either add the GNU-safe flag -r to xargs (change "xargs -0 -n1 basename" to
"xargs -0 -r -n1 basename") or append "|| true" after the pipeline to swallow
the empty-input failure (e.g., the whole pipeline ending with "| xargs -0 -n1
basename || true"); update the pipeline that starts with "find
\"$DERIVED_DATA_ROOT\" -maxdepth 1 -type d -name 'cmux-*' -print0" accordingly
so discover_tags never causes the script to exit on empty results.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/commands/cleanup-builds.md:
- Around line 8-10: The markdown list items containing fenced code blocks for
the cleanup script violate MD031 (missing blank lines around fenced blocks);
insert a blank line before and after each fenced code block that shows
./scripts/cleanup-dev-builds.sh and the ./scripts/cleanup-dev-builds.sh --apply
example so the triple-backtick blocks are surrounded by blank lines (and ensure
the explanatory text "Shows what would be deleted..." and the "Optional: `--keep
<tag>`..." lines are separated accordingly).

---

Duplicate comments:
In `@scripts/cleanup-dev-builds.sh`:
- Around line 123-126: The active-tag extraction only handles paths that start
with "$DERIVED_DATA_ROOT/cmux-" so tagged paths elsewhere are missed; update the
logic around last_path/rest/active_tag to detect "/cmux-" anywhere in the path
(e.g., test if last_path contains */cmux-* or cmux- and then set
rest="${last_path#*/cmux-}" or rest="${last_path#*cmux-}" accordingly) and
derive active_tag="${rest%%/*}" only when a match is found, leaving behavior
unchanged when no cmux- segment exists.
- Around line 71-73: The pipeline that discovers tags (used in discover_tags)
can fail with set -euo pipefail when no cmux-* dirs exist; make it safe by
preventing xargs from exiting non-zero: either add the GNU-safe flag -r to xargs
(change "xargs -0 -n1 basename" to "xargs -0 -r -n1 basename") or append "||
true" after the pipeline to swallow the empty-input failure (e.g., the whole
pipeline ending with "| xargs -0 -n1 basename || true"); update the pipeline
that starts with "find \"$DERIVED_DATA_ROOT\" -maxdepth 1 -type d -name 'cmux-*'
-print0" accordingly so discover_tags never causes the script to exit on empty
results.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0b5d14a4-b9a5-4cb6-935b-e95e2b0201d5

📥 Commits

Reviewing files that changed from the base of the PR and between 5fce0a8 and 6d24084.

📒 Files selected for processing (2)
  • .claude/commands/cleanup-builds.md
  • scripts/cleanup-dev-builds.sh

Comment thread .claude/commands/cleanup-builds.md
azooz2003-bit and others added 4 commits May 27, 2026 10:24
Removes tagged dev-build artifacts produced by scripts/reload.sh:
DerivedData/cmux-<tag>/ (multi-GB each), /tmp/cmux-<tag>/, the per-tag
debug socket and logs, the reload log, and the App Support cmuxd dev
socket. Defaults to dry-run; pass --apply to delete.

Safety rules always on:
  - Skip the tag of any running `cmux DEV <tag>` app
  - Skip the tag pointed at by /tmp/cmux-last-cli-path
  - Skip any tag tied to a live git worktree
Filters: --older-than DAYS, --keep TAG (repeatable).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Existence of a git worktree with the same name is a weak signal of
active use, and HQ tends to accumulate worktrees long after the
work is done. The rule made cleanup over-protective for the typical
case (worktree still around from a merged or abandoned PR).

The remaining safety rules (skip running app, skip the tag pointed
at by /tmp/cmux-last-cli-path) plus --keep TAG and --older-than DAYS
cover what we actually want without false positives.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Wraps scripts/cleanup-dev-builds.sh with the standard preview ->
confirm -> apply flow. Sits alongside the existing .claude/commands
(pull, sync-branch, release, etc.) and enforces user confirmation
before --apply.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CodeRabbit + Greptile findings, all real:

- Active-tag extraction from /tmp/cmux-last-cli-path now uses a regex
  match on /cmux-<tag>/ anywhere in the path, not just a strict
  $DERIVED_DATA_ROOT/cmux- prefix. Also avoids the unquoted parameter
  expansion that could be sensitive to glob metacharacters in
  DERIVED_DATA_ROOT.
- discover_tags switched from find | xargs basename to a shell glob
  loop. Cleaner, works on macOS regardless of xargs flavor, handles
  the empty case naturally.
- --older-than no longer skips tags whose DerivedData was already
  deleted (age == -1 sentinel). Orphan sockets/logs for those tags
  now get cleaned instead of being silently retained.
- "freed" label reworded as "freed (estimated)" because the byte
  count is measured during planning, not after rm.
- .claude/commands/cleanup-builds.md: blank lines around fenced
  blocks (MD031).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@azooz2003-bit

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/cleanup-dev-builds.sh`:
- Around line 137-141: The script captures running tags into the running_tags
array but can include a trailing ".app" which later causes the safety check (the
comparison around lines referencing running_tags and the bare tag variable) to
miss active processes; change the regex used when populating running_tags (the
block using BASH_REMATCH and running_tags+=) to normalize by capturing the tag
without the optional ".app" (e.g., make the regex treat "\.app" as optional and
capture only the base tag) or strip ".app" via parameter expansion when
appending, and likewise normalize the tag used in the comparison (where the
script checks for "app running" against running_tags) so both sides compare the
same normalized base tag (use ${tag%.app} or equivalent) to ensure live tags are
detected reliably.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 222304bd-e167-4d20-814a-b6a023325ba3

📥 Commits

Reviewing files that changed from the base of the PR and between 6d24084 and 47a6265.

📒 Files selected for processing (2)
  • .claude/commands/cleanup-builds.md
  • scripts/cleanup-dev-builds.sh

Comment thread scripts/cleanup-dev-builds.sh
@azooz2003-bit

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
✅ Actions performed

Comments resolved and changes approved.

@azooz2003-bit
azooz2003-bit merged commit cfa0a7b into main May 27, 2026
40 checks passed
@azooz2003-bit
azooz2003-bit deleted the feat-cleanup-dev-builds branch May 27, 2026 15:51
Vangor added a commit to Vangor/most that referenced this pull request May 27, 2026
* test: cover external dot path open

* fix: open external path arguments without socket access

* fix: preserve explicit socket path opens

* fix: bound launchservices open helper

* fix: avoid blocking primitive in open helper

* fix: format localized path open errors

* fix: complete path open localization

* fix: scrub socket env for external path opens

* fix: localize path open success output

* Add cmux.xcworkspace with Packages visible alongside the project (manaflow-ai#4834)

* Add cmux.xcworkspace with Packages visible alongside the project

Top-level navigator shows cmux.xcodeproj plus every Packages/* SPM
package as siblings, so local packages are editable in the same window
without nesting under the project node. Additive only: existing
-project build flows (reload.sh, CI) keep working unchanged.

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

* Ignore xcshareddata under xcworkspaces

Xcode auto-creates xcshareddata inside .xcworkspace bundles for
WorkspaceSettings.xcsettings, IDEWorkspaceChecks.plist, and SwiftPM
configuration. None of those carry intentional shared state for cmux
today (build is driven by reload.sh and CI, no private SPM registry,
no custom file headers). Ignoring them prevents Xcode bookkeeping
churn in commits. Project-level xcshareddata (shared .xcscheme files)
is unaffected because the pattern only matches inside .xcworkspace
directories.

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

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* fix: scrub legacy panel env for path opens

* fix: limit path open locale entries

* Redesign notifications popover: bigger, minimal, swipe to dismiss (manaflow-ai#4778)

* Redesign notifications popover: bigger, minimal, swipe to dismiss

- Larger frame (min 460x480, ideal 560x620, max 760x760) so more
  notifications are visible at once.
- Compact rows with a thin accent bar for unread, tighter typography,
  hover-revealed clear button. No more boxed cards per row, just
  dividers between rows.
- Drag a row left or right to dismiss; passing the threshold slides it
  out and removes the notification. Tap to open as before.
- Empty/loading/populated states share the same outer frame so the
  popover stops resizing when notifications come and go.

* Show jump-to-latest keyboard shortcut next to button label

* Stabilize hover on notification rows: dedicated background tracking layer

.onHover and .onTapGesture on the same SwiftUI node share AppKit's
mouse-tracking pipeline and arbitrate against each other, producing
flaky enter/exit events right after the popover opens and when
crossing rows fast. Move hover detection to a transparent background
layer using .onContinuousHover, scope the opacity animation to the
background only so it does not re-animate dragOffset, and bump the
hover opacity from 0.07 to 0.11 so it is visible against
.windowBackgroundColor in light mode.

* Use NSTrackingArea for notification row hover

SwiftUI's .onHover and .onContinuousHover still arbitrate with the
parent .onTapGesture in macOS popover content, leaving rows where
hover never fires (notably on first popover open and when crossing
between LazyVStack rows). Replace the SwiftUI hover modifier with an
NSViewRepresentable that installs an NSTrackingArea
(.mouseEnteredAndExited + .activeAlways + .inVisibleRect). The
tracking NSView returns nil from hitTest so clicks pass through to
the SwiftUI parent's tap gesture, and the view syncs current
inside/outside state on tracking-area install for the case where the
pointer is already inside the row when the popover opens.

* Notifications popover: keep timestamp visible, drop hover animation, add right-click menu

- Always show row timestamp (removed the hide-on-hover opacity).
- Removed the hover background fade animation so it's an instant flip.
- Right-click a row for Open / Mark as Read / Mark as Unread / Dismiss.
- Added TerminalNotificationStore.markUnread(id:) sibling to markRead(id:).
- Added en/ja localizations for the new menu strings.

* Notifications popover: drop top margin, always semibold title

* Make notifications popover resizable, taller default

Default size bumped to 560x760 (was 560x620 ideal). User can drag a
bottom-right resize handle to set their own size; the chosen width
and height persist via @AppStorage. Bounds are 420x320 .. 1000x1200.

* Notifications popover: invisible corner resize, drop swipe-to-dismiss

NSPopover has no native resize chrome and there's no first-class
SwiftUI resize API for it. The closest native-feeling thing is a
hit-only corner region that drives a state-driven .frame: no visual
button, just a resizeLeftRight cursor on hover (closest standard
NSCursor to a diagonal resize).

Also removed swipe-to-dismiss. The hover X button and the right-click
Dismiss menu item are the dismiss surfaces; swiping rows in an
NSPopover row list isn't a macOS convention.

* Notifications popover: fix glitchy resize via AppKit screen coords

SwiftUI's DragGesture reports translation in a local coordinate space
that is literally being resized under the cursor as the popover grows.
Each frame the gesture re-derives translation from a moving anchor,
which produces dimension oscillation (the popover jumps between two
sizes).

Replace the SwiftUI gesture with an NSViewRepresentable that tracks
NSEvent.mouseLocation in global screen coordinates. Screen coordinates
are stable regardless of popover resize, so deltas are monotonic.
Also disable implicit animation on the .frame width/height so the
popover follows the cursor 1:1.

* Notifications popover: use diagonal resize cursor on bottom-right corner

* Notifications popover: address review feedback

- unreadCount uses notificationMenuSnapshot.unreadCount instead of
  reducing the live list, so the badge stays consistent with the
  hasUnreadNotifications / hasNotifications guards that drive the
  Jump to Latest / Clear All disabled states.
- Hide the visual keyboard-shortcut chip from accessibility; the
  button already exposes the shortcut via .accessibilityValue, so
  VoiceOver no longer reads it twice.
- Add a row-level accessibility action to dismiss a notification,
  since the visible clear button is hover-only. Adds the localized
  string notifications.row.clear (en/ja).

* markUnread(id:): clear manual workspace unread to avoid double-count

When a user marks a read notification unread, the notification itself
now provides the workspace unread indicator. If the workspace also had
a manual unread flag set, the popover header, dock badge, and
workspace badge would double-count that workspace because the count
builders sum notification unread counts and workspace indicators.

Mirrors what markLatestNotificationAsOldestUnread already does in the
same file. Found by Codex review.

* Restore Button wrapper on notification rows for keyboard access

Replacing the original Button with .onTapGesture removed rows from
the SwiftUI key-view loop, so keyboard-only users could tab to the
header controls but not open a row. The original reason for dropping
Button was that SwiftUI's .onHover arbitrated with the row's primary
action — but hover is now driven entirely by an AppKit NSTrackingArea
(HoverTrackingRepresentable), independent of the row's activation
node. The Button wrapper is therefore safe again and restores
space/return activation in the key-view loop. Found by Codex review.

* Notifications popover: persist resize once on mouseUp, clamp drag baseline

- Live resize uses @State (liveWidth/liveHeight); @AppStorage is
  written exactly once when the user releases the mouse, instead of
  on every mouseDragged event. Each @AppStorage write was hitting
  UserDefaults and broadcasting UserDefaults.didChangeNotification to
  every app-wide observer.
- Drag baseline now comes from the clamped (currently displayed)
  size, not raw saved doubles, so a drag that starts with out-of-bounds
  stored values doesn't lose initial pointer travel re-entering the
  visible range.

* Notifications popover: clear button as ZStack sibling, not nested in row Button

Nesting clearButton inside the row's Button(action: onOpen) label
created the classic SwiftUI nested-button hit-test problem on macOS:
clicks on the inner X could be consumed by the outer row Button's
tap area instead of clearing the notification. Move clearButton out
of rowContent and into a ZStack(alignment: .trailing) at the body
level so it's a sibling of the row Button with an independent hit
target. Found by Codex review.

* Notifications popover: clamp to screen, hide hover-only X from focus

- Clamp the popover's frame against NSScreen.main?.visibleFrame minus
  an 80pt margin so the bottom-right resize handle stays reachable
  even when the saved size was captured on a larger display.
- Mark the hover-only clear button .accessibilityHidden(!isHovering)
  so Full Keyboard Access / VoiceOver doesn't focus an invisible
  dismiss control. Dismissal is still exposed via the row's
  accessibility action and the right-click menu. Found by Codex.

* CI: retry — GitHub Actions infra was returning 403/404 on codeload

* CI: retrigger now that GitHub Actions infra is back

* Mark-as-Read context menu: clear focused pane indicator too

A user-initiated 'Mark as Read' should mirror the full dismissal
intent, so the pane's focused-read indicator for that surface should
clear alongside flipping the notification's isRead flag. Otherwise
the unread count drops but the pane badge remains visible until the
user later interacts with the terminal. Found by Codex review.

* Notifications popover: clamp against host window's screen, fix hover sync race

- Clamp popover size against the screen of NSApp.keyWindow (the
  popover's anchor window), not NSScreen.main. On multi-monitor
  setups the popover may appear on a different display than 'main'.
- Remove the DispatchQueue.main.async hop in HoverTrackingNSView's
  updateTrackingAreas; the queued onChange(true) could land after
  mouseExited's synchronous onChange(false), leaving rows stuck in
  the hovered state. updateTrackingAreas already runs on the main
  thread, so the call is fine synchronously. Found by Cursor Bugbot.

* Mark-as-Read: only clear focused pane indicator for pane-scoped notifications

clearFocusedReadIndicator treats surfaceId == nil as 'clear any pane
indicator for this tab', so passing nil for a workspace-level
notification would wipe an unrelated pane's badge. Gate the call on
notification.surfaceId being non-nil. Found by Codex review.

* Notifications popover: add a11y label/hint to resize handle

The localized notifications.resize key existed but was never wired
to the actual control. Adds .accessibilityLabel/.accessibilityHint
so VoiceOver and Full Keyboard Access users can discover the resize
affordance. Found by Cursor Bugbot.

* Notifications popover: move accessibility identifier back onto the row Button

XCUITests query rows with app.buttons["NotificationPopoverRow.<id>"].
The previous pass put .accessibilityIdentifier on the combined outer
ZStack, exposing the row as a container rather than a button, which
breaks both XCUITest lookups and the button accessibility role for
assistive tech. Move identifier + primary action + clear action back
onto the inner Button. Found by Codex review.

* Notifications popover: snapshot list before LazyVStack; clear restored unread on markUnread

- ForEach now iterates an immutable snapshot captured outside the
  LazyVStack instead of reading notificationStore.notifications
  inside the row builder; the previous code reintroduced a store
  dependency below the list boundary, which CLAUDE.md flags as the
  same anti-pattern that caused the LazyLayoutViewCache spin-loop
  in the sessions panel (manaflow-ai#2586).
- markUnread(id:) now also clears the restored workspace unread
  indicator for the tab, so a session-restored unread hint plus a
  user-toggled unread notification no longer double-count in the
  header/dock/workspace badges. Found by Codex review.

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Remove History from right sidebar (manaflow-ai#4785)

* Remove History mode from right sidebar

Drops the History tab from the right sidebar mode picker along with its
keyboard shortcut, command palette entries, and the 'Open Full History'
menu button. Recently Closed/Focused submenus and Reopen Last Closed
still work from the menu bar.

* Drop tests for deleted HistoryDayGrouping helper

* Tolerate obsolete history mode and restore focus-history menu key

- SessionRightSidebarToolPanelSnapshot now decodes an unknown mode (e.g.
  legacy 'history') as nil instead of failing the entire snapshot, so
  upgraded users can still restore prior sessions.
- Restore the 'menu.history.showFullFocusHistory' key still referenced
  by AppDelegate+FocusHistoryContextMenu for non-sidebar focus history.

* Remove duplicate @mainactor attribute left by prior edit

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Launch restored agent sessions via startup commands (manaflow-ai#4777)

* Test agent restore startup command launch

* Launch restored agents with startup commands

* Tighten restored startup launch state

* Preserve remote startup for agent restore

* Relax remote startup restore assertion

* Fix startup restore lifecycle

* Remove unused restore launch flag

* Run startup resumes in login shell

* Tighten remote restore assertion

* Handle csh agent restore launchers

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Wrap workspace titles in sidebar (manaflow-ai#4848)

* Wrap workspace titles in sidebar

* Add workspace title wrap toggle

* Localize workspace title wrap setting

* Align wrapped workspace title accessories

* Reset workspace title wrap preference

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* test: cover bare relative external path open

* fix: open bare relative path arguments externally

* fix: preserve refresh surfaces command precedence

* fix: keep bare path command matching case-sensitive

* Add secure cmux navigation links (manaflow-ai#4857)

* Add secure cmux navigation links

* Localize cmux navigation link labels

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Fix matched sidebar terminal background (manaflow-ai#4780)

* test: cover matched sidebar background tint

* fix: match sidebar terminal background

* fix: remove dead sidebar overlay path

* test: cover matched sidebar boundary separators

* fix: keep matched sidebar separators visible

* test: cover matched sidebar chrome borders

* test: sample sidebar boundary resizers

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Fix JSONC comment skipper for CRLF line endings (manaflow-ai#4869)

* Fix JSONC // comment skipper for CRLF line endings

Swift treats \r\n as a single extended grapheme cluster, so the existing
source[index] != "\n" check inside the three // line-comment skippers
never matches a CRLF line ending. On a file with CRLF throughout, the
loop runs past the rest of the file looking for a standalone LF and
strips everything after the first //. preprocess() then produces
truncated JSON and loadCmuxSettingsRoot() / jsonObject() throw
"Unexpected end of file".

This was breaking the tmux corpus terminal-nightly job's
testSurfaceResumeApprovalWritesRecordsIntoCmuxJSON, which explicitly
exercises the CRLF path. Match any character whose first scalar is CR
or LF so we stop at CR, LF, or CRLF correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Allow workflow_dispatch to run tmux corpus terminal-nightly

So this workflow's macOS test job is reproducible on demand for branches
under review, not only on the nightly schedule.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix JSONC editor indent detection for CRLF line endings

indentationBeforeLine walked back to find the start of the line
containing a given index by stopping at "\n" or "\r" characters, but on
CRLF input Swift treats "\r\n" as a single extended grapheme cluster
that equals neither. The loop then walked past every line break to the
start of the file and returned an empty indent, so newly inserted
properties (e.g. resumeCommands) ended up at the wrong indentation
level. Reuse the isLineTerminator helper that already handles CRLF
correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Open forked conversations without palette action probe (manaflow-ai#4852)

* Open forked conversations without palette action probe

* Fix fork probe snapshot selection

* Refresh fork probe cache per palette session

* Preserve verified fork probe visibility

* Preserve fork snapshot cache during live refresh

* Allow verified fallback fork execution

* Reprobe fork cache after fallback clears

* Preserve focus after instant fork commands

* Clear fork cache on execution failure

* Avoid stale fork cache on palette reopen

* Clear stale fallback fork cache before reprobe

* Preserve verified fork cache on palette reopen

* Require verified fork snapshot before fallback execution

* Track actual fork fallback usage

* Preserve verified fork cache fallback flag

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* test: cover bonsplit tab indicator drift

* fix: update bonsplit tab indicator handling

* Skip Cmd+Shift key forwarding test when Ghostty surface init fails (manaflow-ai#4871)

The tmux corpus terminal-nightly runner cannot initialize a
Metal-backed Ghostty surface; embedded_window logs
"error initializing surface err=error.OutOfMemory" for every surface
the suite creates, and ghostty_surface_new returns nil. The test then
fails XCTAssertTrue on performKeyEquivalentAfterMenuMiss because
ensureSurfaceReadyForInput cannot return a live surface, which looks
like a key-forwarding regression rather than the environment issue
that it is.

Skip the test (via XCTSkipUnless on TerminalSurface.hasLiveSurface)
when the surface fails to initialize, so CI surfaces the real problem
(Metal unavailable on this runner) without masking it as a key-bind
regression. The test still runs end-to-end on developer machines and
on runners with a logged-in GUI session.

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Add algorithmic complexity review rule (manaflow-ai#4866)

* Add algorithmic complexity review rule

* Align algorithmic complexity review hint

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Narrow AppDelegate CI quarantine (manaflow-ai#4874)

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore browser devtools config CI coverage

* Add prompt and rules deeplinks (manaflow-ai#4839)

* Add prompt and rules deeplinks

* Preserve encoded punctuation in text deeplinks

* Localize text deeplink dialogs

* Support Freestyle SSH link users

* Harden prompt and rules deeplinks

* Suppress welcome for text deeplinks

* Restore SSH deeplink trust gate

* Preserve plus signs in text deeplinks

* Respect no-focus for text deeplink target selection

* Use deterministic text deeplink target

* Start background text deeplink targets

* Report text deeplink send failures

* Handle mixed deeplink batches safely

* Gate mixed external deeplink batches

* Report failed external text deeplink sends

* Stop after handling external cmux links

* Allow multiline cmux text links

* Reject control characters in cmux text links

* Polish external cmux link handling

* Label sendTextWhenReady callbacks

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Make session index backfill linear (manaflow-ai#4868)

* Make session index backfill linear

* Stabilize session index backfill tie breaks

* Fix session index tie-break test setup

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Optimize batch workspace sidebar actions (manaflow-ai#4865)

* Optimize batch workspace sidebar actions

* Preserve workspace selection after drag reorder

* Harden workspace batch action coverage

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* test: harden bonsplit scroll indicator check

* Restore browser remote store CI coverage

* Make browser search providers configurable (manaflow-ai#4849)

* feat: make browser search providers configurable

* fix: keep parsing browser settings after invalid custom search config

* test: harden custom search config regression

* fix: handle custom search edge cases

* fix: validate custom search fallbacks

* fix: localize search engine labels

* fix: gate stale search suggestions

* fix: allow blank custom search names

* fix: add exa search provider

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore browser lifecycle CI coverage

* docs: add cmux ssh deep links (manaflow-ai#4833)

* docs: add cmux ssh deep links

* docs: add cmux deeplink fallback pages

* docs: add deeplink locale fallbacks

* docs: tighten deeplink fallback validation

* docs: mirror native ssh deeplink validation

* docs: localize deeplink messages

* docs: canonicalize rules deeplink alternates

* Allow Freestyle SSH deeplink users

* docs: validate text deeplink fallback params

* docs: ignore blank optional deeplink params

* docs: address deeplink review comments

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore file preview review CI coverage

* Pin Xcode 26 (objectVersion 60) and add pbxproj normalizer + CI guard (manaflow-ai#4836)

* Add deterministic normalizer for cmux.xcodeproj/project.pbxproj

scripts/normalize-pbxproj.py sorts the high-churn sections (PBXBuildFile,
PBXFileReference, and the files = (...) arrays inside Sources / Resources
/ Frameworks / CopyFiles build phases) into a deterministic order keyed
on the entry comment plus UUID. The Xcode build does not care about the
order of these flat dictionary sections; sorting them just kills the
nondeterministic diff noise Xcode generates on every UI touch.

Does not touch UUIDs, comments, or PBXGroup children = (...) arrays
(navigator order is intentional). Idempotent: a second run produces zero
diff.

Standalone in this commit so the diff is just the script. The next
commit applies the script and bumps objectVersion in one shot, so
the resulting churn is contained and never repeated.

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

* Pin objectVersion = 60 and normalize pbxproj

Bumps objectVersion from 56 to 60 (the format Xcode 16+ and Xcode 26
write by default) and runs scripts/normalize-pbxproj.py once to
establish the deterministic baseline. After this commit, future
diffs to project.pbxproj show only real changes, not Xcode's
nondeterministic section reordering.

One-time large diff. No semantic changes to targets, sources, build
phases, or settings: pure sort + version pin.

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

* Add tracked pre-commit hook that normalizes pbxproj

scripts/git-hooks/pre-commit calls scripts/normalize-pbxproj.py on
cmux.xcodeproj/project.pbxproj when it is staged and re-stages the
result. scripts/install-git-hooks.sh points the clone at this directory
via `git config core.hooksPath scripts/git-hooks`, and scripts/setup.sh
auto-runs it so devs get the hook without a separate manual step.

After this, Xcode's nondeterministic reordering of build-file and
file-reference sections is canceled out at commit time. The CI guard
in the next commit enforces the rule for anyone who bypasses the hook
with --no-verify or who never ran setup.

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

* Add CI guard for objectVersion pin and pbxproj normalization

scripts/check-pbxproj.sh asserts cmux.xcodeproj/project.pbxproj has
objectVersion = 60 (Xcode 26 default) and that the file is normalized
per scripts/normalize-pbxproj.py. Wired as a step in the
workflow-guard-tests job so every PR is gated.

This catches anyone who bypasses the pre-commit hook with --no-verify
or who never ran scripts/setup.sh. The error message points at the
exact fix path.

To bump the pin (e.g., when the team adopts a newer Xcode major), edit
EXPECTED_OBJECT_VERSION in this script and the matching line in
CLAUDE.md.

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

* Add .xcode-version and document Xcode 26 pin in CLAUDE.md

.xcode-version records the major (26.0) for tooling that reads it
(xcodes CLI, some CI helpers).

CLAUDE.md gains an Xcode toolchain section explaining the pin, the
normalizer + pre-commit hook + CI guard mechanics, and the procedure
for bumping the pin in the future.

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

* Read .xcode-version as the source of truth in check-pbxproj.sh

scripts/check-pbxproj.sh now reads .xcode-version and maps the Xcode
major to the expected objectVersion via a one-entry case statement.
Bumping the team's Xcode pin becomes a one-file edit (.xcode-version),
with a script update only required when Apple actually changes
objectVersion in a new Xcode major.

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

* Address CodeRabbit findings on check-pbxproj.sh and pre-commit hook

scripts/check-pbxproj.sh now passes "$PBXPROJ" explicitly to
normalize-pbxproj.py instead of letting it default to a path relative
to the current working directory, so the guard works regardless of
where CI invokes it.

scripts/git-hooks/pre-commit refuses to run when the working-tree
pbxproj has unstaged changes. Previously the hook would normalize
the working-tree file and `git add` the result, which silently staged
any unstaged hunks the user had deliberately left out of the commit.
The hook now exits non-zero with a clear message telling the user to
either stage the whole file or stash the unstaged hunks first.

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

* Address Greptile findings: misleading comment + bump-step docs

scripts/normalize-pbxproj.py: the comment said "preserve empty lines
exactly where they are" but the implementation collapses blanks to a
trailing group. Reworded the comment to match the actual behavior.

CLAUDE.md: the bump procedure now mentions opening cmux.xcodeproj in
the new Xcode so objectVersion gets rewritten automatically. Without
that step a developer following the docs alone would update only the
pin file and the script case, and the CI guard would fail on their
next commit.

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

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* Add scripts/cleanup-dev-builds.sh for safely reclaiming tagged DerivedData (manaflow-ai#4837)

* Add scripts/cleanup-dev-builds.sh

Removes tagged dev-build artifacts produced by scripts/reload.sh:
DerivedData/cmux-<tag>/ (multi-GB each), /tmp/cmux-<tag>/, the per-tag
debug socket and logs, the reload log, and the App Support cmuxd dev
socket. Defaults to dry-run; pass --apply to delete.

Safety rules always on:
  - Skip the tag of any running `cmux DEV <tag>` app
  - Skip the tag pointed at by /tmp/cmux-last-cli-path
  - Skip any tag tied to a live git worktree
Filters: --older-than DAYS, --keep TAG (repeatable).

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

* Drop "worktree exists" safety rule in cleanup-dev-builds.sh

Existence of a git worktree with the same name is a weak signal of
active use, and HQ tends to accumulate worktrees long after the
work is done. The rule made cleanup over-protective for the typical
case (worktree still around from a merged or abandoned PR).

The remaining safety rules (skip running app, skip the tag pointed
at by /tmp/cmux-last-cli-path) plus --keep TAG and --older-than DAYS
cover what we actually want without false positives.

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

* Add /cleanup-builds slash command

Wraps scripts/cleanup-dev-builds.sh with the standard preview ->
confirm -> apply flow. Sits alongside the existing .claude/commands
(pull, sync-branch, release, etc.) and enforces user confirmation
before --apply.

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

* Address review feedback on cleanup-dev-builds

CodeRabbit + Greptile findings, all real:

- Active-tag extraction from /tmp/cmux-last-cli-path now uses a regex
  match on /cmux-<tag>/ anywhere in the path, not just a strict
  $DERIVED_DATA_ROOT/cmux- prefix. Also avoids the unquoted parameter
  expansion that could be sensitive to glob metacharacters in
  DERIVED_DATA_ROOT.
- discover_tags switched from find | xargs basename to a shell glob
  loop. Cleaner, works on macOS regardless of xargs flavor, handles
  the empty case naturally.
- --older-than no longer skips tags whose DerivedData was already
  deleted (age == -1 sentinel). Orphan sockets/logs for those tags
  now get cleaned instead of being silently retained.
- "freed" label reworded as "freed (estimated)" because the byte
  count is measured during planning, not after rm.
- .claude/commands/cleanup-builds.md: blank lines around fenced
  blocks (MD031).

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

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* Fix agent resume when saved cwd is deleted (manaflow-ai#4859)

* test: cover agent resume with deleted cwd

* fix: resume agents when saved cwd is gone

* fix: harden restored cwd guard

* fix: skip ghostty cwd for guarded restore commands

* fix: drop duplicate cwd args on restore

* fix: preserve shell args during cwd cleanup

* fix: preserve custom resume cwd arguments

* fix: preserve shell syntax during cwd cleanup

* chore: remove unused shell word helper

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore file preview text saving CI coverage

* Restore browser session history CI coverage

* chore(rename): swap bundle id, product name, config dir to most

Visual rename pass — upstream-merge friendly. Touches user-visible
surfaces only; keeps Swift identifiers, package dirs, env vars,
and on-disk xcodeproj/test target names so cmux upstream merges
remain conflict-free.

- pbxproj: PRODUCT_BUNDLE_IDENTIFIER com.cmuxterm.* → com.4etverg.most*
- pbxproj: PRODUCT_NAME cmux → most ("cmux DEV" → "most DEV")
- Entitlements: app group ids release/nightly → com.4etverg.most[.nightly]
- CLI config path: ~/.config/cmux/cmux.json → ~/.config/most/most.json
- One-shot legacy config migration in KeyboardShortcutSettingsFileStore
- README.md (English) user-visible refs flipped; upstream URLs preserved

Co-Authored-By: OpenAI Codex (gpt-5.4-mini) <noreply@openai.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(configuration): rename to most.json + document migration

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
Co-authored-by: Abdulaziz Albahar <67667005+azooz2003-bit@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com>
Co-authored-by: Konstantin <your@email.ar>
Co-authored-by: OpenAI Codex (gpt-5.4-mini) <noreply@openai.com>
Vangor added a commit to Vangor/most that referenced this pull request May 30, 2026
* test: cover external dot path open

* fix: open external path arguments without socket access

* fix: preserve explicit socket path opens

* fix: bound launchservices open helper

* fix: avoid blocking primitive in open helper

* fix: format localized path open errors

* fix: complete path open localization

* fix: scrub socket env for external path opens

* fix: localize path open success output

* Add cmux.xcworkspace with Packages visible alongside the project (manaflow-ai#4834)

* Add cmux.xcworkspace with Packages visible alongside the project

Top-level navigator shows cmux.xcodeproj plus every Packages/* SPM
package as siblings, so local packages are editable in the same window
without nesting under the project node. Additive only: existing
-project build flows (reload.sh, CI) keep working unchanged.

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

* Ignore xcshareddata under xcworkspaces

Xcode auto-creates xcshareddata inside .xcworkspace bundles for
WorkspaceSettings.xcsettings, IDEWorkspaceChecks.plist, and SwiftPM
configuration. None of those carry intentional shared state for cmux
today (build is driven by reload.sh and CI, no private SPM registry,
no custom file headers). Ignoring them prevents Xcode bookkeeping
churn in commits. Project-level xcshareddata (shared .xcscheme files)
is unaffected because the pattern only matches inside .xcworkspace
directories.

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

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* fix: scrub legacy panel env for path opens

* fix: limit path open locale entries

* Redesign notifications popover: bigger, minimal, swipe to dismiss (manaflow-ai#4778)

* Redesign notifications popover: bigger, minimal, swipe to dismiss

- Larger frame (min 460x480, ideal 560x620, max 760x760) so more
  notifications are visible at once.
- Compact rows with a thin accent bar for unread, tighter typography,
  hover-revealed clear button. No more boxed cards per row, just
  dividers between rows.
- Drag a row left or right to dismiss; passing the threshold slides it
  out and removes the notification. Tap to open as before.
- Empty/loading/populated states share the same outer frame so the
  popover stops resizing when notifications come and go.

* Show jump-to-latest keyboard shortcut next to button label

* Stabilize hover on notification rows: dedicated background tracking layer

.onHover and .onTapGesture on the same SwiftUI node share AppKit's
mouse-tracking pipeline and arbitrate against each other, producing
flaky enter/exit events right after the popover opens and when
crossing rows fast. Move hover detection to a transparent background
layer using .onContinuousHover, scope the opacity animation to the
background only so it does not re-animate dragOffset, and bump the
hover opacity from 0.07 to 0.11 so it is visible against
.windowBackgroundColor in light mode.

* Use NSTrackingArea for notification row hover

SwiftUI's .onHover and .onContinuousHover still arbitrate with the
parent .onTapGesture in macOS popover content, leaving rows where
hover never fires (notably on first popover open and when crossing
between LazyVStack rows). Replace the SwiftUI hover modifier with an
NSViewRepresentable that installs an NSTrackingArea
(.mouseEnteredAndExited + .activeAlways + .inVisibleRect). The
tracking NSView returns nil from hitTest so clicks pass through to
the SwiftUI parent's tap gesture, and the view syncs current
inside/outside state on tracking-area install for the case where the
pointer is already inside the row when the popover opens.

* Notifications popover: keep timestamp visible, drop hover animation, add right-click menu

- Always show row timestamp (removed the hide-on-hover opacity).
- Removed the hover background fade animation so it's an instant flip.
- Right-click a row for Open / Mark as Read / Mark as Unread / Dismiss.
- Added TerminalNotificationStore.markUnread(id:) sibling to markRead(id:).
- Added en/ja localizations for the new menu strings.

* Notifications popover: drop top margin, always semibold title

* Make notifications popover resizable, taller default

Default size bumped to 560x760 (was 560x620 ideal). User can drag a
bottom-right resize handle to set their own size; the chosen width
and height persist via @AppStorage. Bounds are 420x320 .. 1000x1200.

* Notifications popover: invisible corner resize, drop swipe-to-dismiss

NSPopover has no native resize chrome and there's no first-class
SwiftUI resize API for it. The closest native-feeling thing is a
hit-only corner region that drives a state-driven .frame: no visual
button, just a resizeLeftRight cursor on hover (closest standard
NSCursor to a diagonal resize).

Also removed swipe-to-dismiss. The hover X button and the right-click
Dismiss menu item are the dismiss surfaces; swiping rows in an
NSPopover row list isn't a macOS convention.

* Notifications popover: fix glitchy resize via AppKit screen coords

SwiftUI's DragGesture reports translation in a local coordinate space
that is literally being resized under the cursor as the popover grows.
Each frame the gesture re-derives translation from a moving anchor,
which produces dimension oscillation (the popover jumps between two
sizes).

Replace the SwiftUI gesture with an NSViewRepresentable that tracks
NSEvent.mouseLocation in global screen coordinates. Screen coordinates
are stable regardless of popover resize, so deltas are monotonic.
Also disable implicit animation on the .frame width/height so the
popover follows the cursor 1:1.

* Notifications popover: use diagonal resize cursor on bottom-right corner

* Notifications popover: address review feedback

- unreadCount uses notificationMenuSnapshot.unreadCount instead of
  reducing the live list, so the badge stays consistent with the
  hasUnreadNotifications / hasNotifications guards that drive the
  Jump to Latest / Clear All disabled states.
- Hide the visual keyboard-shortcut chip from accessibility; the
  button already exposes the shortcut via .accessibilityValue, so
  VoiceOver no longer reads it twice.
- Add a row-level accessibility action to dismiss a notification,
  since the visible clear button is hover-only. Adds the localized
  string notifications.row.clear (en/ja).

* markUnread(id:): clear manual workspace unread to avoid double-count

When a user marks a read notification unread, the notification itself
now provides the workspace unread indicator. If the workspace also had
a manual unread flag set, the popover header, dock badge, and
workspace badge would double-count that workspace because the count
builders sum notification unread counts and workspace indicators.

Mirrors what markLatestNotificationAsOldestUnread already does in the
same file. Found by Codex review.

* Restore Button wrapper on notification rows for keyboard access

Replacing the original Button with .onTapGesture removed rows from
the SwiftUI key-view loop, so keyboard-only users could tab to the
header controls but not open a row. The original reason for dropping
Button was that SwiftUI's .onHover arbitrated with the row's primary
action — but hover is now driven entirely by an AppKit NSTrackingArea
(HoverTrackingRepresentable), independent of the row's activation
node. The Button wrapper is therefore safe again and restores
space/return activation in the key-view loop. Found by Codex review.

* Notifications popover: persist resize once on mouseUp, clamp drag baseline

- Live resize uses @State (liveWidth/liveHeight); @AppStorage is
  written exactly once when the user releases the mouse, instead of
  on every mouseDragged event. Each @AppStorage write was hitting
  UserDefaults and broadcasting UserDefaults.didChangeNotification to
  every app-wide observer.
- Drag baseline now comes from the clamped (currently displayed)
  size, not raw saved doubles, so a drag that starts with out-of-bounds
  stored values doesn't lose initial pointer travel re-entering the
  visible range.

* Notifications popover: clear button as ZStack sibling, not nested in row Button

Nesting clearButton inside the row's Button(action: onOpen) label
created the classic SwiftUI nested-button hit-test problem on macOS:
clicks on the inner X could be consumed by the outer row Button's
tap area instead of clearing the notification. Move clearButton out
of rowContent and into a ZStack(alignment: .trailing) at the body
level so it's a sibling of the row Button with an independent hit
target. Found by Codex review.

* Notifications popover: clamp to screen, hide hover-only X from focus

- Clamp the popover's frame against NSScreen.main?.visibleFrame minus
  an 80pt margin so the bottom-right resize handle stays reachable
  even when the saved size was captured on a larger display.
- Mark the hover-only clear button .accessibilityHidden(!isHovering)
  so Full Keyboard Access / VoiceOver doesn't focus an invisible
  dismiss control. Dismissal is still exposed via the row's
  accessibility action and the right-click menu. Found by Codex.

* CI: retry — GitHub Actions infra was returning 403/404 on codeload

* CI: retrigger now that GitHub Actions infra is back

* Mark-as-Read context menu: clear focused pane indicator too

A user-initiated 'Mark as Read' should mirror the full dismissal
intent, so the pane's focused-read indicator for that surface should
clear alongside flipping the notification's isRead flag. Otherwise
the unread count drops but the pane badge remains visible until the
user later interacts with the terminal. Found by Codex review.

* Notifications popover: clamp against host window's screen, fix hover sync race

- Clamp popover size against the screen of NSApp.keyWindow (the
  popover's anchor window), not NSScreen.main. On multi-monitor
  setups the popover may appear on a different display than 'main'.
- Remove the DispatchQueue.main.async hop in HoverTrackingNSView's
  updateTrackingAreas; the queued onChange(true) could land after
  mouseExited's synchronous onChange(false), leaving rows stuck in
  the hovered state. updateTrackingAreas already runs on the main
  thread, so the call is fine synchronously. Found by Cursor Bugbot.

* Mark-as-Read: only clear focused pane indicator for pane-scoped notifications

clearFocusedReadIndicator treats surfaceId == nil as 'clear any pane
indicator for this tab', so passing nil for a workspace-level
notification would wipe an unrelated pane's badge. Gate the call on
notification.surfaceId being non-nil. Found by Codex review.

* Notifications popover: add a11y label/hint to resize handle

The localized notifications.resize key existed but was never wired
to the actual control. Adds .accessibilityLabel/.accessibilityHint
so VoiceOver and Full Keyboard Access users can discover the resize
affordance. Found by Cursor Bugbot.

* Notifications popover: move accessibility identifier back onto the row Button

XCUITests query rows with app.buttons["NotificationPopoverRow.<id>"].
The previous pass put .accessibilityIdentifier on the combined outer
ZStack, exposing the row as a container rather than a button, which
breaks both XCUITest lookups and the button accessibility role for
assistive tech. Move identifier + primary action + clear action back
onto the inner Button. Found by Codex review.

* Notifications popover: snapshot list before LazyVStack; clear restored unread on markUnread

- ForEach now iterates an immutable snapshot captured outside the
  LazyVStack instead of reading notificationStore.notifications
  inside the row builder; the previous code reintroduced a store
  dependency below the list boundary, which CLAUDE.md flags as the
  same anti-pattern that caused the LazyLayoutViewCache spin-loop
  in the sessions panel (manaflow-ai#2586).
- markUnread(id:) now also clears the restored workspace unread
  indicator for the tab, so a session-restored unread hint plus a
  user-toggled unread notification no longer double-count in the
  header/dock/workspace badges. Found by Codex review.

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Remove History from right sidebar (manaflow-ai#4785)

* Remove History mode from right sidebar

Drops the History tab from the right sidebar mode picker along with its
keyboard shortcut, command palette entries, and the 'Open Full History'
menu button. Recently Closed/Focused submenus and Reopen Last Closed
still work from the menu bar.

* Drop tests for deleted HistoryDayGrouping helper

* Tolerate obsolete history mode and restore focus-history menu key

- SessionRightSidebarToolPanelSnapshot now decodes an unknown mode (e.g.
  legacy 'history') as nil instead of failing the entire snapshot, so
  upgraded users can still restore prior sessions.
- Restore the 'menu.history.showFullFocusHistory' key still referenced
  by AppDelegate+FocusHistoryContextMenu for non-sidebar focus history.

* Remove duplicate @mainactor attribute left by prior edit

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Launch restored agent sessions via startup commands (manaflow-ai#4777)

* Test agent restore startup command launch

* Launch restored agents with startup commands

* Tighten restored startup launch state

* Preserve remote startup for agent restore

* Relax remote startup restore assertion

* Fix startup restore lifecycle

* Remove unused restore launch flag

* Run startup resumes in login shell

* Tighten remote restore assertion

* Handle csh agent restore launchers

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Wrap workspace titles in sidebar (manaflow-ai#4848)

* Wrap workspace titles in sidebar

* Add workspace title wrap toggle

* Localize workspace title wrap setting

* Align wrapped workspace title accessories

* Reset workspace title wrap preference

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* test: cover bare relative external path open

* fix: open bare relative path arguments externally

* fix: preserve refresh surfaces command precedence

* fix: keep bare path command matching case-sensitive

* Add secure cmux navigation links (manaflow-ai#4857)

* Add secure cmux navigation links

* Localize cmux navigation link labels

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Fix matched sidebar terminal background (manaflow-ai#4780)

* test: cover matched sidebar background tint

* fix: match sidebar terminal background

* fix: remove dead sidebar overlay path

* test: cover matched sidebar boundary separators

* fix: keep matched sidebar separators visible

* test: cover matched sidebar chrome borders

* test: sample sidebar boundary resizers

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Fix JSONC comment skipper for CRLF line endings (manaflow-ai#4869)

* Fix JSONC // comment skipper for CRLF line endings

Swift treats \r\n as a single extended grapheme cluster, so the existing
source[index] != "\n" check inside the three // line-comment skippers
never matches a CRLF line ending. On a file with CRLF throughout, the
loop runs past the rest of the file looking for a standalone LF and
strips everything after the first //. preprocess() then produces
truncated JSON and loadCmuxSettingsRoot() / jsonObject() throw
"Unexpected end of file".

This was breaking the tmux corpus terminal-nightly job's
testSurfaceResumeApprovalWritesRecordsIntoCmuxJSON, which explicitly
exercises the CRLF path. Match any character whose first scalar is CR
or LF so we stop at CR, LF, or CRLF correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Allow workflow_dispatch to run tmux corpus terminal-nightly

So this workflow's macOS test job is reproducible on demand for branches
under review, not only on the nightly schedule.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix JSONC editor indent detection for CRLF line endings

indentationBeforeLine walked back to find the start of the line
containing a given index by stopping at "\n" or "\r" characters, but on
CRLF input Swift treats "\r\n" as a single extended grapheme cluster
that equals neither. The loop then walked past every line break to the
start of the file and returned an empty indent, so newly inserted
properties (e.g. resumeCommands) ended up at the wrong indentation
level. Reuse the isLineTerminator helper that already handles CRLF
correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Open forked conversations without palette action probe (manaflow-ai#4852)

* Open forked conversations without palette action probe

* Fix fork probe snapshot selection

* Refresh fork probe cache per palette session

* Preserve verified fork probe visibility

* Preserve fork snapshot cache during live refresh

* Allow verified fallback fork execution

* Reprobe fork cache after fallback clears

* Preserve focus after instant fork commands

* Clear fork cache on execution failure

* Avoid stale fork cache on palette reopen

* Clear stale fallback fork cache before reprobe

* Preserve verified fork cache on palette reopen

* Require verified fork snapshot before fallback execution

* Track actual fork fallback usage

* Preserve verified fork cache fallback flag

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* test: cover bonsplit tab indicator drift

* fix: update bonsplit tab indicator handling

* Skip Cmd+Shift key forwarding test when Ghostty surface init fails (manaflow-ai#4871)

The tmux corpus terminal-nightly runner cannot initialize a
Metal-backed Ghostty surface; embedded_window logs
"error initializing surface err=error.OutOfMemory" for every surface
the suite creates, and ghostty_surface_new returns nil. The test then
fails XCTAssertTrue on performKeyEquivalentAfterMenuMiss because
ensureSurfaceReadyForInput cannot return a live surface, which looks
like a key-forwarding regression rather than the environment issue
that it is.

Skip the test (via XCTSkipUnless on TerminalSurface.hasLiveSurface)
when the surface fails to initialize, so CI surfaces the real problem
(Metal unavailable on this runner) without masking it as a key-bind
regression. The test still runs end-to-end on developer machines and
on runners with a logged-in GUI session.

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Add algorithmic complexity review rule (manaflow-ai#4866)

* Add algorithmic complexity review rule

* Align algorithmic complexity review hint

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Narrow AppDelegate CI quarantine (manaflow-ai#4874)

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore browser devtools config CI coverage

* Add prompt and rules deeplinks (manaflow-ai#4839)

* Add prompt and rules deeplinks

* Preserve encoded punctuation in text deeplinks

* Localize text deeplink dialogs

* Support Freestyle SSH link users

* Harden prompt and rules deeplinks

* Suppress welcome for text deeplinks

* Restore SSH deeplink trust gate

* Preserve plus signs in text deeplinks

* Respect no-focus for text deeplink target selection

* Use deterministic text deeplink target

* Start background text deeplink targets

* Report text deeplink send failures

* Handle mixed deeplink batches safely

* Gate mixed external deeplink batches

* Report failed external text deeplink sends

* Stop after handling external cmux links

* Allow multiline cmux text links

* Reject control characters in cmux text links

* Polish external cmux link handling

* Label sendTextWhenReady callbacks

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Make session index backfill linear (manaflow-ai#4868)

* Make session index backfill linear

* Stabilize session index backfill tie breaks

* Fix session index tie-break test setup

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Optimize batch workspace sidebar actions (manaflow-ai#4865)

* Optimize batch workspace sidebar actions

* Preserve workspace selection after drag reorder

* Harden workspace batch action coverage

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* test: harden bonsplit scroll indicator check

* Restore browser remote store CI coverage

* Make browser search providers configurable (manaflow-ai#4849)

* feat: make browser search providers configurable

* fix: keep parsing browser settings after invalid custom search config

* test: harden custom search config regression

* fix: handle custom search edge cases

* fix: validate custom search fallbacks

* fix: localize search engine labels

* fix: gate stale search suggestions

* fix: allow blank custom search names

* fix: add exa search provider

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore browser lifecycle CI coverage

* docs: add cmux ssh deep links (manaflow-ai#4833)

* docs: add cmux ssh deep links

* docs: add cmux deeplink fallback pages

* docs: add deeplink locale fallbacks

* docs: tighten deeplink fallback validation

* docs: mirror native ssh deeplink validation

* docs: localize deeplink messages

* docs: canonicalize rules deeplink alternates

* Allow Freestyle SSH deeplink users

* docs: validate text deeplink fallback params

* docs: ignore blank optional deeplink params

* docs: address deeplink review comments

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore file preview review CI coverage

* Pin Xcode 26 (objectVersion 60) and add pbxproj normalizer + CI guard (manaflow-ai#4836)

* Add deterministic normalizer for cmux.xcodeproj/project.pbxproj

scripts/normalize-pbxproj.py sorts the high-churn sections (PBXBuildFile,
PBXFileReference, and the files = (...) arrays inside Sources / Resources
/ Frameworks / CopyFiles build phases) into a deterministic order keyed
on the entry comment plus UUID. The Xcode build does not care about the
order of these flat dictionary sections; sorting them just kills the
nondeterministic diff noise Xcode generates on every UI touch.

Does not touch UUIDs, comments, or PBXGroup children = (...) arrays
(navigator order is intentional). Idempotent: a second run produces zero
diff.

Standalone in this commit so the diff is just the script. The next
commit applies the script and bumps objectVersion in one shot, so
the resulting churn is contained and never repeated.

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

* Pin objectVersion = 60 and normalize pbxproj

Bumps objectVersion from 56 to 60 (the format Xcode 16+ and Xcode 26
write by default) and runs scripts/normalize-pbxproj.py once to
establish the deterministic baseline. After this commit, future
diffs to project.pbxproj show only real changes, not Xcode's
nondeterministic section reordering.

One-time large diff. No semantic changes to targets, sources, build
phases, or settings: pure sort + version pin.

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

* Add tracked pre-commit hook that normalizes pbxproj

scripts/git-hooks/pre-commit calls scripts/normalize-pbxproj.py on
cmux.xcodeproj/project.pbxproj when it is staged and re-stages the
result. scripts/install-git-hooks.sh points the clone at this directory
via `git config core.hooksPath scripts/git-hooks`, and scripts/setup.sh
auto-runs it so devs get the hook without a separate manual step.

After this, Xcode's nondeterministic reordering of build-file and
file-reference sections is canceled out at commit time. The CI guard
in the next commit enforces the rule for anyone who bypasses the hook
with --no-verify or who never ran setup.

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

* Add CI guard for objectVersion pin and pbxproj normalization

scripts/check-pbxproj.sh asserts cmux.xcodeproj/project.pbxproj has
objectVersion = 60 (Xcode 26 default) and that the file is normalized
per scripts/normalize-pbxproj.py. Wired as a step in the
workflow-guard-tests job so every PR is gated.

This catches anyone who bypasses the pre-commit hook with --no-verify
or who never ran scripts/setup.sh. The error message points at the
exact fix path.

To bump the pin (e.g., when the team adopts a newer Xcode major), edit
EXPECTED_OBJECT_VERSION in this script and the matching line in
CLAUDE.md.

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

* Add .xcode-version and document Xcode 26 pin in CLAUDE.md

.xcode-version records the major (26.0) for tooling that reads it
(xcodes CLI, some CI helpers).

CLAUDE.md gains an Xcode toolchain section explaining the pin, the
normalizer + pre-commit hook + CI guard mechanics, and the procedure
for bumping the pin in the future.

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

* Read .xcode-version as the source of truth in check-pbxproj.sh

scripts/check-pbxproj.sh now reads .xcode-version and maps the Xcode
major to the expected objectVersion via a one-entry case statement.
Bumping the team's Xcode pin becomes a one-file edit (.xcode-version),
with a script update only required when Apple actually changes
objectVersion in a new Xcode major.

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

* Address CodeRabbit findings on check-pbxproj.sh and pre-commit hook

scripts/check-pbxproj.sh now passes "$PBXPROJ" explicitly to
normalize-pbxproj.py instead of letting it default to a path relative
to the current working directory, so the guard works regardless of
where CI invokes it.

scripts/git-hooks/pre-commit refuses to run when the working-tree
pbxproj has unstaged changes. Previously the hook would normalize
the working-tree file and `git add` the result, which silently staged
any unstaged hunks the user had deliberately left out of the commit.
The hook now exits non-zero with a clear message telling the user to
either stage the whole file or stash the unstaged hunks first.

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

* Address Greptile findings: misleading comment + bump-step docs

scripts/normalize-pbxproj.py: the comment said "preserve empty lines
exactly where they are" but the implementation collapses blanks to a
trailing group. Reworded the comment to match the actual behavior.

CLAUDE.md: the bump procedure now mentions opening cmux.xcodeproj in
the new Xcode so objectVersion gets rewritten automatically. Without
that step a developer following the docs alone would update only the
pin file and the script case, and the CI guard would fail on their
next commit.

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

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* Add scripts/cleanup-dev-builds.sh for safely reclaiming tagged DerivedData (manaflow-ai#4837)

* Add scripts/cleanup-dev-builds.sh

Removes tagged dev-build artifacts produced by scripts/reload.sh:
DerivedData/cmux-<tag>/ (multi-GB each), /tmp/cmux-<tag>/, the per-tag
debug socket and logs, the reload log, and the App Support cmuxd dev
socket. Defaults to dry-run; pass --apply to delete.

Safety rules always on:
  - Skip the tag of any running `cmux DEV <tag>` app
  - Skip the tag pointed at by /tmp/cmux-last-cli-path
  - Skip any tag tied to a live git worktree
Filters: --older-than DAYS, --keep TAG (repeatable).

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

* Drop "worktree exists" safety rule in cleanup-dev-builds.sh

Existence of a git worktree with the same name is a weak signal of
active use, and HQ tends to accumulate worktrees long after the
work is done. The rule made cleanup over-protective for the typical
case (worktree still around from a merged or abandoned PR).

The remaining safety rules (skip running app, skip the tag pointed
at by /tmp/cmux-last-cli-path) plus --keep TAG and --older-than DAYS
cover what we actually want without false positives.

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

* Add /cleanup-builds slash command

Wraps scripts/cleanup-dev-builds.sh with the standard preview ->
confirm -> apply flow. Sits alongside the existing .claude/commands
(pull, sync-branch, release, etc.) and enforces user confirmation
before --apply.

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

* Address review feedback on cleanup-dev-builds

CodeRabbit + Greptile findings, all real:

- Active-tag extraction from /tmp/cmux-last-cli-path now uses a regex
  match on /cmux-<tag>/ anywhere in the path, not just a strict
  $DERIVED_DATA_ROOT/cmux- prefix. Also avoids the unquoted parameter
  expansion that could be sensitive to glob metacharacters in
  DERIVED_DATA_ROOT.
- discover_tags switched from find | xargs basename to a shell glob
  loop. Cleaner, works on macOS regardless of xargs flavor, handles
  the empty case naturally.
- --older-than no longer skips tags whose DerivedData was already
  deleted (age == -1 sentinel). Orphan sockets/logs for those tags
  now get cleaned instead of being silently retained.
- "freed" label reworded as "freed (estimated)" because the byte
  count is measured during planning, not after rm.
- .claude/commands/cleanup-builds.md: blank lines around fenced
  blocks (MD031).

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

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* Fix agent resume when saved cwd is deleted (manaflow-ai#4859)

* test: cover agent resume with deleted cwd

* fix: resume agents when saved cwd is gone

* fix: harden restored cwd guard

* fix: skip ghostty cwd for guarded restore commands

* fix: drop duplicate cwd args on restore

* fix: preserve shell args during cwd cleanup

* fix: preserve custom resume cwd arguments

* fix: preserve shell syntax during cwd cleanup

* chore: remove unused shell word helper

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>

* Restore file preview text saving CI coverage

* Restore browser session history CI coverage

* chore(rename): swap bundle id, product name, config dir to most

Visual rename pass — upstream-merge friendly. Touches user-visible
surfaces only; keeps Swift identifiers, package dirs, env vars,
and on-disk xcodeproj/test target names so cmux upstream merges
remain conflict-free.

- pbxproj: PRODUCT_BUNDLE_IDENTIFIER com.cmuxterm.* → com.4etverg.most*
- pbxproj: PRODUCT_NAME cmux → most ("cmux DEV" → "most DEV")
- Entitlements: app group ids release/nightly → com.4etverg.most[.nightly]
- CLI config path: ~/.config/cmux/cmux.json → ~/.config/most/most.json
- One-shot legacy config migration in KeyboardShortcutSettingsFileStore
- README.md (English) user-visible refs flipped; upstream URLs preserved

Co-Authored-By: OpenAI Codex (gpt-5.4-mini) <noreply@openai.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(configuration): rename to most.json + document migration

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
Co-authored-by: Abdulaziz Albahar <67667005+azooz2003-bit@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com>
Co-authored-by: Konstantin <your@email.ar>
Co-authored-by: OpenAI Codex (gpt-5.4-mini) <noreply@openai.com>

This branch was successfully deployed

1 active deployment
Preview – cmux — 47a6265c Deployed May 27, 2026 by vercel[bot]
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