Skip to content

Directory join: force the reboot the enforce flag asks for - #29

Merged
mastacontrola merged 2 commits into
mainfrom
fix/force-join-reboot
Oct 13, 2026
Merged

mastacontrola merged 2 commits into
mainfrom
fix/force-join-reboot

Conversation

@mastacontrola

@mastacontrola mastacontrola commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Problem

A domain join with "Enforce Hostname | AD Join Reboots" set never rebooted while a user was logged in. The agent logged reboot: pending_reboot (waiting for 2 logged-in user(s) to leave (directory: joined a domain; ...)) every poll. Seen on host 3163 (PW0HGF8S).

Cause

The server sends the host's enforce flag as the directory block's reboot (DirectoryJoin.php, 'reboot' => (bool)$Host->get('enforce')). The agent used it only to decide whether to ask for a reboot at all, and the reason it recorded was never forced.

Fix

  • Report.Reboot now means "the join needs a reboot". A new Report.Force carries the enforce flag.
  • reportDirectory records the reason with Force: r.Force.
  • Enforce set: forced, a logged-in user gets FOG_GRACE_TIMEOUT of warning. Enforce unset: the reboot waits until all users log off. Before, an unset flag dropped the reboot entirely.

This matches the host page text and protocol-v1 ("forced if the host's enforce flag is set").

Note

A machine that already holds the unforced reason keeps it, and the update capability defers while any reboot is pending. So an affected machine gets this fix only after one manual restart, which also finishes its join.

Test

TestAJoinRebootFollowsTheEnforceFlag and TestConvergeForcesTheRebootOnlyUnderEnforce replace the old permission test. Both go red with the force dropped. go test ./... and go vet (linux, windows) pass.

🤖 Generated with Claude Code

mastacontrola and others added 2 commits October 13, 2026 11:36
A join asks for a reboot only when the host's "Enforce Hostname | AD Join
Reboots" flag is set. The reason went to the coordinator unforced, so it
waited for every logged-in user to leave. On a workstation nobody logs
off, the join never finished. protocol-v1 says a capability's reason is
forced when the enforce flag is set; this now matches it. A logged-in
user still gets FOG_GRACE_TIMEOUT of warning.

Seen on host 3163 (PW0HGF8S), 2026-10-13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit forced every join reboot. Force now comes from the
host's "Enforce Hostname | AD Join Reboots" flag, as the host page says:
set, the client forces the reboot; unset, it waits until all users log
off. Before this, an unset flag dropped the reboot request entirely, so
the join never finished even on an empty machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit ea264b5 into main Oct 13, 2026
2 checks passed
@mastacontrola
mastacontrola deleted the fix/force-join-reboot branch October 13, 2026 16:41
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