My daughter also had this problem in middle school. Straight As, but was not consistent in homework (homework only counted for 20% of the grade, and she always aced tests). I was furious at the smugness of the coordinator who refused our IEP.
In high school she is still doing well, and managing her emotional “depression” at having to do consistent work. It’s hard for her, but she wants to get into a prestigious private school, so her grades are still As, in all honors classes, except World History.
She just got a C for an essay written in History in class. Of course. Slow processing speed, and working memory below average despite the very high I.Q. She never puts enough detail into her writing, and doesn’t get the whole evidence-based format of high school papers. Also, she’s not really all that interested, being a STEM geek, and as we know, if these kids are not interested, it’s quite hard to get them to live up to their potential.