I’ve created a PR in the past week to address the issue where there was a race-condition around loading Prism (the utility that formats sql). You can find it here.
If you are able, you could pull that branch and deploy it to your test environment and try. I’m sorry, I can’t commit to doing a in person diagnosis, and I apologize if that is frustrating, but the PR above (and branch) should handle the situation where sometimes it works and sometimes it does not due to a loading order of the javascript.
It would be helpful to me if you tried this because then that would give further confidence in the PR to fix the issue.