In the OP you asked WWYD so here's my 2 cents. I also have a kid that can also be 100% in one thing and fail another. In our case he is 2e and it often boils down to teachers and their skill/experience/personality fit and if they accommodate or evaluate using alternative methods. In our case teachers that expect him to produce everything on paper and refuse to bend generally don't get great results.
1. take a deep, deep breath
2. repeat #1
You are running a marathon and not a sprint so don't beat yourself up for not having an instant fix. Many kids go through years of school without being diagnosed so pat yourself on the back for going through all of this in elementary.
3. you know there is *something* up. Testing will hopefully help sort that out so getting testing is a great start. It sounds like the school is doing that but as mentioned there might be ways to go up the ladder and get things moving a little quicker. It also sounds like you've looked into private so hopefully something can be figured out sooner than later.
4. anxiety - In our case DS was VERY frustrated and angry with school. He was 6.5 and viewed himself as a smart kid. When all of the other kids in the class were easily writing up a storm and he wasn't the only logical solution was that he was stupid (his words). After we went through testing we talked about how everyone is good at some things and that other things can be a challenge. Just because something is hard doesn't mean you are stupid. We reassured him that he was indeed very smart but that writing was harder for him than for most kids and that was ok. We were able to scribe his homework to ease the frustration. At school they occasionally scribe as well.
If I had a kid that was suffering from anxiety I might consider a version of the above discussion that fits his strengths and challenges. Knowing that he does indeed belong in the gifted class might ease some of his fears. Knowing that you (and the school/teachers) want to help make writing (or whatever his challenge is) easier might help.
5. If the school is willing to put some accommodations in place while waiting for testing that might also be something to ask for. They might not know exactly why he is having a particular challenge but if they can work around it and allow him to have a scribe or to answer verbally instead of written it might make a big difference. Kids don't perform their best when they are frustrated and anxious. Maybe they can help narrow the issue down by figuring out the worst scenarios for him or where the bottle neck lies.
6. ignore the grades for now - I mean you know they are telling you there is a problem so don't ignore that part but try not to focus on the specifics. If he comes home with a 40% on a test try to see if it is because he couldn't get it out on paper, because he didn't understand the question, the space was too small to write, there was a kid next to him chewing gum loudly, etc.... but the actual grade doesn't matter right now. Make sure he knows that you know he is doing his best and you are there to help him reach his goals. He doesn't WANT to have a 40%.
I don't mean to sound preachy or that I have the answers because honestly we're still fumbling along as well. I know your frustration however and wanted to try to help if I could. Hopefully something in that will help or spark an idea. I know how hard it is to see your very smart kid struggle and not be able to fix it immediately. Hang in there!