@lperoma Thanks for the detailed report. Your reading of the code is right. I opened https://github.com/FOGProject/fogproject/pull/2122 to fix both problems.
On your open question: the first attempt did run. The server stores awaiting_reboot only when the agent reports that Windows accepted the join. Your state also has last_deploy_task_id equal to trigger_task_id (16923), and that is set only when the agent claims the plan. So the join ran after Deploy 16923, and Windows waited for a restart. The disk was reimaged by 16927 before that restart, so the agent never reported “verified”. That also explains why the computer account in AD looked healthy.
What changes in #2122:
A newer Deploy now supersedes an old attempt in started, awaiting_reboot, unknown or failed. Three things must be true: the agent has no marker for the old attempt, a newer Deploy has completed, and the machine booted after that Deploy ended. FOG then drops the old attempt, writes an audit entry, and plans a new join from the new Deploy. If the agent still has the marker, the old attempt stays. The “Clear directory operation review” checkbox no longer marks the newest Deploy as used. It uses up only the cleared attempt’s own Deploy. It also keeps the workgroup flag and the observation. If a newer Deploy exists, the next check-in can plan the join again. With the first change, a reimaged host no longer needs the checkbox, so I did not add a hint to the Active Directory panel.On queued tasks and snapins from the previous install: this PR changes only the directory join plans.
The fix reaches the patches channel after the PR merges. Your hand-written state on test-uefi does no harm.