You could probably leave a baked potato sitting at room temperature for days and it would still be safe to eat as long as it wasn't contained in a sealed container. But notice I said "probably." That's not the stance of food safety experts, and I would never serve other people something I'd left sitting at room temperature for so long.
Note that if you wrap your potatoes in foil to bake them, it's a different matter altogether. Thirty people in El Paso, Texas discovered this the hard way in 1994:
https://www.ncbi.nlm.nih.gov/pubmed/9652437
In April 1994, the largest outbreak of botulism in the United States
since 1978 occurred in El Paso, Texas. Thirty persons were affected; 4
required mechanical ventilation. All ate food from a Greek restaurant.
The attack rate among persons who ate a potato-based dip was 86%
(19/22) compared with 6% (11/176) among persons who did not eat the
dip (relative risk [RR] = 13.8; 95% confidence interval [CI],
7.6-25.1). The attack rate among persons who ate an eggplant-based dip was 67% (6/9) compared with 13% (241189) among persons who did not (RR
= 5.2; 95% CI, 2.9-9.5). Botulism toxin type A was detected from patients and in both dips. Toxin formation resulted from holding
aluminum foil-wrapped baked potatoes at room temperature, apparently
for several days, before they were used in the dips. Consumers should
be informed of the potential hazards caused by holding foil-wrapped
potatoes at ambient temperatures after cooking.
Can you re-bake the potato to make it safe? The short answer is no, as explained by the accepted answer to this question. Although the botulinum toxin is destroyed by heating to 85C/185F for 5 minutes, there are other more hardy bacterial toxins that can't be destroyed short of turning the potato into a cinder.
The US Department of Agriculture, which tends to be ultra-conservative with food safety, has this to say about your potato:
https://www.stilltasty.com/fooditems/index/18081
How long can cooked potatoes be left at room temperature? Bacteria
grow rapidly at temperatures between 40 °F and 140 °F; cooked potatoes
should be discarded if left out for more than 2 hours at room
temperature.
So when you get up in the morning and discover a potato in the oven, the only safe thing to do is toss it. Considering that a potato costs about 15 cents (US) in most of the world, why would you risk otherwise?