Skip to content

Fix portal mutation tracker launch crash - #10008

Merged
azooz2003-bit merged 2 commits into
mainfrom
fix-portal-associated-lifetime
Aug 11, 2026
Merged

azooz2003-bit merged 2 commits into
mainfrom
fix-portal-associated-lifetime

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator

No description provided.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The insertion tracker now prepares hierarchy state before AppKit receives the borrowed child reference. Both swizzled subview-addition methods use this pre-insertion hook and remove post-insertion recording.

Changes

Pre-Insertion Hierarchy Tracking

Layer / File(s) Summary
Prepare hierarchy state before AppKit insertion
Sources/PortalViewHierarchyMutationTracker.swift, Sources/PortalSplitDividerCacheInvalidator.swift
The insertion hook is renamed to prepareForInsertion. Both subview-addition hooks call it before the original AppKit mutation with the subview’s current window.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: ejc3

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, so all required template sections are missing. Add the Summary, Testing, Demo Video, Review Trigger, and Checklist sections with the required details.
✅ Passed checks (24 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 The diff changes insertion timing and naming only; it adds no isolation declarations, and the tracker and invalidator remain explicitly @MainActor-isolated.
Cmux Swift Blocking Runtime ✅ Passed The production Swift diff only moves insertion tracking before AppKit calls and renames the helper; it adds no semaphores, waits, sleeps, delayed dispatch, polling, sync, or locks.
Cmux Browser Automation Off-Main ✅ Passed The actual diff changes only portal hierarchy tracker files; it adds no browser.* command, socket-worker routing, WebKit wait, or policy-test change covered by this rule.
Cmux Expensive Synchronous Load ✅ Passed The diff only reorders in-memory NSView hierarchy tracking and renames the insertion hook; changed files add no agent-history loader, file read, directory scan, JSON parse, or SharedLiveAgentIndex...
Cmux Cache Substitution Correctness ✅ Passed The diff only moves AppKit insertion tracking before mutation; it replaces no fresh disk, database, or file read, and the tracker serves transient divider UI cache state, not persistence, history,...
Cmux No Hacky Sleeps ✅ Passed The diff changes only two Swift source files and adds no sleep, timer, polling, or fixed-delay synchronization; this rule explicitly excludes Swift.
Cmux Algorithmic Complexity ✅ Passed The diff only moves the existing constant-time insertion bookkeeping before AppKit and renames it; it adds no scalable scans, sorting, filtering, joins, or slower algorithm.
Cmux Swift Concurrency ✅ Passed The diff only renames and moves a synchronous AppKit insertion tracker call; it adds no Dispatch, Task, Combine, or completion-handler async pattern.
Cmux Swift @Concurrent ✅ Passed The diff changes only synchronous AppKit hooks and a synchronous @MainActor method rename; it adds no async/nonisolated work or @concurrent annotation.
Cmux Swift Package Boundaries ✅ Passed The diff only adjusts private NSView/NSSplitView AppKit swizzle hooks and an @MainActor AppKit tracker; it adds no independent reusable domain logic, and AppKit glue is explicitly allowed.
Cmux Swiftpm Lockfiles ✅ Passed The diff changes only two source files; it contains no Package.swift, Package.resolved, .gitignore, workflow, or Xcode package-reference changes that trigger this policy.
Cmux Swift Logging ✅ Passed The exact Swift diff only moves insertion tracking and updates documentation; it adds or changes no print, Logger, file/stdout logging, or sensitive-data logging.
Cmux User-Facing Error Privacy ✅ Passed The diff only changes internal Swift hierarchy hooks and developer documentation; it adds no user-facing error, alert, command output, or new string literal.
Cmux Full Internationalization ✅ Passed The PR diff changes only Swift hook logic and developer-only comments; it adds no user-facing text and changes no catalogs, plist, web, or locale message files.
Cmux Swiftui State Layout ✅ Passed The diff changes AppKit portal mutation hooks only; no SwiftUI state, measurement, lazy-row store reference, or render-time mutation is introduced.
Cmux Architecture Rethink ✅ Passed The diff is a small AppKit bridge correctness fix: the MainActor tracker remains the owner, docs state the borrowed-reference invariant, and no timing, blocking, duplicate-path, or new-state mechan...
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed The diff changes only NSView insertion hooks and hierarchy tracking; it adds or materially changes no NSWindow, NSPanel, WindowController, SwiftUI Window, or WindowGroup.
Cmux Source Artifacts ✅ Passed The diff changes only two intentional Swift source files; it adds no logs, caches, build output, scratch directories, downloads, or other source-control artifacts.
Cmux No Test Or Debug Seam In Production Source ✅ Passed The diff only renames the insertion tracker and moves its production call before AppKit mutation; it adds no DEBUG guard, test/debug-named member, or test-only accessor in Sources/.
Cmux No Ambient Global State ✅ Passed The diff only renames an existing method on PortalViewHierarchyMutationTracker and changes hook ordering; it adds no top-level function, mutable global, static namespace, or singleton.
Title check ✅ Passed The title clearly identifies the primary change: fixing a launch crash in the portal mutation tracker.
✨ 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 fix-portal-associated-lifetime

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.

@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@azooz2003-bit
azooz2003-bit merged commit a161d16 into main Aug 11, 2026
6 checks passed
@azooz2003-bit
azooz2003-bit deleted the fix-portal-associated-lifetime branch August 11, 2026 20:27
austinywang added a commit that referenced this pull request Aug 12, 2026
* Revert "Fix portal mutation tracker launch crash (#10008)"

This reverts commit a161d16.

* Revert "Portal: invalidate the split-divider hit-test cache on nested subview insertion (#8580)"

This reverts commit bcfb2d7.
azooz2003-bit added a commit that referenced this pull request Aug 13, 2026
* Hide current iOS Agent GUI

* Revert portal hierarchy mutation tracker launch crash (#10018)

* Revert "Fix portal mutation tracker launch crash (#10008)"

This reverts commit a161d16.

* Revert "Portal: invalidate the split-divider hit-test cache on nested subview insertion (#8580)"

This reverts commit bcfb2d7.

---------

Co-authored-by: Austin Wang <austinwang115@gmail.com>
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