As much as a threat of sanctions serves as a deterrent of wrongdoings, a conditional promise (in any form, can be either in a form of law or just not-formal public announcement) of revoking them when such wrongdoings are ended might serve as a stimulus for ending them.
As an illustration, let's consider sanctions (both already imposed and potential) against Russian oligarchs because of the invasion. Although it is not formally stated anywhere, the goal of the sanctions is to stimulate the oligarch to make pressure on Putin to stop the war or (possibly) organize some kind of a coup which will also end the conflict. If the counties which impose such sanctions will commit (either legally or just by publicly saying that) to lift them provided the desired change happened, the oligarchs might be much more willing to act.
So, why don't countries announce conditions for lifting when they impose sanctions?
Note: although the sanctions for the Russian invasion is an important example, this question is about sanctions mechanism in general and not about a particular case.