Extreme slowdowns for user interaction in Tahoe

I write scripts and push them to other users. Tahoe is a major pain. On some, but not all, Tahoe Macs this happens.

Every dialog gets a beach ball. It will last for 15 - 45 seconds, and start over for every user action, like type a single character or for every selection in a multiple select list.

Scripts are signed. No difference if they are notarized or not. It happens on some Macs, but on very similar Macs same script run just fine. No problmes anywhere when run from Script Debugger/Editor.

It is the environment, like TCC or some other dark whichcraft.

Some scripts are extremly simple, like 30 lines of code: ask user for a job name with display dialog, then use mkdir to create a set of folders with pre-defined names.

Example:
–start:
tell application “Finder” to set thisFolder to (target of window 1) as alias
set zetarget to POSIX path of (thisFolder as string)
set rootName to text returned of (display dialog “Job number and name” default answer “000000 my job”)

… at there goes the beach ball.

It is neither an xattr nor permission thing. What should I do to troubleshoot this?

[I use Sequoia to make the scripts. But as I said, they run just fine some Tahoe macs.]

It is probably related to this:
macOS Tahoe - seems to have broken my applet
but recompile has no effect.

I would start with measurement in an attempt to identify the cause of the SPOD. Use Activity Monitor to get a Sample report of your script’s process while it is hung.

If you don’t know how to read a sample report, post it here or use AI to interpret it.