Nothing was out of character. At all. Optimus had the high ground. Do you think he should have given Sentinel a second chance? Hundreds of people have already been killed at this point! The world was moments away from total slavery. Sentinel was begging for his life like a ***** because he knew he had lost, not because he actually "saw the light". After almost being killed and having his own arm torn off, do you think it was wrong for Optimus to finally END IT?
Optimus had the opportunity to finally silence Megatron. Megs wasn't even trying to save Optimus' life! His prime target was Sentinel. Do you think if Optimus just watched Megs kill Sentinel, Megs would then help Optimus to his feet and.....................what? Become friends again?
I really can't believe this is even an issue. My Gawd.