Fix main CI by deferring file-drop overlay retries
Summary
- remove the synchronous
WindowSetupAccessorpath added for file-drop overlay retries - retry file-drop overlay installation asynchronously from the existing deduped
WindowAccessor - keep the retry bounded so startup can recover once the theme frame exists without mutating the window tree mid-attachment
Root cause
main CI started failing in the tests job on the two latest merge commits:
24597524739(26892bd0)24597559538(060eafd6)
The shared regression started with 70618b0f (Fix file drop overlay startup installation).
The new WindowSetupAccessor called installFileDropOverlay while WindowObservingView.viewWillMove(toWindow:) / SwiftUI update was still attaching the window hierarchy. In the failing CI logs that produced:
NSWindow warning: adding an unknown subview: <cmux_DEV.FileDropOverlayView ...>NSHostingView is being laid out reentrantly while rendering its SwiftUI content
Once that attachment path became re-entrant, unrelated unit suites started failing broadly because window/layout state and Ghostty surface setup were no longer stable.
Validation
- required local setup completed:
./scripts/setup.sh - attempted tagged debug build twice via
./scripts/reload.sh --tag fix-main-ci-window-overlay - local verification was limited by an Xcode build-service crash/hang on this machine before compilation completed; PR CI should provide the authoritative signal
[!NOTE]
Medium Risk
Changes window-setup timing and introduces bounded async retry logic during startup; risk is moderate due to potential for missed/late overlay installation or subtle lifecycle timing issues in SwiftUI/AppKit.
Overview
Defers file-drop overlay installation until the NSWindow view hierarchy is stable by adding installFileDropOverlayWhenReady, which retries installation on the next main-loop turn with a bounded attempt count.
Removes the synchronous retry path (WindowSetupAccessor) and installs the overlay from the existing window accessor callback, avoiding re-entrant mutations of the NSThemeFrame/hosting view tree during attachment.
Reviewed by Cursor Bugbot for commit 5c866bd4238e1207281f28be3c9dd6f2bdb28cbd. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Defers file-drop overlay installation to the next run-loop and retries until the window is ready, preventing reentrant layout during SwiftUI attach. This fixes the CI failures caused by mutating the window hierarchy at startup.
- Bug Fixes
- Replaced synchronous setup with
installFileDropOverlayWhenReady(async with 16 bounded retries). - Routed overlay install through the existing
WindowAccessor; removedWindowSetupAccessor. - Eliminates NSWindow “unknown subview” and NSHostingView reentrant layout warnings seen in CI.
- Replaced synchronous setup with
Summary by CodeRabbit
Bug Fixes
- Enhanced file drop functionality with improved overlay installation reliability using automatic retry logic. Ensures consistent and reliable operation across various system states and conditions.
Refactor
- Consolidated internal window setup architecture by streamlining components and removing redundant patterns. All user-facing functionality is maintained while improving code maintainability.