Repository navigation
Wait for a battery event after a failed charge-limit write - #20879
Cynnamoroll wants to merge 2 commits into
Conversation
A rejected hardware write leaves the one-time top-up marker in place. Refresh the state when the process exits without rechecking the same charge reading. A new battery event can still restore the limit. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
[Medium impact] The PR appears safe to merge, with the previous test-timing issue fixed. SummaryStops failed charge-limit writes from immediately retrying against the same battery reading.
The previous test-timing finding is fixed. No new actionable issues were found. This review checked the code; tests were not run.
|
Wait for Quickshell to handle the failed write before watching for a retry, and wait for the successful write to clear the marker. Bound both waits so slow startup or D-Bus calls do not fail a working implementation. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
both of your commits are in #21013. the charge-limit retry waits for a battery event, and that test section stayed next to the warning and charger checks. the Quickshell fixture did not run on this machine. @dhh @omarchybot if 21013 lands, this can close as superseded. |
|
Codex High and Opus 5.5 High traced the retry in Quickshell and found no blocking code defect. Muse Wonder High questioned whether the running guard prevented the old retry. I checked the packaged Quickshell revision and confirmed it clears the running flag before emitting the exit signal, so the old callback could start another write with the top-up marker still present. The fix leaves the request pending for another battery event or an explicit refresh. Review independence is not guaranteed. The comparison found the same fix and regression fixture in the broader #21013 bundle. Worker reproduction and the suite are still pending after a worker preflight failure. The GitHub Tests workflow is waiting for maintainer approval. Tests workflow |
|
Codex High and Opus 5.5 High compared the source and agreed that #21226 includes the same charge-limit retry fix and byte-identical regression fixture alongside its charger and power-panel changes. The second reviewer can access the same session context. Both PRs are open, so this one stays open for the maintainer to decide where the fix should land. Worker verification is still pending, and the GitHub Tests workflow still requires approval. |
What changes
When a “100% once” charge finishes, the battery service asks UPower to restore the charge limit. If UPower rejects the write, the request stays pending. The process-exit callback used to recheck the same full battery reading and immediately start the command again, with no new battery event.
Now exit only refreshes the saved state. A later battery event or explicit refresh can still retry, and a successful write still clears the pending request. This follows up on #20379; it does not claim to fix a hardware issue.
Verification
omarchy-battery-limit, and a private D-Bus that supplies UPower readings and controls whether writes succeed. The base sent 83 threshold-write calls in 1.2 seconds. The patch sent one, kept the marker, made no call on a subsequent below-full reading, then made exactly one successful retry and removed the marker when the battery returned to 100%.bash test/shell.d/battery-test.shpassed, including the private-bus regression.power-test.sh,powerprofiles-set-test.sh(nine checks in Arch), andgit diff --checkalso passed. The profile suite fails identically on the Ubuntu host and unchanged base before the first assertion; the Arch run is the platform check.Screenshots
No visible change: the battery panel's controls and presentation are unchanged; the fix prevents repeat hardware calls after a write fails.