Thanks Tom, I tested #2122 and it does what you described.
I applied the two src files of the PR by hand on top of the patches channel (schema 465, agent 0.1.28) and reproduced the same situation with test-bios. First Deploy (16928): the agent asked for the directory join and the plan went to awaiting_reboot (attempt 12f448e3…, trigger_task_id 16928). Before it rebooted I powered the VM off and queued a second Deploy (16929), which completed normally. The agent enrolled by itself after that (rebind, approved via deploy).
For a while the old plan was still in hdRejoinState, still awaiting_reboot with trigger 16928, so right after queuing the Deploy nothing had changed. Once the machine booted the new Windows and the agent checked in, FOG replaced it on its own. A minute later there was a new attempt (3e64f53…, trigger 16929, awaiting_reboot). I didn’t touch “Clear directory operation review” or edit anything in the database. After one reboot the host was verified, hdJoined=1, hdKind=ad, secure_channel: healthy.
So the old attempt is dropped after the new Deploy and the first boot, not at the moment the Deploy is created, which matches what you wrote. It only looks odd if you check the host in between and still see the old plan. No problem on my side, just mentioning it in case anyone else notices the same thing.
One idea, only if you think it’s worth it: a checkbox in the Deploy task form, something like “discard every pending task of this host”, unchecked by default. The automatic rules are safer for the normal case, but sometimes the admin knows everything left over from the previous install is dead (queued tasks, snapins, a pending directory join) and wants to force a clean start right when the Deploy is queued, without waiting for the first boot and without the “Clear directory operation review” box. In our case, when a machine misbehaves it often keeps snapin tasks queued, and today you have to open the host, work out which tasks it has and delete them one by one. In a big fleet that is slow and easy to get wrong, whereas one box on the Deploy would clean the slate in a single step.
I’ll drop my manual patch when #2122 reaches patches.