Repository navigation
Drop the Mac battery when the host battery bridge disconnects - #339
Merged
Merged
Conversation
When the host bridge went away, the guest agent kept the last snapshot as `status=unknown` beside the last AC state. UPower's display device turns an unknown battery without AC into Discharging (up-daemon.c), so a disconnect taken while the Mac ran on battery left the guest claiming the old level on battery, and Omarchy's battery service, which warns on Discharging at 10% or below, kept a low-battery episode alive while the Mac charged. The restarted agent blocks in its refresh write until the host side reconnects, so after the launcher's fifth bridge restart the stale claim stayed for the rest of the session. The Mac's battery is unknown once the bridge is gone, so the agent now writes `present=0 ac=1` and the guest shows no battery until the next snapshot. The previous agent is recorded as a preimage so existing VMs take the update.
rofrol
added a commit
to omaguix/try-omaguix
that referenced
this pull request
Oct 11, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LUKpoifstLeMgAV3RKAaJd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Fixes #338. When the host battery bridge goes away, the guest agent kept the
last snapshot as
status=unknownbeside the last AC state. UPower turns anunknown battery without AC into Discharging, so a disconnect taken while the
Mac ran on battery left the guest claiming the old level on battery; at 10%
or below, Omarchy's Time to recharge! came back while the Mac charged.
The restarted agent blocks in its refresh write until the host side
reconnects, so after the launcher's fifth bridge restart the stale claim
stayed for the rest of the session.
The agent now writes
present=0 ac=1on disconnect (a line the modulealready accepts), so the guest shows no battery until the next snapshot.
docs/host-battery.mdsays so, and the previous agent's hash is added toguest/migrations/preimages.jsonso existing VMs take the update instead oftreating the file as customized.
Testing
make test: passed (425 Swift tests; Python suites OK; one skipped:"staged-QEMU lock inheritance (binary absent)").
test_native_battery_bridgeandtest_tob_parseupdated to expectpresent=0 ac=1;test_boot_fix_catalogandtest_boot_componentspass.downstream fork.
ðĪ Generated with Claude Code