Repository navigation
feat(closed-lid): install, detect and remove the pmset sudo rule - #58
Merged
Merged
Conversation
…ck off permission retries ClosedLidPermission owns the fixed /private/etc/sudoers.d/dilated rule, detects notInstalled, needsRepair, blocked, ready and notAdmin, and installs or removes it through an injected admin-prompt runner. The local transport tick loop now backs off from 1s to 30s while sudo refuses, still failed and still retrying.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Nov 2, 2026
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.
Second step of moving closed-lid mode off the root helper.
ClosedLidPermissionmanages/private/etc/sudoers.d/dilated, which allows onlypmset -a disablesleep 0and1for admin users. Install runs one fixed script through the admin prompt. It writes the rule to a temp file, checks it withvisudo -cf, installs it as root:wheel 0444 and moves it into place, then runsvisudo -cand deletes the file if that fails. Remove deletes the file and runsvisudo -cagain. Detection reports notInstalled, needsRepair, blocked, ready or notAdmin. Cancelling the prompt is its own outcome.The in-app transport now backs off from 1s to a 30s cap while sudo refuses the command, instead of starting a failing sudo every second. It still fails closed and keeps retrying. That was a follow-up from the #57 review.
Nothing calls this yet. Settings and the CLI come in a later step. Tests use injected seams and never touch real sudo, osascript or /etc.
visudo -cfruns on the rule written to a temp file.