I am an anesthetic nurse and have been present at different neurosurgical operations while patients were awake. Mainly brain tumors, but also some stimulation electrodes to fight tremor in Parkinson disease.
There are different techniques used to make sure the patient is well prepared and can deal with the situation - which is in my opinion already the most important part.
a)Patient will be extensively talking with the exact anesthetist that is present during the surgery and the surgeon that is working on them and go through the parts they are awake to be prepared
b) it will be discussed with the patient if they want to be awake throughout the surgery or want to wake up for the part they are needed - opening the skull with a surgical saw is not really pleasing, so that needs to be clarified. Also there will be options to put you to sleep any time, since panic is not a good option while your head is tightly screwed to a table - the patient knows about what and how to communicate at any time during surgery. Also for seizures medication would be started beforehand to lower the threshold for a seizure. A tremor generally isn't a problem as they normally are not strong enough to do harm to a body that is fixated.
c) during surgery a constant contact will be established between surgeon, anesthetist and patient, it has been proven useful to use autosuggestion techniques and tasks patients like to keep them occupied or cope with the situation. Due to this also seizures will be identified early and can immediately be treated, this might include a short general anesthesia.
d) During surgery you can make some stops if patient is feeling uncomfortable, for example sitting up. We had surgeons who stepped away and went to eat and drink for 15 minutes while the patient had some time to recover. Anxiety to a certain degree can be medically softened, but since an awake patient is needed you are careful with it. Short acting agents like Propofol (Sedation) or Remifentanyl (Painkiller and sedation) are often connected via syringe pump, a baseline can be established with a benzodiazepine like midazolam (Which also can be antagonized if necessary). Also the concentrated talking with a good anesthetist and using meditative/autosuggestion techniques calms down most patients remarkably good.
Obviously you would also check that local anesthesia is still working and the position is comfortable for the patient.
e) If these things do not help for brain tumors you could try to go for navigation (which is common these days, it is a 3d model of the patient matched with the CT of the brains so you can identify the tumor), stimulation or hope the surgeon has enough experience to exactly stop before entering healthy tissue. Also you would ask pathology to confirm you are not yet in healthy tissue by sending them a sample (This takes about half an hour in which you will just wait) - also the surgeon might decide to stop and to leave the rest inside, which is a complicated decision based on which outcome the incision in healthy tissue might have, if there are real chances to cure the patient even if surgery is perfectly done and so forth.
For stimulation electrodes a panicking patient is a no go, so if you do not manage to get them relaxed you will stop the surgery and not place the electrode. I have not seen it because this is really rare due to the preparation and experienced people all around you.
I am sorry for not providing more sources, but to find something as specific as that summed up in a good way is rather complicated. I have to the best of my knowledge described my experience from three different hospitals in Germany where I have witnessed the practice and information from a specialist who gave a talk on autosuggestion in awake surgery.