Read running apps' bundle IDs off the main thread - #1875
Merged
Merged
Conversation
Freeze reporting caught its first real freeze on 1.1.66 (Sentry APPLE-MACOS-2Q): the main thread blocked 5+ s in -[NSRunningApplication bundleIdentifier], a synchronous LaunchServices call, inside an async job. Meeting detection and the browser title reader both scanned NSWorkspace.runningApplications on the main actor. They now read through RunningApplicationsReader, on one serial background queue. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0126tPTsXGHmWx6EmsR32sjX
Review of the freeze fix: the Sentry stack (one unsymbolicated app frame before -[NSRunningApplication bundleIdentifier]) also fits meeting detection's app-launch handler, which read a just-launched app's bundle ID on the main actor. That read, and the call-app monitor's launch/quit refresh, now go through RunningApplicationsReader (moved to Support, now userInitiated). The monitor's synchronous pre-capture refresh stays, and a generation counter drops background reads that land after a newer one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0126tPTsXGHmWx6EmsR32sjX
r3dbars
marked this pull request as ready for review
September 26, 2026 18:42
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
https://claude.ai/code/session_0126tPTsXGHmWx6EmsR32sjX
Why
The freeze reporting that shipped in 1.1.66 (#1864) caught its first real freeze. Sentry APPLE-MACOS-2Q, "App hanging for at least 5000 ms": 5 events in 30 minutes from one user on published 1.1.66, with the app idle. Stack: the main thread was inside a Swift async job, in
-[NSRunningApplication bundleIdentifier], blocked 5+ s on a synchronous LaunchServices XPC call (_LSCopyApplicationInformation).Two main-actor async paths scan every running app's bundle ID:
MeetingPromptDetector.evaluate(), which runs every 120 s plus on mic, camera and app events. Given the idle context, this is the likely source (inferred; Sentry 9.10 gives no app frame names).BrowserWindowTitleReader.titles, which is@MainActorand filtersrunningApplicationsbefore its AX work.Product Impact
meetings(call detection, all users)meeting reliability/ app healthWhat changed
RunningApplicationsReader: readsNSWorkspace.shared.runningApplications(pid, bundle ID, regular-app flag) on one serial.utilityqueue behind a checked continuation. It uses a serial queue, not a detached task, so a stuck reply can't tie up the Swift thread pool (same lesson as Settings reads the login-item status once, off the main thread #1867).MeetingPromptDetector.evaluate()takes bundle IDs from a new injectablerunningBundleIDsProvider(default: the reader).nowis taken after that await.BrowserWindowTitleReader.titlesbuilds its pid list from the reader.run-tests.shAPP_SOURCES and toSources/Meeting/CLAUDE.md.Left alone:
frontmostApplication?.bundleIdentifier: the active app's info is already loaded, and tests inject it synchronously.CallAppMicrophoneSharingMonitor.refresh: synchronous and only on app launch/quit; it isn't the async job in the stack.How I checked it
bash scripts/dev/linux-checks.sh: 48 passedpython3 scripts/dev/check-source-pins.py --changed-only: PASSbash build-deps.sh --force/bash build.sh --no-open/bash run-tests.sh/bash run-integration-smoke.sh: CIChecks I could not run, and why:
Mac or hardware test still needed? If yes:
Risk Review
Notes
Found by the 1.1.66 release watch (
/mnt/project-files/release-watch/1.1.66-watch-log.md).Agent handoff
COORD_DONE: BRIEF | this PR | running-apps scan off main (Sentry 2Q) | none | none | linux-checks, source pins | CI + deep reviewGenerated by Claude Code