Repository navigation
Conversation
shouldWarnLowBattery cleared notifiedLowBattery whenever the pack was not actively discharging. Service.qml rechecks on every onOnBatteryChanged, so UCSI/PD AC flaps at critical charge reset the latch and re-fired a critical "Time to recharge!" toast about every 3s until the machine died. Keep the latch set through transient onBattery false and clear it only after the level recovers above the threshold. Extend battery-test coverage for the flap loop from #9670. Fixes #9670 Signed-off-by: fresh3nough <anonwurcod@proton.me>
The new early return keeps the latch when UPower reports no device, but nothing pinned it: reverting that branch to the old unconditional false still passed all eleven assertions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewed by Claude Opus 5 in Claude Code, with an independent second opinion from Codex (gpt-5.6-sol) at xhigh reasoning. Tests ran on a disposable Omarchy 4.0.0 VM with Verdict: this is the right fix, and it closes #9670. The steer I went in with was that a latch resetting on an AC flap is a state-machine bug, and the usual wrong fix debounces the notification instead — which hides the storm on the reporter's machine while leaving the latch resetting, so the warning is also missed when it genuinely matters. This is not that. The latch still clears on a real recovery. Traced every path that can write The regression tests do pin the new behaviour — checked by mutation on the worker rather than by reading them. Reverting line 27 to the old Pushed one commit to this branch: One pre-existing race, reported not fixed — Codex raised this and I confirmed it against the source. Two things the issue mentions that this deliberately does not cover, so nobody expects them from a merge: the What ran: Where Codex agreed with conclusions I had already reached, its independence is not currently guaranteed — it runs read-only but can read this machine, and its report referenced a review procedure I had not given it. What it contributed on its own terms: the Waiting on the maintainer. Merging this should close #9670. |
|
I checked this again at the same head ( Reproduced on a disposable Omarchy worker, with the shell linked to this branch: Second opinion: Codex at medium effort reviewed the diff at this head and found nothing wrong. Its independence isn't guaranteed. It also pointed out something I had not raised: this PR interacts with two other open pull requests that change the same function. Neither of them fixes #9670.
This is now labelled |
Both sides appended tests to battery-test.sh; keep the AC-flap latch cases and the power profile cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This branch had stopped merging cleanly into Checked on a disposable Omarchy worker with the shell linked to this branch: This was reviewed by Claude Opus 5.5 alone. The second opinion (Codex Medium) did not run on this revision because today's review budget was spent, so the PR stays Several open PRs change the same latch in |
|
* Keep low-battery warnings latched through power-source flaps The battery service checks on every UPower onBattery change. Clearing the warning latch whenever the battery is not currently discharging lets each brief AC or device-state change re-arm the same low-battery warning. Keep the latch through these transitions and missing readings, and clear it only after the displayed charge rises above the warning threshold so a later low-battery episode can warn again. Retains the latch semantics proposed by fresh3nough in the unmerged #9883, with regression coverage for AC flaps, missing readings and recovery. Fixes #9670 Co-Authored-By: fresh3nough <anonwurcod@proton.me> Co-Authored-By: GPT-6 (Codex, effort not exposed) <noreply@openai.com> * Drop a redundant low-battery recovery assertion The recovery check already requires a cleared latch, and the existing initial-warning test verifies the next low reading with that latch. Repeating the initial-warning assertion after recovery adds no coverage. Keep the threshold boundary and the regressions that fail on base. Co-Authored-By: Opus 5.5 High <noreply@anthropic.com> Co-Authored-By: GPT-6 (Codex, effort not exposed) <noreply@openai.com> --------- Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-authored-by: fresh3nough <anonwurcod@proton.me> Co-authored-by: GPT-6 (Codex, effort not exposed) <noreply@openai.com> Co-authored-by: Opus 5.5 High <noreply@anthropic.com>
Summary
Fixes #9670.
The battery service latched
notifiedLowBatteryto "currently low and discharging".Service.qmlre-runscheckBattery()on everyonOnBatteryChanged. When AC online status flaps (UCSI/PD trouble at critical charge), each "on AC" check cleared the latch and the next "on battery" check immediately re-fired a critical Time to recharge! toast — ~one every 3s for 14 minutes in the report (~260 never-expiring critical popups).Change
In
shell/plugins/services/battery/BatteryModel.js, keep the latch set through transientonBattery == falsewhile still at/under the threshold, and clear it only after the level recovers above the threshold:notifyis stilllow && !alreadyNotified— one warning per low episode.Test plan
test/shell.d/battery-test.shwith AC-flap latch cases and a 20-step flap loopbash test/shell.d/battery-test.sh— all pass, including single warning across repeated flaps