Skip to content

fix(server): keep-awake stops retrying when logind denies the inhibitor - #32

Merged
radys-s merged 1 commit into
mainfrom
tomas/keep-awake-access-denied
Nov 22, 2026
Merged

radys-s merged 1 commit into
mainfrom
tomas/keep-awake-access-denied

Conversation

@radys-s

@radys-s radys-s commented Nov 22, 2026

Copy link
Copy Markdown
Owner

On a host where T3 runs as a systemd user service with no interactive session, logind/polkit refuses systemd-inhibit --mode=block every 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.
  • Real denial text on hub2 (matches): 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.

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.
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M labels Nov 22, 2026
@radys-s
radys-s merged commit 2479ed9 into main Nov 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant