Actually, that is not entirely correct.
It does the repair automatically if it finds a problem when it checks. Optimize is specified separately.
The repair is done when you already know the table is bad and you are asking for a repair to occur.
auto-repair goes and checks and if it sees a repair is needed, it does it automatically.