Reminders.app hangs in TCCAccessCheckAuditToken when scripted from 3rd party app

Originator:jalkut
Number:rdar://22592038 Date Originated:05-Sep-2015 12:03 PM
Status:Open Resolved:
Product:OS X Product Version:10.11 Beta (15A279b)
Classification:Performance Reproducible:Always
 
Summary:
When an AppleScript creates a new Reminder and then attempts to modify the attributes of that Reminder, the Reminders app hangs for more than 10 seconds in a call to TCCAccessCheckAuditToken before finally approving the request.

The same hang does not occur when the script is run from Script Editor or from the osascript tool in Terminal.

The same hang does not occur when performing similar scripted changes in Contacts.

The same hang does not occur when a new reminder is created with initial values specified as a properties argument to the "make" request.

Steps to Reproduce:
1. Download FastScripts.app from http://www.red-sweater.com/fastscripts/
2. Download attached script and save it to ~/Library/Scripts
3. Open FastScripts and click through the first-launch advice.
4. Click the FastScripts icon in the upper-right corner of the menu bar, and select the script "TestSlowness"

Expected Results:
The script should run immediately and the new Reminder should be present in the Reminders list.


Actual Results:
A long delay of 10+ seconds ocucrs while the Reminders app is hung in TCCAccessCheckAuditToken.

Version:
10.11 Beta (15A279b)

Notes:
Open the same provided script in Script Editor, and edit it to call "TestFastness()" instead. It will execute immediately.

A similar script to Contacts does not cause a hang:

tell application "Contacts"
	set newContact to make new person
	set first name of newContact to "Bobby Buggy"
	save
end tell


Configuration:
MacBook Pro 15" 2014

Attachments:
'TestSlowness.scpt' was successfully uploaded.

Comments

Source of the attached script:

property reminderText : "Report a bug in Reminders..."

-- Specifying the name after creation causes Reminders to hang
on TestSlowness()
	tell application "Reminders"
		set newReminder to make new reminder in list "Reminders"
		set name of newReminder to reminderText
	end tell
end TestSlowness

-- Specifying the name at creation time doesn't slow down Reminders
on TestFastNess()
	tell application "Reminders"
		set newReminder to make new reminder in list "Reminders" with properties {name:reminderText}
	end tell
end TestFastNess

-- TestFastness()

TestSlowness()

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!