GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded · Issue #6534 · developing-today/code

power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534

New issue
Copy link
New issue
Copy link
Closed
#8025
Closed
power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded#6534
#8025
Copy link
Assignees
dezren39
Labels
app/power-guardnixos/services/power-guard battery confirmation daemonarea/nixosNixOS modules and machine configurationkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)source/creatorFiled by the new-issue-creator jobstatus/parkedDeliberately paused with a recorded resume conditionstatus:donetask/triageQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle state

Description

@dezren39
dezren39
opened on Nov 6, 2026
Issue body actions

Problem

power-guard never notices when its systemd-inhibit child dies. The daemon's only protection against UPower's single-sample CriticalPowerAction is the block inhibitor it holds while it confirms a critical reading (#1687); if that child exits, the guard keeps believing it holds the block for the rest of the process lifetime, logs nothing, and never tries to re-engage — so the machine is exactly as unguarded as if power-guard were not running, while the daemon reports a healthy state.

Evidence

nixos/services/power-guard/power-guard.py @ 2bcd46e0dc:

  • Inhibitor.engage() (:153-173): returns immediately when self.proc is not None (:154-155); otherwise Popens systemd-inhibit … sleep infinity (:160-172), discards its stdout/stderr to DEVNULL (:170-171), and logs "engaged" (:173). Nothing ever calls poll() / wait() on the child.
  • Inhibitor.held (:183-185): return self.proc is not None — handle non-None is treated as lock held, regardless of whether the process is alive.
  • Inhibitor.release() (:175-181) is the only place self.proc returns to None (plus terminate() without wait()).
  • Main loop (:208-215): the low-battery path calls inh.engage() every poll; with a dead child every one of those calls is a no-op.

Verified this run on the laptop (probe ~/git/fleet/probe-pg-inhibit, real power-guard.py, stub systemd-inhibit on PATH):

  • Stub exits 1 immediately: after engage(), inh.proc.poll() == 1 (child dead) yet inh.held == True; a second engage() did not invoke systemd-inhibit again (stub invocation log: exactly 1 call). The daemon would sit in this state forever.
  • Control (stub exec sleep 30): poll() is None, held == True, release() clears held — the live path works as intended.

A child can die for ordinary reasons: systemd-inhibit failing to acquire the lock, the inhibitor being killed, a logind restart/reload, or the sleep infinity being signalled. Because stderr goes to DEVNULL, even the child's own complaint is invisible.

Why it matters

The guard exists because of the 2026-10-28 incident (#1687): UPower hybrid-slept the laptop for 2h40m on a glitched reading. A silently dead inhibitor recreates that exact exposure with a false sense of coverage — the unit is active, the log says "INHIBIT(block sleep) engaged", and the first glitched critical sample sleeps the machine. Silent loss of a safety control is worse than the control failing loudly.

Acceptance criteria

  • The daemon detects a dead inhibitor child (e.g. held reflects poll() is None for a real process, checked on engage and/or each poll cycle).
  • On detection it acts, per a stated policy: re-engage the inhibitor (logging the death and the child's exit status loudly) and/or exit non-zero so the unit surfaces as failed — it must not continue indefinitely believing it holds a lock it does not hold.
  • The child's stderr is no longer unconditionally discarded, or its exit status is logged on death, so the failure is diagnosable from the journal.
  • release() reaps the child (wait() or equivalent) instead of leaving a zombie.
  • Tests in test_power_guard.py (the suite added for power-guard: timing env overrides are never validated — CONFIRM=0/negative fires hybrid-sleep on the first critical sample, malformed/negative POLL crash-loops the daemon #6477) cover: a child that exits immediately is detected and handled; a live child is not disturbed; the NO_INHIBIT stub path is unchanged.
  • Existing power-guard tests still pass.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    developing-todayBot
    on Nov 6, 2026 – with developing.today
    Contributor
    More actions

    CODE-1986

  3. dezren39
    added
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    area/nixosNixOS modules and machine configuration
    app/power-guardnixos/services/power-guard battery confirmation daemon
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · state: filed

    • Agent: new-issue-creator-code-b
    • Session / ID: new-issue-creator-code-b cron run 2026-11-06 09:20 CST
    • Found via: filed this run
    • Task: Filed after verifying with the real module on the laptop (probe ~/git/fleet/probe-pg-inhibit): a stub systemd-inhibit exiting 1 leaves held==True forever and a second engage() never re-invokes it; live-child control passes. Enqueuing a triage packet for the queue worker.
    • Expectation: effort/s — done looks like child-death detection with a stated re-engage/fail-loud policy, exit-status logging, release() reaping, and test_power_guard.py coverage.
    • Links: issue power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534; related power-guard: gate UPower's critical-power hybrid-sleep behind a sustained-reading confirmation (laptop slept 2h40m on a glitched battery reading, 2026-10-28) #1687, power-guard: timing env overrides are never validated — CONFIRM=0/negative fires hybrid-sleep on the first critical sample, malformed/negative POLL crash-loops the daemon #6477
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 6, 2026
  6. 152 remaining items

    Load more actions
  7. dezren39
    added
    status/parkedDeliberately paused with a recorded resume condition
    work/assignedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 9, 2026
  8. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: repo queue worker, lane code-l (repo-worker-code)
    • Session / ID: cron repo-queue-worker-shift-l run 2026-11-09; task 14266
    • Found via: claimed task 14266 this shift; execution-lane assignment returned opencode (lane row 5320)
    • Task: task 14266 for issue power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534, no PR (small_fix). Fresh check: issue power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534 is OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit). Handed off to the opencode claimant — the claimant launches the bound opencode session; this lane does not work it directly.
    • Expectation: claimant session drives task 14266 to a terminal state.
    • Links: task 14266 · issue power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534
  9. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions

    agent-note:v1 task 14266 lane code-t: picked up and handed off to opencode claimant (lane row 5320). Verified fresh: issue #6534 OPEN labels=['kind/bug', 'task/triage', 'status/parked', 'source/creator', 'priority/normal', 'queue/parked', 'area/nixos', 'work/assigned', 'app/power-guard']; ; no hard-stop labels. Next: claimant launches the bound opencode session.

  10. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions

    Handed off — task 14266 (lane code-v)

    Execution lane assigned: opencode (lane row 5320). Checkpointed handed_off and parked 1200s; the laptop opencode claimant launches the bound session. Revalidated fresh via gh this shift: open, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit).

  11. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: repo queue worker, lane code-y (repo-worker-code)
    • Session / ID: cron repo-queue-worker-shift-y run 2026-11-09; task 14266
    • Found via: claimed task 14266 this shift; execution-lane assignment returned opencode (lane row 5320)
    • Task: task 14266 for issue power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534. Fresh check: issue power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534 is OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit). Handed off to the opencode claimant — the claimant launches the bound opencode session; this lane does not work it directly.
    • Expectation: claimant session drives task 14266 to a terminal state.
    • Links: task 14266 · issue power-guard: a dead systemd-inhibit child is never noticed — held stays true forever, engage() is a no-op, and the machine is silently unguarded #6534
  12. dezren39
    added a commit that references this issue on Nov 9, 2026

    fix(power-guard): detect dead systemd-inhibit child, re-engage loudly…

    2a6abfd
  13. developing-today
    added
    status:in-review
    on Nov 9, 2026
  14. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions
    \n## Triage verdict — REAL AND CURRENT (fix task 14266)\n\nRe-verified against current main before fix: nixos/services/power-guard/power-guard.py still had the filed failure (engage() early-return on non-None proc, held = proc is not None, no poll()/wait(), release() terminate without wait). No open fix PR existed.\n\nFix: PR #8025 (branch fix/6534-power-guard-dead-child) — held reflects poll() is None, engage() detects dead child, logs exit loudly, reaps and re-engages; release() reaps via wait() with kill fallback; tests cover dead/live/stub/release paths. Existing 8 tests still pass (13 total OK).
  15. github-actions
    assigned
    dezren39
    on Nov 12, 2026
  16. dezren39
    added a commit that references this issue on Nov 14, 2026

    fix(power-guard): detect dead systemd-inhibit child, re-engage loudly…

    6dd725c
  17. dezren39
    closed this as completedin #8025on Nov 14, 2026
  18. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/power-guardnixos/services/power-guard battery confirmation daemonarea/nixosNixOS modules and machine configurationkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)source/creatorFiled by the new-issue-creator jobstatus/parkedDeliberately paused with a recorded resume conditionstatus:donetask/triageQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle state

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.