Apps need to have certificate re-selected to avid Gatekeeper block

About a week ago I started having all sorts of trouble with Gatekeeper denying permissions to send Apple Events from many of the scripts I was deploying.

I eventually figured out this appeared to be due to a code signing issue. We had been signing with a certificate that expired 3/27/22. But I had installed a new certificate that expires in 2026, so I thought I’d be fine. The old certificate is deleted out of my keychain.

Here’s what I’m experiencing:
I have an app that I recently deployed, code-signed in Script Debugger and with a unique Bundle ID. I verified it was signed with the shell:
codesign -dv --verbose=4
I tried exporting again, same behavior.
Then I open the copy I’m exporting from (saved as a .applescript), go to “File” → “Bundle and Export Settings,” and switch from our developer certificate to “Do Not Sign.” Then I switch back to our developer certificate and close the dialog.

Then I export again. I open the .app. And now I get Gatekeeper dialogs to give it permission to send Apple Events, and it runs fine.