Skip to content

Wait for Windows setup to finish before doing anything - #46

Merged
mastacontrola merged 1 commit into
mainfrom
feat/wait-for-windows-setup
Nov 10, 2026
Merged

mastacontrola merged 1 commit into
mainfrom
feat/wait-for-windows-setup

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

A sysprepped image starts fog-agent during specialize and OOBE, with nobody logged in. The reboot coordinator reboots at once when nobody is logged in. So a rename or a domain join could reboot the machine mid-setup and stop Windows setup ("Windows could not complete the installation"). Forum topic 18311 asked whether the agent must be disabled before Sysprep. After this change, it does not.

  • runAgent calls waitForWindowsSetup before it opens state. It reads HKLM\SYSTEM\Setup\State\ImageState every 30 seconds and continues at IMAGE_STATE_COMPLETE or when the value is absent. Audit mode and every RESEAL state wait.
  • A read error counts as finished, so a damaged key cannot stop the agent for good.
  • Stop works while it waits: the wait selects on the context.
  • docs/install-windows.md and design 0001 §4.4 describe the wait.

Verified: tests for the state table, the hold-until-complete loop, cancel, and read error. All of them fail with setupFinished forced to true. On telliottwin11 (installed from media), HKLM\SYSTEM\Setup\State does not exist, so the agent starts at once there. Not verified: a full Sysprep and OOBE run in the lab.

Supersedes #45.

🤖 Generated with Claude Code

A sysprepped image starts the service during specialize and OOBE, with
nobody logged in. The reboot coordinator reboots at once with nobody
logged in, so a rename or a join could reboot mid-setup and stop Windows
setup. runAgent now reads HKLM\SYSTEM\Setup\State\ImageState first and
waits, polling every 30 seconds, until it is IMAGE_STATE_COMPLETE or
absent. Nothing enrolls, polls or reboots before that. Audit mode counts
as unfinished. A read error counts as finished, so a damaged key cannot
stop the agent for good. Stop still works while it waits.

The install doc and design 0001 section 4.4 describe the wait. The
install doc also says the agent needs no inbound firewall rule.

Forum topic 18311.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit f3fefb7 into main Nov 10, 2026
2 checks passed
@mastacontrola
mastacontrola deleted the feat/wait-for-windows-setup branch November 10, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant