fix(cli): non-elevated daemon management when the broker is serving (Windows)#464
Merged
githubrobbi merged 2 commits intoJun 20, 2026
Merged
Conversation
…Windows)
On Windows the daemon-management elevation gate
(`mutating_management_needs_elevation`) was hardcoded to `true`, so EVERY
stop/restart needed an elevated shell — even with the Access Broker installed.
That broke the non-elevated `uffs --update` on Windows: its quiesce drives
`uffs --daemon stop`, the gate refused ("Daemon management commands require an
elevated (Administrator) shell"), the daemon never stopped, and apply rolled
back ("daemon did not stop within 20s"). It defeats the whole point of the
broker (zero-UAC operation) and forced users into an elevated window to update.
Fix: on Windows, require elevation only when the broker pipe is NOT serving.
With the broker up the daemon runs non-elevated and a non-elevated caller can
stop AND restart it (restart adopts broker handles — no UAC), so there's no
risk of stranding a daemon that can't be brought back. Without the broker, a
restart would need admin to re-read the MFT, so elevation is still required.
Mirrors the Unix path, which already gates on PID-file ownership not a blanket
`true`. The old `#[cfg(not(unix))]` `true` splits into `#[cfg(windows)]`
(broker-aware) and `#[cfg(not(any(unix, windows)))]` (conservative `true`).
Verified: macOS build + windows-msvc cross-build + windows clippy all clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
On Windows, a non-elevated
uffs --updatefails to apply:Even with the Access Broker installed and serving, you must open an elevated window to update — which defeats the broker's entire purpose (zero-UAC operation).
Root cause
The daemon-management elevation gate was hardcoded on Windows:
So every
uffs --daemon stop/restartdemanded elevation. The self-update quiesce drivesuffs --daemon stop, the gate refused, the daemon never stopped, and apply rolled back. (Unix already gates intelligently on PID-file ownership; only Windows was blanket-true.)Fix
On Windows, require elevation only when the broker pipe is NOT serving. With the broker up, the daemon runs non-elevated and a non-elevated caller can stop and restart it (restart adopts broker handles — no UAC), so there's no risk of stranding a daemon that can't be brought back. Without the broker, a restart needs admin to re-read the MFT, so elevation is still required.
The old
#[cfg(not(unix))]truesplits into#[cfg(windows)](broker-aware) and#[cfg(not(any(unix, windows)))](conservativetrue). Docs updated to match.Result
The intended zero-UAC flow holds end-to-end: on a broker-equipped install, non-elevated
uffs --updatejust works — no elevated window needed.Verification
macOS build +
x86_64-pc-windows-msvccross-build + Windows clippy all clean; file stays within the 800-LOC policy.🤖 Generated with Claude Code