GeezerVison is showing github.com — power-guard: release() blocks the sampling loop up to ~10s reaping a stalled child, delaying the confirmed sleep command (PR #8025 review finding) · Issue #8183 · developing-today/code
power-guard: release() blocks the sampling loop up to ~10s reaping a stalled child, delaying the confirmed sleep command (PR #8025 review finding) #8183DescriptionFinding (unaddressed PR review comment)
On PR #8025 (fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, for issue #6534), CodeRabbit raised a stability finding that was never fixed or replied to:
Keep sampling while a stalled child is reaped. If systemd-inhibit does not exit promptly, release() can block the loop for about 10 seconds. This delays the next sample or the confirmed sleep command. Handle stalled reaping without blocking sampling, and confirm inhibitor release before issuing sleep.
No-response evidence
Still-live evidence (PR head 2a6abfda81, read 2026-11-10)
nixos/services/power-guard/power-guard.py:
_reap() (lines 153–175) waits synchronously: proc.wait(timeout=5), and on timeout escalates to kill() and waits another 5 seconds — up to ~10 seconds of blocking in the caller.
release() calls _reap() synchronously (line 253), and main() calls release() inline in the sampling loop — both on the recovery path (line 292) and, critically, on the confirmed-sleep path (lines 310–312), where the sleep command is only issued after release() returns. A stalled child therefore delays an already-confirmed emergency sleep by up to ~10 seconds on a critical battery, and delays every other sample while reaping.
Note the interaction with the companion finding from the same review (release forgetting a still-running child): the fix must keep sampling/reaping from blocking the loop without dropping the requirement that inhibitor release is confirmed before the sleep command is issued.
Acceptance criteria
- Reaping a stalled
systemd-inhibit child no longer blocks the sampling loop for the full double-wait; sampling continues while reaping is pending, and the confirmed-sleep path still does not issue the sleep command until inhibitor release is confirmed; or the current behavior is resolved by a documented decision recorded on this issue.
- The existing timeout and kill-escalation safeguards are preserved.
- Regression coverage: a fake child that ignores terminate/kill exercises the non-blocking reap path in
test_power_guard.py.
Activitydeveloping-today commented on Nov 10, 2026 dezren39 commented on Nov 10, 2026 🤖 Agent note · filed
- Agent: pr-comment-review job
- Session / ID: pr-comment-review run 2026-11-10 11:54 CST
- Found via: unaddressed PR comment — PR fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025 review comment fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025 (comment) (coderabbitai[bot], 2026-11-09)
- Task: triage the validated finding: power-guard release() blocks the sampling loop up to ~10s reaping a stalled child
- Expectation: effort s — queue worker verifies against current code, then fixes or resolves by documented decision
- Links: source PR fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025; parent 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
dezren39 commented on Nov 10, 2026 🤖 Agent note · parked awaiting triage — Agent: queue worker (repo-worker-code), lane code-u — Session/ID: task 14652, repo-queue-worker-shift-u 2026-11-10 run. Task 14652 (triage) for issue #8183. Fresh check: issue #8183 OPEN, labels: kind/bug, task/triage, status/needs-triage, priority/normal, queue/queued, area/nixos, source/pr-comment-review, app/power-guard. triage belongs to the triage step (#8097 rule 3). dezren39 commented on Nov 11, 2026
Parked — Queue task 14655 is parked for 30 minutes. PR #8188 targets the Drew-owned branch of #8025, so this lane will not merge it there. Checks are pending. Before integration, establish an authorized path and verify that the proposed handling preserves confirmed inhibitor release, including the concern in #8182. dezren39 commented on Nov 11, 2026
state: in-progress
task: 14655
lane: code-u
pr: 8188
outcome: resumed_fix_pr_exists
Task 14655 (issue #8183) resumed by lane code-u. The fix already exists as PR #8188 (lane code-w) targeting PR #8025's branch fix/6534-power-guard-dead-child — the only place _reap() exists. Fresh verification this shift: full diff read against the #8183 acceptance (0.5s inline grace, background kill-escalation reap, held stays true while a reap is in flight so no second inhibitor stacks — the #8182 requirement — and the confirmed-sleep path issues sleep only after reap_settled()); python3 -m unittest test_power_guard at head 91de65d: 14 tests OK, including the FakeStalledProc regression. Codex review on PR #8188 failed on Codex usage limits and posted no findings; CodeRabbit skipped (non-default base). PR #8025 carries no held/user/owned/do-not-merge labels, so integration proceeds: merging PR #8188 into #8025's branch now. dezren39 commented on Nov 11, 2026
state: done
task: 14655
lane: code-u
pr: 8188
outcome: fixed_merged
Task 14655 complete: PR #8188 merged into PR #8025's branch fix/6534-power-guard-dead-child as 88d1022 (PR #8025 head verified at that commit). The #8183 acceptance is met on that branch: release() no longer blocks the sampling loop on a stalled child (0.5s inline grace, background kill-escalation reap), the confirmed-sleep path still waits for reap_settled() before issuing sleep, the timeout/kill safeguards are preserved with a loud UNCONFIRMED log, and the FakeStalledProc regression test covers it — full suite 14 tests OK in a fresh run this shift. The original CodeRabbit finding thread on PR #8025 was dispositioned with the fix summary.
This issue stays open until PR #8025 itself merges to main (that PR is #6534's, outside this task's scope); the fix rides with it.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|