Closed
Labels
app/power-guardnixos/services/power-guard battery confirmation daemonnixos/services/power-guard battery confirmation daemonarea/nixosNixOS modules and machine configurationNixOS modules and machine configurationeffort/sSmall: expected under 2 hours of workSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/highImportant and time-sensitiveImportant and time-sensitivesource/pr-comment-reviewFiled by the pr-comment-review jobFiled by the pr-comment-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted tests
Description
Finding (unaddressed PR review comment)
On PR #8025 (fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, for issue #6534), CodeRabbit raised a Major stability finding that was never fixed or replied to:
Keep the child until release is confirmed. If the child remains alive after both waits,
release()forgets it and logs success. The inhibitor can then continue blocking sleep without a cleanup retry. Retain the child until it exits, and report an unsuccessful release instead.
- Source PR: fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025
- Comment: fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025 (comment) (comment id 4511572439)
- Reviewer: coderabbitai[bot], 2026-11-09T10:10:56Z
- Location:
nixos/services/power-guard/power-guard.py,Inhibitor.release()(lines 233–254 at PR head)
No-response evidence
- The review thread is unresolved (GraphQL
reviewThreadschecked 2026-11-10) and has no replies — the CodeRabbit comment is the only comment in the thread. - PR fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025's head is unchanged since the comment: the only commit is
2a6abfda8194eb944894b5fc647778f82aa977f5(2026-11-09T10:04:21Z, before the comment). No fix commit followed. - The PR is still open and the comment is more than 24 hours old, so the open-PR grace rule is expired.
- No existing issue covers this: 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 the parent dead-child-detection issue that PR fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025 addresses; the release-path defect below is distinct. Searched open/recently-closed issues for power-guard / inhibitor / release on 2026-11-10.
Still-live evidence (PR head 2a6abfda81, read 2026-11-10)
nixos/services/power-guard/power-guard.py:
- Line 233–234:
release()copiesself.procto a local and immediately setsself.proc = None— the child is forgotten up front. - Lines 253–254: after
terminate(),rc = self._reap(proc)is followed by an unconditionallog(f"INHIBIT released (child exit={rc})"). _reap()(lines 153–175) returnsproc.poll()when the post-kill wait raises — andpoll()returnsNonewhile the child is still running (e.g. stuck in uninterruptible sleep, where even SIGKILL stays pending). In that caserelease()logs "INHIBIT released (child exit=None)" as success while thesystemd-inhibit --mode=blockchild is still alive and still blocking sleep, and nothing retains a handle to retry cleanup. The machine can stay awake on a critical battery with the journal claiming the inhibitor was released.
Acceptance criteria
release()retains the child handle until the child's exit is confirmed (poll()/_reap()shows a real exit), and clears it / logs successful release only after that confirmation; or the current behavior is resolved by a documented decision recorded on this issue.- If the child is still alive after the existing waits, the release is reported as unsuccessful (loud log), not as "INHIBIT released".
- Regression coverage: a fake child whose
poll()still returnsNoneafter terminate + kill + waits exercises the retained-handle / unsuccessful-release path (the PR fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025 review also noted the inhibitor failure paths intest_power_guard.pylack such cases).
Metadata
Metadata
Assignees
Labels
app/power-guardnixos/services/power-guard battery confirmation daemonnixos/services/power-guard battery confirmation daemonarea/nixosNixOS modules and machine configurationNixOS modules and machine configurationeffort/sSmall: expected under 2 hours of workSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/highImportant and time-sensitiveImportant and time-sensitivesource/pr-comment-reviewFiled by the pr-comment-review jobFiled by the pr-comment-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted tests
Activity
developing-today commentedon Nov 10, 2026
CODE-2417
dezren39 commentedon Nov 10, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 10, 2026
🤖 Agent note · parked awaiting triage — Agent: queue worker (repo-worker-code), lane code-u — Session/ID: task 14651, repo-queue-worker-shift-u 2026-11-10 run. Task 14651 (triage) for issue #8182. Fresh check: issue #8182 OPEN, labels: kind/bug, task/triage, status/needs-triage, priority/high, queue/queued, area/nixos, source/pr-comment-review, app/power-guard. triage belongs to the triage step (#8097 rule 3).
2 remaining items
dezren39 commentedon Nov 10, 2026
🤖 Agent note · triaged
Inhibitor.release()innixos/services/power-guard/power-guard.py.release()(lines 233–254 at PR fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025 head2a6abfda81), retainself.procuntilpoll()/_reap()confirms a real exit instead of clearing it up front; when the child is still alive after the waits, log the release as unsuccessful (loud), not "INHIBIT released".poll()still returnsNoneafter terminate + kill + waits covers the retained-handle path. Companion: power-guard: release() blocks the sampling loop up to ~10s reaping a stalled child, delaying the confirmed sleep command (PR #8025 review finding) #8183 (non-blocking reap) — the two fixes interact and must not drop the confirmed-release requirement.repo-health:v1:fix:developing-today/code:issue:8182.dezren39 commentedon Nov 10, 2026
🤖 Agent note · done (triaged packet)
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off
opencode(lane row 6010); scheduled shift is time-bounded and the claimant is the persistent execution session, so the task is parked for the opencode claimant to launch its bound session.dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off to opencode claimant
status/needs-triage. Handoff reason (Rule 4, Queue/lane design rules: no by-id blocking by default, optional platform selector, triage separate from fixes #8097): this scheduled shift is time-bounded; the claimant is the persistent execution session.fix/6534-power-guard-dead-child, currently awaiting CI). That change retains the child in a pending-reap record and logsINHIBIT release UNCONFIRMEDinstead of a false success — but after kill escalation is exhausted it stops retrying, so verify it against power-guard: release() forgets a still-running systemd-inhibit child and logs success — sleep stays blocked with no cleanup retry (PR #8025 review finding) #8182's stricter acceptance (retain handle until exit confirmed, with cleanup retry) and add the retained-handle regression case; do not duplicate the non-blocking reap work.dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 10, 2026
Task 14654 (issue #8182) — handed off to opencode claimant, lane B shift 2026-11-10.
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off to opencode claimant — Agent: queue worker (repo-worker-code), lane code-g — Session/ID: task 14654, repo-queue-worker-shift-g 2026-11-10 run. Task 14654 (small_fix) for issue #8182: power-guard release() retains the systemd-inhibit child until exit is confirmed and reports unsuccessful release. Fresh check: issue #8182 OPEN, no held/user/owned/do-not-merge/do-not-auto-edit labels, no status/needs-triage. Execution lane row 6010 = opencode. Checkpointed handed_off with Rule 4 reason; parking task 14654 for 20 minutes for the claimant window.
dezren39 commentedon Nov 10, 2026
state: done
task: 14654
lane: code-w
issue: "#8182"
pr: "#8188"
Decision recorded by lane code-w (task 14654), per this issue's acceptance option 4 (documented decision):
Issue #8182 asked that
Inhibitor.release()retain the systemd-inhibit child until exit is confirmed and report an unsuccessful release instead of forgetting the child and logging success (CodeRabbit Major on PR #8025, thread r4511572439).PR #8188 (stacked on PR #8025's head; companion issue #8183; currently OPEN, MERGEABLE, checks QUEUED in the fleet CI stall) implements the substance:
Inhibitor._pendingthrough the full terminate → grace wait → kill escalation, reachable viaheld/reap_settled()/poll_reap().test_stalled_child_reap_moves_off_the_calling_loop(fake child still running after terminate + kill + waits; UNCONFIRMED asserted; lock believed held while the child runs). Suite verified by this lane on PR fix(power-guard): reap stalled inhibitor child off the sampling loop (#8183) #8188's branch: 14/14 tests pass.Deliberate divergence from the letter of criterion 1: after the bounded escalation is exhausted and UNCONFIRMED is logged, the handle is cleared (the #8183 design's documented trade-off in the
release()docstring) so a child stuck in uninterruptible sleep cannot wedge the sampling loop forever. The release is reported unsuccessful in that state, which is what this issue's safety property actually requires: sleep is never believed unblocked on a silent success.Disposition reply posted on the CodeRabbit thread on PR #8025. Task 14654 completes as pr_opened naming PR #8188; when PR #8188 merges (task 14655's CI-wait resume), this issue can close.
dezren39 commentedon Nov 17, 2026
Agent note — task 20079: already_done concurrence (lane any-d, 2026-11-17)
Fresh verification this shift: issue #8182 is CLOSED as COMPLETED (2026-11-17T03:15:21Z,
status:done). The fix landed via PR #8188 — MERGED 2026-11-11T03:31:58Z, merge SHA 88d1022 — implementing the task 14654 decision of record (release() retains the systemd-inhibit child until exit is confirmed and reports an unsuccessful release). Task 20079 is the bulk-intake triage follow-on from task 18597; completing it asalready_done. No follow-on needed.