CDI ignitions MTBF (Mean Time Before Failure) is not as high is you think, and they do fail. I have seen many instances on forums over the years where they start ‘behaving badly’, giving intermittent faults like you describe. Some have even failed out the box. They are creating a high voltage spark discharge so they have a finite life. That said, I have never experienced it myself and probably will one day!
They don’t like excessive heat, nor do they tolerate vibrations for long...people that hard mount them in the cowl are more likely to have early failures.
i have read and heard of the powerbox spark systems being unreliable, and when I chose TechAero BEC as my ignition system I use on all my planes, I did so because I have never seen a failure.
remove the powerbox before anything else...(edit to clarify) while you test to find the problem, not saying it is the problem, but start there...