Bug and Best Practices for Interrupt Handling/Organization
It's rather obvious - main loop continuously resets the flag every loop, even if the flag is not set. If the interrupt happens after reading the flag, then the tasks are not triggered, and the flag is cleared, so the tasks are not triggered on the next round even if the interrupt did trigger. So it only works if the interrupt happens after resetting the flag and before it is read, and thus at quite low propability.