Repository navigation
fix(server): keep-awake stops retrying when logind denies the inhibitor - #32
Merged
Merged
Conversation
On a systemd user service with no interactive session, polkit refuses `systemd-inhibit --mode=block` every time. The hold retried under backoff forever and logged a full stack on each attempt (about 7,600 lines in hub's boot-service.log on 2026-11-19). An inhibitor exit whose stderr reports an access or authentication denial now logs one warning without a stack and turns every later hold in the process into a no-op. Other failures keep the existing backoff retry. The retry policy moves into an exported makeHold so tests drive it with a fake holdOnce on the TestClock.
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.
On a host where T3 runs as a systemd user service with no interactive session, logind/polkit refuses
systemd-inhibit --mode=blockevery time, and keep-awake retried forever, logging a full stack on each attempt (~7,600 lines in hub's boot-service.log on 2026-11-19).Fix: an inhibitor exit whose stderr reports an access or authentication denial ("Access denied", "interactive authentication", "not authorized") now logs one warning without a stack (
keep-awake disabled until restart: …) and makes every later hold in that process a no-op. Other failures keep the existing exponential backoff. The setting, platform commands and run detection are unchanged.Proof:
KeepAwake.test.ts: a denied hold run twice across an hour spawns once and logs one warning with an empty cause; a plain non-zero exit still retries at 5 s and 10 s. Both failed before the change; 3/3 pass after.Failed to inhibit: Access denied as the requested operation requires interactive authentication. However, interactive authentication has not been enabled by the calling program.(exit 1)vp run check:changed: format, lint, knip, graphql, typecheck (3 packages), tests (2 files) pass.