Understanding `window` in `restart_policy`

I’m struggling to find use for the window option in restart_policy. It looks like any value > 0 is not safe, because if a container fails immediately for some reason, docker will restart it indefinitely since no attempt would count towards max_attempts according to the documentation. Is this really how it is supposed to work?

Also, I seem to be not the only one wondering: restart_policy.max_attempts is hard to understand. · Issue #7527 · docker/docs · GitHub

Thanks in advance for any assistance .