To be perfectly frank, you're asking an extremely difficult and arguably unanswerable question.
There's an old legal saying I remember from my Law degree. "Justice depends on what the judge has had for breakfast". Different days can bring different results and in a trial like this, the military officers are free to come to whatever conclusion they want within legal reason (similar to a jury).
It's certainly plausible that the officers could have seen a Code Red as something that must be followed at all times, thus excusing the officers of any sanctions. Alternatively, they might have seen the Code Red as something to follow at all times provided there is no danger to US life, or provided it doesn't exist within a certain culture. My point is that, like a jury, the military officers are free to come to whatever decision they want on the matter.
However, on a final note - it was a movie and thus I do think it's probable the scene went the way it did to provide that iconic ending.
In real life, a person with zero defense experience would never get the position Kaffee did. Not to mention this rather important snippet of information from a former JAG officer:
...although the two accused Marines have the main charges
against them dismissed, they are still found guilty of “Conduct
Unbecoming A Marine” and are discharged from the military. The only
problem? No such crime exists under the Uniform Code of Military
Justice (UCMJ). Article 133 of the UCMJ makes “conduct unbecoming an
officer” a crime. But the two accused Marines were enlisted, rather
than officers, and couldn’t have been convicted under Article 133.
So I would argue that if the crime did exist, it really depends on the jury's interpretation of events. But the crime doesn't exist, so you really just have to come to your own conclusions on it!