Repository navigation
Description
Incident (2026-10-28, laptop amd-6)
The laptop was unreachable fleet-wide ~06:11–09:00 CDT. Journal evidence:
06:12:29 systemd-logind: hybrid-sleep requested from client PID 38231 ('upowerd') ... The system will hybrid sleep now!06:12:29 systemd[1]: Reached target Sleep/systemd-sleep: Performing sleep operation 'hybrid-sleep'/ kernelPM: hibernation: hibernation entry08:53:10 systemd[1]: Stopped target Sleep(resume)
UPower's critical-power action (CriticalPowerAction=HybridSleep, PercentageAction=2, PercentageCritical=5, TimeAction=120) fired on a reading that could not have been real: no low-battery warnings were logged beforehand, and minutes after resume the battery read 99%, Charging, AC online=1. A real drain to 2% cannot recharge to 99% that fast. Most likely a glitched time-to-empty/percentage sample (the machine also carries several churning UCSI USB-C power-source entries). Cost: a ~2h40m fleet-wide laptop outage (46 queue items parked on the outage tracker).
UPower has no "wait and re-check" setting — it acts on a single sample. Drew's direction: keep sleep as the response to a genuine critical battery (this machine is normally on AC, but if it were on battery, sleep beats a hard power loss); a false sleep is worse than either.
The guard (built + tested 2026-10-28)
A small poller that adds the missing confirmation step. Tested implementation already exists on the laptop at ~/tools/power-guard.py (python3, no deps):
- Polls
/sys/class/power_supplyevery 15s. - While discharging and at/below 20% (UPower's PercentageLow) or a ≤900s time-to-empty, it holds a
systemd-inhibit --what=sleep --mode=blocklock, so UPower's sleep request cannot fire unconfirmed. - Any recovery (AC back, status Charging/Full, charge above the low line) releases the lock and resets all timers — a glitch never survives minutes of continuous polling.
- Only a sustained critical state makes the guard release the lock and issue
systemctl hybrid-sleepitself:- at/below 2% (UPower's PercentageAction): sustained 60s
- at/below 5% or ≤300s-to-empty: sustained 300s
- On AC it can never fire.
Fake-battery test (fake sysfs tree, stubbed inhibitor + sleep command, compressed timers) — all assertions passed:
- engages the block when unplugged at 18%
- detects critical at 4%, does not fire inside the confirmation window
- AC returning mid-confirmation releases the block, no sleep
- sustained 2% fires exactly once, via the edge path
Landing spec
- Add a
power-guardsystemd service to the laptop's NixOS config (the#amdsystem in this repo's flake), besidenixos/services/pm-stack/: runs the script as root,Restart=always, starts at boot. Install the script content from the tested~/tools/power-guard.pyon amd-6 (pin it into the repo; do not hand-copy at deploy time). - Leave UPower's config and thresholds unchanged — the guard gates the action, it does not replace UPower's detection.
- After the switch, verify on the live machine: service active;
systemd-inhibit --listshows the block only while discharging at/below the low line (test by a brief AC unplug above the critical line — expect block engaged, no sleep, release on replug). - Retire the hand test copy at
~/tools/power-guard.pyonce the flake service is live (pointer comment is fine).
Drew approved the design + thresholds in chat 2026-10-28 09:13 CDT (5-minute confirmation, 1 minute at a true 2%).
Acceptance criteria
- A
power-guardsystemd service exists in the laptop's NixOS config (the#amdsystem in this repo's flake), besidenixos/services/pm-stack/, running the guard script as root withRestart=always, starting at boot; the script content is pinned into the repo from the tested~/tools/power-guard.pyon amd-6 (not hand-copied at deploy time). - UPower's config and thresholds are unchanged — the guard gates the action, it does not replace UPower's detection.
- Live verification after the switch: the service is active;
systemd-inhibit --listshows the sleep block only while discharging at/below the low line; a brief AC unplug above the critical line engages the block with no sleep, and replugging releases it. - The hand test copy at
~/tools/power-guard.pyis retired once the flake service is live (a pointer comment is fine).
Activity
developing-today commentedon Oct 28, 2026
CODE-677
dezren39 commentedon Oct 28, 2026
Intake review
🤖 Agent note · filed
Still live: no merged PR resolves this. PR #1689 is open and implements exactly this landing spec — the intake does not close the issue; the worker on #1689 owns the live-machine verification steps.
Related: dezren39/darwin-nix#1020 (the SSH-unreachability tracker this incident fed — the 06:11–09:00 CDT outage was this hybrid-sleep, not an sshd failure); the fleet parked ~46 queue items on that outage.
Risks / notes:
dezren39 commentedon Nov 2, 2026
Agent note — picked up (OpenChamber scheduled lane)
49 remaining items
dezren39 commentedon Nov 14, 2026
Released to the queue under Drew's 2026-11-13 unblock-all order (main chat, 23:53 CT). Task(s) 11954 moved from blocked/parked to queued in the fleet unblock-all pass (worker
main-unblock-all-2026-11-13). Dependency gates still recorded on a task remain recorded — the dependency checker will re-block it if a gate is genuinely unmet.dezren39 commentedon Nov 14, 2026
Triage of the remainder — task 11954 (lane code-d, 2026-11-14)
user/escalatedlabel stands (accurately)Landing spec, verified item by item against live state today:
nixos/services/power-guard/default.nixandnixos/services/power-guard/power-guard.pyare on main, wired vianixos/hosts/default.nix(landed by PR nixos: power-guard — confirm critical battery readings before UPower hybrid-sleeps the laptop #1689, merged 2026-10-28).power-guard.serviceis enabled and active (running) since 2026-11-13 19:29 CST on amd-6 (PID 1254). The remaining half — the brief AC-unplug test (expect the inhibit block to engage while discharging above the critical line, no sleep, release on replug) — has no evidence on this issue and is a physical step at the machine.~/tools/power-guard.pyon amd-6 is a 9-line pointer stub ("RETIRED 2026-11-02 (queue task 6597) — pointer only, not code"), pointing at the pinned repo source.Remainder (one item, Drew's): the 30-second AC-unplug test from step 3, or an explicit waiver of it. Everything else in the spec is landed and verified, so once Drew does or waives that test, #1687 can close. This matches why lane code-i escalated the issue on 2026-11-12; Drew's 2026-11-13 unblock-all returned the task to the queue, and this triage confirms no fleet-side work remains.
dezren39 commentedon Nov 14, 2026
Duplicate packet — task 17168 (lane code-d, 2026-11-14)
user/escalatedstands. No further fleet-side work exists for this packet.dezren39 commentedon Nov 17, 2026
Agent note — state: triaged · task 18129, lane code-c
dezren39 commentedon Nov 22, 2026
Owner-parks batch (#12234, 2026-11-22) — sharpened to a hands item (marker now in the body).
Everything fleet-side is done and verified: the power-guard service and pinned script are on main via PR #1689 (merged 2026-10-28), enabled and active on the laptop since 2026-11-13, UPower config untouched. The sole remainder is the controlled physical acceptance test no lane can perform remotely: unplug the laptop's AC adapter, confirm power-guard prevents the hybrid-sleep on a glitch reading, replug — or reply "waive" here and the test is recorded as waived. Either outcome closes the acceptance; nothing else waits on it.
developing-today-fleet commentedon Nov 26, 2026
Triage verdict — code-j, 2026-11-26 (queue task 24358)
Fresh check: #1687 OPEN. Labels carry
user/escalated(fleet escalation label, not a hold) — no hold labels (held/user/owned/do-not-auto-edit), so triage proceeds.nixos/services/power-guard/(power-guard.py, default.nix, test_power_guard.py, wired innixos/hosts/default.nix); live copy present at~/tools/power-guard.py. Matches the item-by-item verifications in tasks 11954 / 17168 / 18129 (PR nixos: power-guard — confirm critical battery readings before UPower hybrid-sleeps the laptop #1689 merged 2026-10-28, service active on the laptop since 2026-11-13).waivereply. Only a person's hands can do it; no lane can perform it remotely.Verdict: no new packet routed — nothing fleet-side remains to implement. Issue stays open on the hands item. No code changed in this pass.
developing-today-fleet commentedon Nov 29, 2026
Lane 0640-T claim (2026-11-29). Taking the repo-side slice of #1687: criterion 1 — add a
power-guardsystemd service to the laptop's NixOS config in this flake, besidenixos/services/pm-stack/, with the guard script pinned into the repo from the tested~/tools/power-guard.pyon amd-6 (fetched verbatim, not hand-copied at deploy time). Criteria 3–4 (live AC-unplug verification, retiring the hand copy) remain for after the switch and are not part of this PR.developing-today-fleet commentedon Nov 29, 2026
Lane 0640-T premise correction + done check (2026-11-29). My claim above assumed criterion 1 was unlanded; firsthand checks show #1687 is nearly complete already:
nixos/services/power-guard/(default.nix + power-guard.py, 16,931 bytes + test_power_guard.py) is on main, in theamdhost's profiles (nixos/hosts/default.nix:30) and enabled (nixos/hosts/default.nix:93); landed by PR nixos: power-guard — confirm critical battery readings before UPower hybrid-sleeps the laptop #1689 (merged 2026-10-28), hardened since (fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025, power-guard: root daemon runs the env-derived POWER_GUARD_SLEEP_CMD through shell=True — parse to argv and drop the shell #9602). System service, Restart=always, wantedBy multi-user.target.~/tools/power-guard.pyon amd-6 is a 491-byte pointer stub dated 2026-11-02 ("RETIRED … change the pinned source instead").systemctl is-active power-guard= active (since the 2026-11-26 boot),is-enabled= enabled, ExecStart runs the store copy of the pinned script;systemd-inhibit --listshows no power-guard block right now, which is correct on AC (the block engages only while discharging at/below the low line).hands:v1item (Drewry's hands, or waivable by his reply on this issue). No code work remains.Releasing the claim; the issue stays open solely on that hands item.
developing-today-fleet commentedon Nov 29, 2026
Felix lane 0640-K premise update (2026-11-29): the landing spec's repo slice (step 1) is already DONE on main — no lane build remains here.
Evidence (read firsthand from developing-today/code main this pass):
nixos/services/power-guard/exists withdefault.nix,power-guard.py(the tested script, pinned into the repo) andtest_power_guard.py; follow-up fixes have landed since (power-guard: root daemon runs the env-derived POWER_GUARD_SLEEP_CMD through shell=True — parse to argv and drop the shell #9602 'run the sleep command as argv', fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025 dead-inhibitor detection — git log on the directory).nixos/hosts/default.nixcarriesservices.power-guard.enable = truefor the amd host (lines 30 / 93).What remains is live-machine only, and gated on Drewry's next laptop rebuild: step 3 (verify the service is active post-switch; brief AC-unplug test expecting the inhibit block to engage/release) and step 4 (retire the hand copy at ~/tools/power-guard.py on amd-6). The issue stays open for those two steps; the fleet binary/queue state does not block them, the rebuild does.
dezren39 commentedon Nov 29, 2026
Census 2026-11-29 (lane CEN-C02) — rechecked firsthand.
State: OPEN, nearly complete — today's premise corrections (felix lanes 0640-T and 0640-K, 2026-11-29) supersede the older "landing spec" framing in this thread:
nixos/services/power-guard/(default.nix + power-guard.py + test_power_guard.py) is on main, enabled for the amd host; landed by PR nixos: power-guard — confirm critical battery readings before UPower hybrid-sleeps the laptop #1689 (2026-10-28) and hardened since (fix(power-guard): detect dead systemd-inhibit child, re-engage loudly, reap on release #8025, power-guard: root daemon runs the env-derived POWER_GUARD_SLEEP_CMD through shell=True — parse to argv and drop the shell #9602).~/tools/power-guard.pyon amd-6 is a 491-byte pointer stub dated 2026-11-02.power-guardis active + enabled since the 2026-11-26 boot, running the store copy of the pinned script; no inhibit block is held right now, which is correct on AC.Remaining: only the physical half of criterion 3 — the brief AC-unplug test (expect the inhibit block to engage at/below the low line and release on recovery). That is this issue's
hands:v1item: Drew's hands at the laptop, or waivable by his reply on this issue. No code work remains, and no lane should rebuild the landing spec — it already landed. Labels/priority: kind/infrastructure + priority/high confirmed correct by this census.developing-today-fleet commentedon Nov 29, 2026
Census 2026-11-29 (Felix): full re-read (body, labels, all comments, edges) in the CODE-6 recovery pass.
STRENGTHS: verified down to the last step — criteria 1 and 4 verified done; criterion 3 was live-verified by lane 0640-T today.
FIXES I APPLIED: none needed.
REMAINS: FOR DREWRY / hands — the sole remainder is the physical AC-unplug test, or your waiver of it. Everything else is proven.
developing-today-fleet commentedon Nov 29, 2026
Issue census — 2026-11-29
Wave-2 census pass (group code-01409-03205): rechecked live state, body, labels and recent comments firsthand via
fleet ghimmediately before editing.A 2026-11-29 census note from another lane (CEN-*/Felix) already exists on this issue — skimmed, not duplicated; this note records only the residual verdict and any residual fixes.
Strengths: detailed body (4530 chars) with context a picker-up can start from; acceptance criteria present in the body; single taxonomy priority band (priority/high) — verified against live labels; kind label present (kind/infrastructure).
Gaps found: none material.
Actions taken this pass: none — verified complete, no changes.
Priority: priority/high — checked against content, unchanged (no reprioritization). No closing keywords used; issue left open.
developing-today-fleet commentedon Nov 30, 2026
Decision — 2026-11-29, taken under Drew's standing decision posture (2026-11-23) and his 2026-11-29 order to handle the census's untouched items. This issue was on the census's needs-Drew list for a deployment go-ahead.
GO: the built and tested power-guard deployment proceeds as fleet work. The go-ahead this issue waited on is given here; deployment, verification, and the record are fleet work from this point.
One acceptance act remains Drew's alone and is recorded as the remainder: the physical AC-unplug test — unplugging the machine's AC power to prove the guard behaves — or an explicit waiver of that test on this issue. Everything else on this issue is unblocked.
developing-today-fleet commentedon Nov 30, 2026
Disposition — lane 0322-AJ (delta PRESS AUTHOR refill, 2026-11-30). Re-verified live (body + all 26 comments, gh CLI). Repo slice is DONE on main (PR #1689 + hardening #8025/#9602; criteria 1 + 4 verified by Felix 0640-T/K and census C02 on 2026-11-29; criterion 3 live-verified in part). The deployment GO was recorded 2026-11-30T01:37Z under Drew's standing decision posture. Sole remainder is a genuine hands stop (the only class that parks an item): the physical AC-unplug test on laptop amd, or Drew's explicit waiver of it on this issue. No lane code remains. Wake: Drew posts the unplug-test result or a waiver here → close #1687.