The Traitor in the Family Is Who?

Rating: 9/10 (23 December 2014)

Although this is a great movie, it is logically flawed, and in such a way that once grasped, it is impossible to ignore. Early in the movie, Michael walks into his bedroom, where Kay is sleeping. She wakes up and asks him why the drapes are open. He looks around at the open drapes, apparently sees something outside, and drops to the floor as machine gun bullets riddle the bedroom. The compound is sealed off, and Michael gives orders that the gunmen be taken alive, but they are found shot dead shortly thereafter.
Michael tells Tom Hagen that there is a traitor in the family, and so he is turning power over to him while he, Michael, disappears for a while. Though Tom is only an adopted brother (and not Sicilian), and though Fredo is Michael's older brother, yet he does not turn temporary control over to Fredo because "he is weak and stupid." So far, so good.
But Fredo turns out to be the traitor in the family. Does that mean he is the one who opened the drapes in the bedroom while Kay was sleeping? And does that also mean that Fredo was the one who executed the two hit men before they could talk? If he did all that, I am ready to believe that he was the one who set up his father Vito for the hit in the first "Godfather" movie. But given his character, we cannot believe Fredo did any of these things.
But in that case, what was it that Fredo did that was so bad? Fredo says that Johnny Ola enlisted his aid because Michael was being tough in the negotiations about Cuba. So what does that mean, that occasionally Fredo was supposed to say to Michael, "Don't you think you're being a little tough in the negotiations"? For that he deserves death?
Furthermore, the person who did open the curtains and executed the hit men is the real traitor in the family. There are plenty on the compound who might have done that, and that person, whoever he is, is still a threat to Michael. But Michael seems to be oblivious to this obvious implication.