Skip to content

fix: restore app target compilation broken by #8567 worktree identity fields - #10777

Merged
austinywang merged 3 commits into
mainfrom
fix-main-compile-worktree-result
Aug 26, 2026
Merged

austinywang merged 3 commits into
mainfrom
fix-main-compile-worktree-result

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

main's app target does not compile since commit 6cf5630 (#8567). Evidence: speculative merge-gate run https://github.com/manaflow-ai/cmux/actions/runs/32919392868, job tests-build-and-lag, step "Build for runtime regressions", exit 65 with two errors in Sources/ExtensionWorktreePrototype.swift.

This is a forward-fix, not a revert: #8567's behavior (rollback refuses to touch a replaced checkout, PTY respawn fix) is worth keeping.

A let property with an initial value is excluded from Swift's synthesized memberwise initializer, so declaring let worktreeDeviceID: UInt64? = nil made the createWorktree call that passes worktreeDeviceID:/worktreeFileID: fail with "extra arguments at positions #8, #9 in call". Dropping the = nil defaults puts both fields back into the memberwise init, and the real captured identity keeps flowing into the result so rollback can still refuse a replaced checkout. The test-only call site in cmuxTests/ExtensionWorktreeSpawnArgsTests.swift now passes nil for both labels.

Second error, in bestEffortCleanupFailedWorktree: filesystemIdentity(at:) returns an optional tuple and == is not lifted over optional tuples, so the guard now binds currentIdentity first and compares the unwrapped values.

Third error, found while running the touched test class on a remote builder: the group.addTask closure in rollbackRetainsEditsWrittenThroughOpenArtifactDescriptor has more than one statement, so it gets no implicit return and failed with "missing return in closure expected to return 'Int32?'". An explicit return fixes it.

Verification: the app target builds clean from this branch on a fleet Mac (cloud reload run https://github.com/manaflow-ai/cmux/actions/runs/32921947474, blacksmith-6vcpu-macos-26), and xcodebuild -scheme cmux-unit -only-testing:cmuxTests/ExtensionWorktreeSpawnArgsTests test runs on the AWS builder.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when handling failed worktree creation and cleanup.
    • Preserved existing cleanup behavior while ensuring filesystem identity checks are performed consistently.
    • Improved consistency when reporting worktree creation results.
  • Tests

    • Updated worktree creation test coverage to reflect required result details.
    • Refined asynchronous test handling for more dependable validation.

Commit 6cf5630 (#8567) declared worktreeDeviceID/worktreeFileID as
'let ... = nil', which removes them from the synthesized memberwise
initializer, so the createWorktree call passing both labels failed to
compile. Drop the defaults so the fields enter the memberwise init and
the captured identity keeps flowing to rollback.

Also unwrap the optional identity tuple in
bestEffortCleanupFailedWorktree before comparing, since == is not
lifted over optional tuples.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4dfeb01f-ab11-456d-bf29-f573ddbbabf3

📥 Commits

Reviewing files that changed from the base of the PR and between 1ae07e4 and 9bbb072.

📒 Files selected for processing (1)
  • cmuxTests/ExtensionWorktreeSpawnArgsTests.swift

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


📝 Walkthrough

Walkthrough

The worktree creation result now requires explicit filesystem identity values. Cleanup keeps its existing identity guard. Tests provide explicit nil identifiers and return awaited mutation results directly.

Changes

Worktree identity handling

Layer / File(s) Summary
Identity contract and cleanup handling
Sources/ExtensionWorktreePrototype.swift, cmuxTests/ExtensionWorktreeSpawnArgsTests.swift
CmuxExtensionWorktreeCreationResult requires explicit device and file identifiers. Failed-worktree cleanup preserves its identity guard. Tests provide nil identifiers explicitly and return awaited mutation results directly.

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

Merge Risk: ⚪ Minimal · up to 9bbb0

This PR makes localized fixes to restore compilation and update affected test calls, with build and targeted test verification reported; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: austinywang

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed PASS. The production diff only removes default values from two stored properties and binds the optional filesystem identity to currentIdentity before comparison. It adds no @MainActor isolation, s…
Cmux Swift Blocking Runtime ✅ Passed PASS. The production diff only removes = nil defaults from two stored properties and binds currentIdentity before comparison. It adds no semaphore, blocking wait, sleep, delayed dispatch, polling,…
Cmux Browser Automation Off-Main ✅ Passed PASS: The pull-request diff contains only Sources/ExtensionWorktreePrototype.swift and cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. It adds no browser.* socket command, WebKit wait, worker-r…
Cmux Expensive Synchronous Load ✅ Passed The production diff changes only CmuxExtensionWorktreeCreationResult initializer fields and binds an existing filesystem identity before comparison. It adds no agent-history/session-store, transcrip…
Cmux Cache Substitution Correctness ✅ Passed PASS: The production diff does not replace a fresh authoritative read with a cached or opportunistic value. It removes default values from worktreeDeviceID and worktreeFileID, while `createWorktre…
Cmux No Hacky Sleeps ✅ Passed PASS. The custom check covers TypeScript, JavaScript, shell, and non-Swift build/runtime scripts. The PR changes only Sources/ExtensionWorktreePrototype.swift and `cmuxTests/ExtensionWorktreeSpawnAr…
Cmux Algorithmic Complexity ✅ Passed PASS: The PR diff introduces no algorithmic-complexity violation. Production changes only remove initializer defaults and bind one optional filesystem identity before a constant-time tuple comparison …
Cmux Swift Concurrency ✅ Passed PASS: The diff adds no prohibited legacy async pattern. The production changes only adjust initializer fields and optional identity comparison. The test changes add explicit nil arguments and an exp…
Cmux Swift @Concurrent ✅ Passed PASS: The combined PR diff changes only initializer arguments, optional-identity comparison, and a test task-group return. It does not add or remove @concurrent, nonisolated, async, actor isolat…
Cmux Swift Package Boundaries ✅ Passed PASS. The production diff only fixes initialization and optional tuple comparison in Sources/ExtensionWorktreePrototype.swift; it does not introduce or materially expand a feature. The file and symb…
Cmux Swiftpm Lockfiles ✅ Passed PASS — The PR diff from c819cdf to HEAD changes only Sources/ExtensionWorktreePrototype.swift and cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. It contains no Package.swift, `Package.resolve…
Cmux Swift Logging ✅ Passed PASS. The PR diff adds only worktree identity initialization, optional-identity comparison, and an explicit test-task return. It adds or materially changes no print, debugPrint, dump, NSLog, f…
Cmux User-Facing Error Privacy ✅ Passed PASS: The production diff only removes default values from two identity fields and unwraps the filesystem identity before comparison. It adds no user-facing error, alert, command output, API body, or …
Cmux Full Internationalization ✅ Passed PASS: The PR changes only Swift data-flow and cleanup logic in production code, plus test fixtures and async test control flow. The production diff adds no user-facing text, localization keys, catalog…
Cmux Swiftui State Layout ✅ Passed PASS. The diff changes only worktree identity initialization, cleanup comparison, and a test task-group return. The changed Swift files import Foundation/OSLog, not SwiftUI, and introduce no Observabl…
Cmux Architecture Rethink ✅ Passed PASS: The diff contains small local Swift correctness fixes. It removes default values so CmuxExtensionWorktreeCreationResult retains the synthesized initializer parameters and preserves the capture…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The diff changes only worktree result initialization, filesystem-identity cleanup, and a test fixture. It adds no NSWindow, NSPanel, NSWindowController, SwiftUI Window, WindowGroup, window ident…
Cmux Source Artifacts ✅ Passed The full PR diff changes only Sources/ExtensionWorktreePrototype.swift and cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. These are hand-written product source and test files. The changes add in…
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS — The PR adds no test or debug seam in production source. The only changed production lines remove default values from worktreeDeviceID and worktreeFileID and bind currentIdentity before co…
Cmux No Ambient Global State ✅ Passed PASS: The production diff only removes default values from two stored let properties on CmuxExtensionWorktreeCreationResult and binds a local currentIdentity inside the existing private cleanup …
Description check ✅ Passed The description clearly explains what changed, why the compilation failed, and how the fix was tested. It omits the template checklist and review-trigger block, but these omissions are non-critical be…
Title check ✅ Passed The title clearly identifies the fix and its purpose: restoring app-target compilation after the worktree identity field changes from #8567.
Full details: Cmux Swift Actor Isolation

Explanation

PASS. The production diff only removes default values from two stored properties and binds the optional filesystem identity to currentIdentity before comparison. It adds no @MainActor isolation, service protocol, Sendable reference type, UI store access, or file-scoped logger. The affected Sendable value type and detached worktree code already existed in the parent revision. The remaining changes are test-only, which the check allows.

Full details: Cmux Swift Blocking Runtime

Explanation

PASS. The production diff only removes = nil defaults from two stored properties and binds currentIdentity before comparison. It adds no semaphore, blocking wait, sleep, delayed dispatch, polling, main-queue sync, or lock. The existing NSLock is unchanged. The only Task.sleep remains in deterministic test-only scaffolding, which the rule allows.

Full details: Cmux Browser Automation Off-Main

Explanation

PASS: The pull-request diff contains only Sources/ExtensionWorktreePrototype.swift and cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. It adds no browser.* socket command, WebKit wait, worker-router change, or browser policy test change. The custom check is therefore not applicable.

Full details: Cmux Expensive Synchronous Load

Explanation

The production diff changes only CmuxExtensionWorktreeCreationResult initializer fields and binds an existing filesystem identity before comparison. It adds no agent-history/session-store, transcript, trajectory, JSONL, broad-scan, or large parsing load, and it does not add or move work into a main-actor or interactive handler. The remaining changes are test-only.

Full details: Cmux Cache Substitution Correctness

Explanation

PASS: The production diff does not replace a fresh authoritative read with a cached or opportunistic value. It removes default values from worktreeDeviceID and worktreeFileID, while createWorktree still captures Self.filesystemIdentity(at: worktree) and passes that identity into the result. The cleanup change only binds the result of filesystemIdentity(at:) before comparison. These changes are not cache substitutions in a persistence, history, undo, or snapshot path. The remaining changes are test-only.

Full details: Cmux No Hacky Sleeps

Explanation

PASS. The custom check covers TypeScript, JavaScript, shell, and non-Swift build/runtime scripts. The PR changes only Sources/ExtensionWorktreePrototype.swift and cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. The Task.sleep(for: .seconds(5)) shown in the test is unchanged and is Swift test scaffolding, so it is out of scope and not worsened by this PR.

Full details: Cmux Algorithmic Complexity

Explanation

PASS: The PR diff introduces no algorithmic-complexity violation. Production changes only remove initializer defaults and bind one optional filesystem identity before a constant-time tuple comparison in Sources/ExtensionWorktreePrototype.swift; they add no loops, collection scans, sorting, filtering, joins, or batch rescans. The remaining changes are test fixture initialization and an explicit return in test-only code, which the rule excludes.

Full details: Cmux Swift Concurrency

Explanation

PASS: The diff adds no prohibited legacy async pattern. The production changes only adjust initializer fields and optional identity comparison. The test changes add explicit nil arguments and an explicit return in an existing withTaskGroup closure. The existing DispatchQueue test synchronization is unchanged and is allowed for a controlled race.

Full details: Cmux Swift `@Concurrent`

Explanation

PASS: The combined PR diff changes only initializer arguments, optional-identity comparison, and a test task-group return. It does not add or remove @concurrent, nonisolated, async, actor isolation, or async call sites. The affected rollback method already has @concurrent and uses Task.detached; createWorktree and bestEffortCleanupFailedWorktree retain their existing isolation and execution structure. The new filesystem identity binding does not introduce a UI-isolation call path.

Full details: Cmux Swift Package Boundaries

Explanation

PASS. The production diff only fixes initialization and optional tuple comparison in Sources/ExtensionWorktreePrototype.swift; it does not introduce or materially expand a feature. The file and symbols are explicitly worktree prototype code, which the boundary rule allows. The remaining changes are test-fixture updates in cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. No new reusable domain logic or package-boundary candidate appears in the diff.

Full details: Cmux Swiftpm Lockfiles

Explanation

PASS — The PR diff from c819cdf to HEAD changes only Sources/ExtensionWorktreePrototype.swift and cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. It contains no Package.swift, Package.resolved, .gitignore, workflow, or Xcode project package-reference changes. Therefore, the SwiftPM lockfile conditions do not apply.

Full details: Cmux Swift Logging

Explanation

PASS. The PR diff adds only worktree identity initialization, optional-identity comparison, and an explicit test-task return. It adds or materially changes no print, debugPrint, dump, NSLog, file logging, Logger declaration, or diagnostic content. The existing logPrivateDiagnostic call remains unchanged.

Full details: Cmux User-Facing Error Privacy

Explanation

PASS: The production diff only removes default values from two identity fields and unwraps the filesystem identity before comparison. It adds no user-facing error, alert, command output, API body, or recovery text. The test changes only supply nil values and return an iterator result. Existing generic error text and private logging are unchanged, so no prohibited implementation detail is introduced.

Full details: Cmux Full Internationalization

Explanation

PASS: The PR changes only Swift data-flow and cleanup logic in production code, plus test fixtures and async test control flow. The production diff adds no user-facing text, localization keys, catalog entries, web messages, metadata, or locale changes. Existing NSLocalizedDescriptionKey strings remain unchanged and are covered by the rule's exception for existing untranslated strings not worsened by the PR.

Full details: Cmux Swiftui State Layout

Explanation

PASS. The diff changes only worktree identity initialization, cleanup comparison, and a test task-group return. The changed Swift files import Foundation/OSLog, not SwiftUI, and introduce no ObservableObject, @Published, GeometryReader, lazy/list row store references, or render-time state mutation. The SwiftUI state-layout rule does not apply.

Full details: Cmux Architecture Rethink

Explanation

PASS: The diff contains small local Swift correctness fixes. It removes default values so CmuxExtensionWorktreeCreationResult retains the synthesized initializer parameters and preserves the captured filesystem identity used by rollback. It binds currentIdentity before comparing optional identities. The only synchronization change is an explicit return in a test task-group closure; the existing test sleep remains test-only, which the rule allows. The diff introduces no production sleep, polling, lock, observer, side channel, duplicate entrypoint, or split UI lifecycle owner.

Full details: Cmux Swift Auxiliary Window Close Shortcuts

Explanation

PASS. The diff changes only worktree result initialization, filesystem-identity cleanup, and a test fixture. It adds no NSWindow, NSPanel, NSWindowController, SwiftUI Window, WindowGroup, window identifier, or close-shortcut code. The test-only fixture is explicitly allowed. The deterministic scripts/lint_auxiliary_window_close_shortcuts.py is not implicated because no window identifier assignment changed.

Full details: Cmux Source Artifacts

Explanation

The full PR diff changes only Sources/ExtensionWorktreePrototype.swift and cmuxTests/ExtensionWorktreeSpawnArgsTests.swift. These are hand-written product source and test files. The changes add initializer arguments, optional identity handling, and an explicit test closure return. No local logs, caches, build output, temporary directories, dependency checkouts, or copied artifacts enter source control.

Full details: Cmux No Test Or Debug Seam In Production Source

Explanation

PASS — The PR adds no test or debug seam in production source. The only changed production lines remove default values from worktreeDeviceID and worktreeFileID and bind currentIdentity before comparison in bestEffortCleanupFailedWorktree. No test-only guard, seam-named member, or test wrapper was added. Test fixture changes remain in cmuxTests/. Existing logger.debug and compiler guard were not introduced by this PR.

Full details: Cmux No Ambient Global State

Explanation

PASS: The production diff only removes default values from two stored let properties on CmuxExtensionWorktreeCreationResult and binds a local currentIdentity inside the existing private cleanup method. It adds no top-level function, mutable global, stub state holder, singleton, or new static namespace. The existing CmuxExtensionWorktreePrototype static helpers are only touched incidentally, which the rule explicitly permits.

Full details: Description check

Explanation

The description clearly explains what changed, why the compilation failed, and how the fix was tested. It omits the template checklist and review-trigger block, but these omissions are non-critical because the implementation and verification details are complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-main-compile-worktree-result

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.

A multi-statement closure gets no implicit return, so the group.addTask
closure returning Int32? failed to compile. Found while running the
touched test class on the remote builder.
austinywang added a commit that referenced this pull request Aug 26, 2026
…0777) (#10781)

* test: pin worktree result filesystem identity

* fix: preserve worktree identity across Swift initializers
@austinywang
austinywang merged commit d1eb503 into main Aug 26, 2026
7 checks passed
@austinywang
austinywang deleted the fix-main-compile-worktree-result branch August 26, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants