The first thing you have to figure out is whether the intervals are hard on you mentally or physically. Reading your post, it seems you might be throwing both in the same pot. Learning to clearly distinguish between has been very helpful to me, because I address mental barriers differently than physical barriers.
Common situations (I think) I am close to my mental limit are when e. g. I have long threshold intervals coming up and right at the beginning of the second 16-minute interval, my mind tells me “Oh no, not another 15:35 minutes of this! I just can’t.” In these situations, my legs either feel ok or maybe a bit “dull”, but not bad or at the limit. Another typical sign is that I often give up right after a step at a ramp test. Many of my ramp test end after 20:00 minutes (+ the few seconds it takes for TR to pause the workout). That isn’t because I am such an expert at pacing that I always empty my tank at the 20-minute mark. It is that my legs are yelling “No more, I don’t want to go harder than this, I really struggled before already!” Plus, I know that anything past 19:30 minutes will lead to an FTP gain, so in a sense, I know I am already gaining. Another common occurrence during some ramp test are days when I don’t feel it. Interestingly, that seems to have no bearing on how well I do. There were plenty of days when I felt horrible, but my ramp test results were not just very, very good, but the result I got was accurate (as I validate my FTP test result with subsequent workouts). I reckon I am not alone here.
One thing that has helped me is find quantitative signs that tell me I am physically capable to do this. My favorite one is heart rate recovery: if after a hard interval my heart rate returns to < 130 bpm within 1:30–1:45 minutes, I know I am perfectly fine from a physical standpoint. I know I can and should push harder, because it is all in my head.
Sometimes, especially when my sleep wasn’t great or I did not sleep enough, I can be at my physical limit. A common sign is that I cannot hold my power during the last one or two intervals, and I need to take a breather after an interval. I do my hard intervals in resistance mode, so my preferred methods is to finish the intervals at best power. That is, I go as hard as I can. Even though it doesn’t feel as great as finishing the workout as prescribed, it feels way better than giving up. And if I am truly at my physical limit, but I mentally push through, I feel that I did my duty for the day.
Lastly, if the stars completely misalign and you you neither bring your mental nor physical A-game to the table, it is usually better to call it quits. Most of the time, I do an endurance workout instead. I found it counterproductive to “punish” myself here and pick the hardest endurance workout for a given workout duration. Mellower ones work much better for me (IF ≈ 0.60–0.63). Instead, try to figure out why you failed your workout. With experience you will learn what the most important factors are. In my case it is sleep and sleep consistency.