We are talking about the timing of tidying with respect to a behavioral change in the system. Tidy first, then change the behavior? Change the behavior, then tidy? Or simply note messiness (in the sense that future behavior changes are going to be harder than they need be), then come back later to tidy? Or, don't tidy at all?
Never
Let's start with the last one. As always, we need to examine the tradeoffs involved in not tidying at all. When should we say, "Yes, this is a giant mess, & we consciously choose not to do anything about it."? The best reason is because we're never going to change the behavior of the code ever ever again.