According to Breaking Points, text messages from local law enforcement show they were aware and tracking the shooter and knew he was carrying a rangefinder, up to 1.5hrs before he shot Trump.
Local police photographed the suspect and suggested notifying SS Snipers to "look out" and sending in someone to "check it out".
The Secret Service and those up in the chain of command appear to have ignored the warnings and their requests.
Video here: https://youtu.be/6VIAGBfnNvQ
There's a notable gap between what is criminally liable incompetence and what is incompetent enough to make a lone-wolf style assassination a plausible risk. Whilst it's not a very effective way to guarantee your political opponents are removed, deliberately straying into that realm of incompetence is an extremely safe and cost effective way to have a chance they're removed.
As long as the people in charge understand to keep the quiet part quiet and just thumb their noses at each other ignoring or encouraging performance issues in the organisation, the worst that'll come legally speaking is just getting fired from their role. And the deep state is certainly in a position to reward them with another cushy role elsewhere once it all dies down.