Repository navigation
Conversation
chargeThresholdActive() reads a stalled charge as changeRate at or below 0.2 W, or a time-to-full over eight hours. A battery that was just plugged in reports changeRate 0 and timeToFull 0 until UPower measures the charge, which can take up to a minute, and 0 clears both of those bars. So for that first minute the bar showed the static (non-charging) icon and the panel read "Charge limit", on a machine with no charge limit set, every time the charger went in. Empty readings are "not known yet", not "stalled": while the state still says Charging, treat changeRate 0 with timeToFull 0 as active charging and let UPower's next update decide. A real charge limit still reports either a PendingCharge/FullyCharged state or a measured low rate, all of which are unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Prevents fresh UPower readings from incorrectly showing a charge limit immediately after connecting power.
Changes:
- Treats zero rate/time readings as pending measurements while charging.
- Adds regression coverage for threshold detection and charging icons.
Tip
If you aren't ready for review, convert to a draft PR. Click "Convert to draft" or run gh pr ready --undo. Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
shell/plugins/panels/power/Model.js |
Handles unknown initial charging measurements correctly. |
test/shell.d/power-test.sh |
Tests fresh plug-in threshold and icon behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Reviewed at 233a20f by Claude Opus 5.5. The fix works as described, and nothing in the diff needed changing. What was run, on a disposable Omarchy VM: a probe that feeds What was not checked: the VM has no battery, so the claim that UPower publishes 0 W and time-to-full 0 while Charging was not observed on hardware. This run also did not check whether some firmware holds at a charge limit while still reporting Charging at exactly 0 W, rather than Second opinion: none. The configured reviewer (Codex Medium) answers, but omabot's daily review budget was spent, so no second model reviewed this pull request. It is labelled Related: #9668 reports the same function misreading a charging battery when time-to-full is bogus (27 h). This PR does not change that case. #12115 rewrites Waiting on a second review, then on the maintainer. |
|
This pull request has been overtaken by #19046, which a maintainer merged to What #19046 does. It fixes the same symptom in a different way. When external power arrives, the panel marks the charge rate as not yet trustworthy for 90 seconds ( What merging this on top would change. What #19046 still leaves open. If the shell starts while already plugged in, What was checked. Claude Opus 5.5 read both diffs and every caller of the three model functions on Thank you, @ztyankov. You found this bug and fixed it first; #19046 just landed a different way of handling it. This now waits on the maintainer, and the recommendation is to close it as superseded by #19046. |
chargeThresholdActive() reads a stalled charge as changeRate at or below 0.2 W, or a time-to-full over eight hours. A battery that was just plugged in reports changeRate 0 and timeToFull 0 until UPower measures the charge, which can take up to a minute, and 0 clears both of those bars. So for that first minute the bar showed the static (non-charging) icon and the panel read "Charge limit", on a machine with no charge limit set, every time the charger went in.
Empty readings are "not known yet", not "stalled": while the state still says Charging, treat changeRate 0 with timeToFull 0 as active charging and let UPower's next update decide. A real charge limit still reports either a PendingCharge/FullyCharged state or a measured low rate, all of which are unchanged.