Because Cersei never gave the order
The order we see on screen is Cersei telling the Mountain to draw his sword. The kill order never comes. This is confirmed in the official script.
JAIME: Give the order, then.
He watches her and waits.
The Mountain waits for a command from his queen.
She nods. The smallest possible nod.
The Mountain draws his sword.
Jaime knows there’s no point fighting. He knows he will be cut in half.
He stares at his sister for a long beat.
JAIME: (quiet) I don’t believe you.
After a long beat, Jaime turns and walks away, right past the Mountain and his drawn sword.
Cersei watches. She does not give the command.
Game of Thrones, Season 7 Episode 7, "The Dragon and the Wolf"