Skip to content

Eliminate app hang from synchronous file open#589

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/app-hang-file-open
Open

Eliminate app hang from synchronous file open#589
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/app-hang-file-open

Conversation

@sentry

@sentry sentry Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

This PR addresses an app hang (REPOPROMPT-9D) that occurred for at least 2000 ms when opening files via NSWorkspace.shared.open().

Root Cause:
The FileViewModel.openInDefaultApp() method, and a fallback path in WorkspaceFilesViewModel.openFileForMarkdownLink(), were calling the synchronous NSWorkspace.shared.open(fileURL) on the main thread. This call blocks on a LaunchServices XPC round-trip, causing the UI to freeze.

Solution:
Replaced both instances of the synchronous NSWorkspace.shared.open(fileURL) with its asynchronous counterpart: NSWorkspace.shared.open(fileURL, configuration: NSWorkspace.OpenConfiguration(), completionHandler:). Error logging is now handled within the completion handler, preventing the main thread from blocking.

Impact of changes:

  • The app no longer hangs when opening files.
  • The openFileForMarkdownLink method now always returns true after dispatching the async open, as its boolean return value was previously discarded by callers (_ =), making the change in semantics practically inconsequential.

Fixes REPOPROMPT-9D

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.

0 participants