Mentally insane person is known as Ghair Mokallaf (Not charged), as in not charged with the responsibility of worship placed upon mankind. That is of course for complete mental handicap where there lack of control or logic beyond the capabilities of a child. Those with mental challenges that are not total, like a person with paranoia or phobias or OCD, are judged by Allah based on what he knows they could have controlled, and are fundamentally though Mokallafeen.
There isn't a report on what exactly if someone BECOMES completely and incurably insane after having reached puberty sane, but it is logical that they are treated based on their previous lives that they lead before they became insane, similarly to the ruling on temporarily insane people: the pen is raised from them FOR THAT TIME, but not what happened before when they were in control.
If someone wonders about "what if they could have repented or mended their ways had they not become insane", should remember that:
1- "what if" opens the door for the devil. Everything has already been written and sealed and is our fate.
2- They are in the same boat as people who die suddenly in an accident. That's why we all repent and pray every single day, because if anything happens to us we will be judged and punished based on what we did when we were given the chance. Every single moment we get is a bonus, so whether the plug that is pulled is on our lives or our ability to control our lives, it is the same ruling.
And God knows best.