NSMetadataQueryDidFinishGatheringNotification not posted for some users in macOS 12.3

I have a macOS app that synchronizes some files in the app's iCloud container, outside the Documents folder. Changes to these files are monitored with a NSMetadataQuery using a search scope of NSMetadataQueryUbiquitousDataScope. The NSMetadataQuery instance uses an operation queue for notifications and I'm calling startQuery on the instance's operation queue.

As of macOS 12.3, for a subset of my users, the NSMetadataQueryDidFinishGatheringNotification notification is never sent after starting the query. The NSMetadataQueryDidStartGatheringNotification and NSMetadataQueryGatheringProgressNotification notifications are posted.

For those affected who have multiple Macs, each of their Macs seems to be affected by this, as if it is a problem specific to the iCloud container for my app, for that user.

I'm unable to reproduce the issue on my personal machine.

Has anyone else noticed this behavior since macOS 12.3 was released?

The problem continues with macOS 12.4.

This problem has been resolved in macOS 13. That said, it's concerning that whatever the underlying fix was has not been back-ported to macOS 12.x. I worry the fix was unintentional since it has been fixed since early in the macOS 13 beta cycle. If the fix was intentional, that means Apple has known about the problem for months without fixing the issue in macOS 12.x, which seems unlikely. I hope this doesn't get reintroduced.

FWIW, I just encountered the same issue on macOS 14 beta 8.

NSMetadataQueryDidFinishGatheringNotification not posted for some users in macOS 12.3
 
 
Q