After busting the "end the training on a good note" myth, it's time to also look into how a scared dog sees things and reevaluate the general truth to "just take him there to make him see it's not scary".
When something scary happens, most people are instructed to immediately take the dog back to make him see it's actually not scary. But it IS scary. Once the dog gets scared, he is not in a perfect emotional mode to see things aren't scary. That's much easier when you're not scared already. I hear you saying: but, I did exactly that and my dog was just fine. Of course he was. Most confident dogs without fear issues can easily be handled that way and they will do just fine. When something bad happens in agility ring, like crasing into a tire or falling off the dog-walk, it's usually the handler who gets scared the dog got scared, but most dogs are in so much drive when they run that they don't even realize they crashed into a tire or fell off of a dog walk - even if it's really bad, they don't feel the pain with all the adrenaline rush just yet. So yes, they will be fine even if you take them back immediately. I did that with my Samoyed and he was fine. I could easily do that with La and Le and definitely Bi - who cares. But Lo and Bu... Yeah right.
When something scary happens, it doesn't matter what I do for La, Bi or Le - they will be perfectly happy to do it again. However, when speaking about fearful dogs, like Lo and Bu, I learned an important lesson: if they get scared, they get in an emotional state that doesn't allow them to see "things are actually not scary" and asking them to immediately go back into a situation that scared them was ALWAYS contra productive, despite I was always shaping it (clicking for approaching the object, rewarding away from it to let them "escape" from it, not asking for more as they offered on their own etc.). - The longer and more patiently I worked on it, the longer they were rehearsing what just happened. So I learned to not even check if the dog is o.k. right away: but immediately start a party, make the dog extra busy with her favourite tricks, do some tunnels with Bu and keep them as busy and as much in movement as possible. I then avoid the scary situation for a while and after a couple of weeks, try it again. After a couple of weeks, things don't look as scary anymore AND as the dog never had the time to rethink what happened, they're usually perfectly fine with it.
I handle scary situations the same way. I used to think that the best way to make Bu feel confident in trials is to keep her with me, make her see it's not scary. But it is scary for her. So what works best for her is to respect her fear, keep her away from a scary situation in a safe place (preferably a car) and then bring her in in the very last moment, keeping her busy with tricks to not have time to notice all the scary things around her, run and then run directly out of the ring back to the car to party. She knows the routine, she knows I won't be asking her to be comfortable with dogs barking around her or interfere with them, she knows we'll just do our run, in the safety of the ring, away from other dogs, and go right back and she is fine with that.
It was the same with Lo. I first tried to get her happy to interact with people, giving them treats and asking them to give her treats. It didn't help. It only put her in conflict as she wanted that treat, but didn't want to have anything with that person. When I gave up doing it, she was so happy that she could simply ignore everybody - and couldn't care less about their presence! - But would start to bark anytime somebody would want to give her a treat - for like her whole life!
Finally, I learned to respect their fears, to earn trust that I would never ask something unsafe from them and make sure they know they can feel safe with me. My favourite way to socialize my puppies now is to take them to as many places as possible, but mostly keep them in a sherpa bag so that they can observe the world from a safe place and only let them out if they feel confident about it. The world looks so much nicer when you're not scared!