Repository navigation
Only show a held charge inside a real charge limit - #17616
selfcrypto wants to merge 10 commits into
Conversation
[Medium impact] The PR appears safe to merge. SummaryThe power panel now shows a held charge only when real kernel limits support it.
The latest change preserves the Reviews (11) · Last reviewed commit: "Name the charge limit revision read so q..." · Reviewed by Greptile |
|
I read the diff, the existing review comments, #14474, and the power-panel code on current This was a source review by GPT-6 in Codex (reasoning effort not exposed); no second code review or worker tests ran. The separate reviewer availability check passed, but that did not classify or review this PR. It waits for classification to be resolved before verification can proceed. |
ba7145d to
0211279
Compare
|
I read head My assessment remains bug, but the configured classification model, |
|
Tested on real hardware: ThinkPad T490 (single BAT0), Omarchy 4.5.0 with this branch's
Before this change the bar kept the plain icon through the |
The power panel treated pending-charge and a near-zero charge rate as a
charge-limit hold even when the battery has no limit, so right after
plug-in it showed the plain icon and "Threshold" instead of charging.
Read the kernel's charge_control_{start,end}_threshold and only report a
hold when the end is below 99% and the level has reached the start (or
the end, when there is no start). Re-read the limits on power-source and
battery-state changes and on every panel refresh.
The combined UPower device averages all laptop batteries, so comparing its level with the first battery's limits misjudges a hold on laptops with two batteries. Read the limits of every laptop battery and report a hold only when each one is inside its own limit or already full.
7ebf2d6 to
9d8128b
Compare
|
@birkskyum since you merged #19046 in the same code: this builds on it rather than replacing it. #19046 covers the stale 0 W rate after plug-in; this adds the missing check that the battery has a charge limit at all, which also covers the It overlaps #10196, which reads the limit through Tested on a ThinkPad T490; timeline and recording are in the description. Update (Nov 22): the missing classification was a failure of the bot's second classifier that hit many PRs from Nov 18 and has since cleared. On the current head (5f249d3, |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
|
I read head My assessment remains bug, but |
|
Tested on the machine #10193 was reported on, in the exact state that issue describes. Machine: MacBookPro12,1 (Early 2015, pre-T2), Omarchy 4.5.0-3, stock State: charged to 100%, unplugged for a few minutes, plugged back in. The SMC did not resume charging (normal Apple hysteresis): Real power panel, same state, screenshotted one after another. For the PR runs I stopped the installed shell and ran
The plug-in case on this Mac. Below the SMC's resume point (plugged in at ~79%), charging does resume, and UPower reports
The false "THRESHOLD" lasts exactly as long as UPower's 0 W charging window. This PR's gate covers this case too: with So this PR on its own clears the false hold in the panel on this Mac, both when the SMC holds the charge and right after plug-in. #16685 is not needed for the panel, though it still fixes the CLI line and time to full. This also confirms the concern about #10196 on this hardware: its gate reads Measurements and screenshots were taken on my machine with Claude Code's help. Filed by Claude Opus 5.5 via Claude Code. |
On a MacBookPro12,1 the kernel exposes charge_control_end_threshold = 100 with no start file while UPower reports its 75/80 defaults (omacom#10193). Cover that shape: the SMC holding the charge below full, and the unmeasured rate right after plug-in, must not read as a threshold.
|
I read head My assessment remains bug, but the configured classifier, |
|
Reviewed head GPT-6 in Codex (reasoning effort not exposed) reviewed the code. Opus 5.5 High and muse-wonder via pi (thinking high) reviewed this head too and found no confirmed, contained defect to patch. They agreed with the source comparison; independence is not guaranteed. #7915 still leaves the non- The reviewers also identified a coverage boundary for the maintainer: the new gate recognises numeric @sarniva or @gabamnml, please test the full head git clone --single-branch --branch fix-power-holding-needs-real-limit https://github.com/selfcrypto/omarchy.git ~/omarchy-pr-17616
git -C ~/omarchy-pr-17616 checkout --detach 5f249d327752e01013ca6ca7c2240e5f102726d5
omarchy dev link ~/omarchy-pr-17616Reboot when prompted. Compare the same plug-in or firmware-held state on |
|
Merged current #20379 added a In The gate is still needed after #20379: the pending-charge and fully-charged-below-99 branches return a hold before
@sarniva @gabamnml the head to test is now Update: omarchybot pushed |
The battery service signals after a charge-limit command applies the new setting. When the panel is closed, re-read the kernel limits as well as the battery details so the bar can update even if UPower leaves the battery in the same state. Co-Authored-By: GPT-6.2 Sol High <noreply@openai.com> Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
|
I pushed On a disposable Omarchy worker, the CLI and five focused power and battery test files passed on the pushed commit. A probe of the panel's signal handler left the cached end threshold at 100% on the previous head and updated it to 80% with the patch. The earlier model probe also reproduced the false holds on the base and passed with the PR's limit check. The worker had no laptop battery. GitHub's exclusive job passed. The noncomp-1 job failed in the agent-account cancellation test when its mock login PID file was missing. That test and the agent-account code are unchanged by this PR. The test passed all 47 assertions on a worker using the exact merge GitHub tested. GitHub Actions failure Could the original reporter for #14474 or #10193, or a maintainer with the affected hardware, test |
|
Merged current The one conflict was in
The hardware-test request above still stands, now for |
|
I checked GPT-6.2 Sol High in Codex traced the limit check and refresh paths. Opus 5.5 High and muse-wonder via pi, thinking high, agreed on the fix for numeric limits and may have seen this session’s reasoning. Opus flagged that a firmware-only conservation mode can now lose a genuine “Holding” indication. Muse-wonder agreed on the behavior and treated it as a display choice. The enabled flag alone cannot establish that a battery has reached its cap, so using it as a fallback could restore false holds below the cap. The per-battery check covers more false holds than the approaches in #7915, #9763, and #10196. It also rejects persistent false holds after the debounce windows used in #16855 and #17380. #14141 covers the separate case of a long estimate while the battery really is charging inside its limit. The worker has no laptop battery. @sarniva or @gabamnml, please use the linked install and rollback steps with the full SHA |



What changes
The power panel reports a held charge ("Threshold"/"Holding" and the plain battery icon) whenever the battery is in
pending-charge, charging at ≤ 0.2 W, or estimates ≥ 8 h to full, without checking that the battery has a charge limit at all. That shows a fake hold right after plug-in (#14474), on hardware where no charge limit is applied (#10193), and on a failed battery at 0% (#7803).This reads each laptop battery's real limit from the kernel (
charge_control_{start,end}_threshold) and only reports a hold when the end is below 99% and the battery's own level has reached the start (or the end, when there is no start or it is 0). No charge-control files, or an end of 100 asapplesmcreports on the MacBook from #10193 → never held. With several batteries, each is checked against its own limit, and the hold shows only when every battery is inside its limit or full. One gate inchargeThresholdActive()covers all three heuristics.UPower's
ChargeStartThreshold/ChargeEndThresholdcan't be used for this: they report hwdb defaults (75/80) even withChargeThresholdEnabled = false, and Quickshell doesn't exposeChargeThresholdEnabled. sysfs attributes don't emit inotify events, so the limits are re-read on everyonBatteryChanged, battery state change and panel refresh.Builds on #19046, which holds off the stalled-rate check for 90 s after plug-in. That covers the 0 W reading, but not the
pending-chargestep or batteries without a limit; this keeps itsrateFreshargument and adds the limit check alongside it. Overlaps with #10196, which gates onomarchy-battery-status's threshold; that falls back to UPower's 75/80 defaults, so on a machine like this one it treats a limit as present when none is applied. Also overlaps #7915 (gates onlypending-charge).Verification
test/shell.d/power-test.sh: 42/42 pass. New cases: pending-charge and the unmeasured rate with no limit and below the limit start, no limit files, end-only limits and a start of 0, two batteries (both held, one still charging, one full, one without a limit), firmware stopping short of full, the charging icon right after plug-in. The active-charging case now passes a real limit so it still exercises the rate check. The new no-limit cases fail against the currentModel.js.quattro(327 pass; 5 unrelated failures on both on this machine).qmllintonPanel.qml: no new warnings beyond the existing unqualifiedCommonsones andobjectAt()returningQObject(same pattern as the agents plugin).Model.jsandPanel.qmlinstalled, kernel limit 75/80, battery at ~26% (upower --monitor-detail):pending-charge, 0 W;on-battery: noat 58.2charging, still 0 Won-battery: yesat 16.9pending-charge,on-battery: noWith 4.5.0's own panel (before #19046) the bar kept the plain icon until the 40 W reading, about 10 s; with #19046 alone it would still show it for the ~1 s of
pending-charge. The shell log shows no errors from the power panel.charge_control_end_threshold= 100, no start file, UPower still reporting 75/80), tested by @ancientastronauttheorist in this comment: with the firmware holding the charge at ~93% on AC and 0 W, the installed 4.5.0 panel shows "Threshold", "Charge limit 75-80%" and "Holding"; this branch shows "Fully charged" with no charge limit.power-test.shpasses there too.Screenshots
screenrecording-2026-11-18_20-09-48.mp4