Skip to content

Heat: land #80, with a setting to keep Low Power Mode on until the Mac cools - #151

Open
krishhgg wants to merge 7 commits into
integration/lid-close-sleepfrom
integration/heat-hold-setting
Open

krishhgg wants to merge 7 commits into
integration/lid-close-sleepfrom
integration/heat-hold-setting

Conversation

@krishhgg

@krishhgg krishhgg commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Low Power Mode that Insomnia turns on for heat now stays on until the Mac is back to nominal, so it no longer switches off at fair and on again as the Mac heats back up. A new switch, "Keep Low Power Mode on until the Mac fully cools", on by default, lets you turn that hold off.

This lands #80 by @aldikosh23 at fecfc61. The commit is merged here unchanged, so GitHub marks #80 merged when this one merges and its author keeps the credit. #80 conflicts with #147 (Settings on one page) and with the lid changes below it, so it can't merge as it is.

To @aldikosh23: please don't push to your branch now. A new commit on it isn't in this pull request, so #80 would stay open instead of showing as merged.

The base is integration/lid-close-sleep (#150's branch), which this stacks on. When that merges, this pull request's base changes to main and nothing else changes.

Conflicts resolved

Maintainer commits

  • 3866e27: merges Lid close: land #138, #135 and #71 #150's new head 7843047, which adds its fix for a lid closed while the display list can't be read. Git merged it with no conflicts. The heat hold and the lid each still turn Low Power Mode on for their own reason, and the end restores it whichever turned it on.
  • baee1d2: the heat hold becomes a setting, thermalHoldUntilNominal, default on. On, Low Power Mode turned on for heat stays on until the thermal state is back to nominal. Off, it goes off below serious as before Heat: keep Low Power Mode on until nominal, and show it in the menu #80. The switch sits under "Protect against overheating" and is greyed out when that is off. The key is a floor input, so a change during a session applies at once.

Tests

The full suite at 3866e27, this head: 1475 tests, 0 failures, on macOS 26.2 on the maintainer's MacBook. FloorRulesTests and ConfigTests cover the setting both ways and an old config without the key. Hosted CI runs on macOS 26 and 27.

Review

Clean at 3866e27: a review of the merge found the two sides combined correctly in SessionManager, the docs consistent, and no #80 test that the new lid reading breaks. Before that, clean at round 2 (a7726f6, the same tree as baee1d2).

Evidence

The switch in Settings, on and off, on the maintainer's MacBook at a7726f6. The merge above changes only the lid code under it, not the switch. The heat hold itself needs the Mac to reach serious heat, which nobody should cause on purpose: the menu lines it adds ("Thermal: serious", "Low Power Mode set by Insomnia") are pictured only if that happens during a normal session.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no blocking issues were found.

Summary

This PR keeps heat-triggered Low Power Mode on until the Mac returns to nominal, with a default-on setting to restore the earlier behavior.

  • Low Power Mode stays on through fair heat until the Mac reaches nominal.
  • Changes to floor settings take effect during the session.
  • The status menu shows heat and when Insomnia sets Low Power Mode.

No actionable issues were found. Tests and native UI checks were not run in this Linux environment.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Serious heat] --> B[Enable Low Power Mode]
  B --> C{Heat drops to fair}
  C -->|Hold enabled| D[Keep mode on until nominal]
  C -->|Hold disabled| E[Release thermal cause]
  D --> E
  E --> F{Battery or lid still needs it?}
  F -->|Yes| G[Keep mode on]
  F -->|No| H[Turn owned mode off]
Loading

Reviews (2) · Last reviewed commit: "Merge integration/lid-close-sleep at 784..." · Reviewed by Greptile

aldikosh23 and others added 6 commits October 12, 2026 18:00
Low Power Mode turned on for a serious thermal state went off at fair, the
first step down. That brought back the load that made the Mac serious, so
the mode went on and off again as the Mac heated up, with a notification
each time. The thermal cause now holds from serious until nominal;
FloorRuleDriver keeps that history for the session, in memory.

The notification after the cooldown said "Back above the floor.", which is
about the battery. It now says "Thermal state is back to nominal.", or
"Thermal rules are off." when Settings turned them off, and the one at the
start says the mode stays on until then.

A battery floor or the thermal rules changed in Settings during a session
applied only at the next battery or thermal event. They now run the floors
at once, as the lid option already did.
The machine line adds "Thermal: serious" (or fair, critical), read again
when the menu opens rather than through the monitor, whose copy moves only
with the notification and is not kept current outside a session. The
actions line says "Low Power Mode set by Insomnia" while the journal has
lowPowerSetByUs, so the reason the Mac is slower is in the menu.
The Settings view asked for a floor run with an onChange per setting, a
path no test could reach. SessionManager.config now calls
floorInputsChanged when a battery floor, the thermal rules or the lid
option changes (Config.floorInputs), and AppServices points it at
reevaluateFloors(). The view's onChange calls, the lid option's included,
are gone, so there is one path for every floor input.

Tests: a floor input change asks for one run and any other change none,
and during a session each change applies through that hook with no
battery, thermal or lid event, in the power calls, the journal and the
session end.
A Mac that stays at fair after serious, under a long build say, keeps
Low Power Mode and the held display sample until the session ends. Say so
next to the hold, with why a release on a timer is not used: it would
bring the cycling back at a slower pace. The menu shows the mode and the
state meanwhile, and turning the thermal rules off releases it.
# Conflicts:
#	Sources/Insomnia/Core/AppServices.swift
#	Sources/Insomnia/UI/SettingsView.swift
#	docs/releasing.md
#	docs/spec.md
…ault

The heat hold from #80 becomes a setting (thermalHoldUntilNominal). On, Low Power Mode turned on for heat stays on until the thermal state is back to nominal. Off, it ends at fair as before #80. The key is a floor input, so a change applies during a session at once.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T10:37:52.897621Z baee1d2 PR opened
🔒 Security Review ✅ Completed 2026-10-27T10:39:23.172081Z baee1d2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@krishhgg

Copy link
Copy Markdown
Owner Author

MacBook run on macOS 26.2 at a7726f6: the heat hold switch

The switch works as the description says. "Keep Low Power Mode on until the Mac fully cools" sits under Protect against overheating, is on by default, and each change is saved to config.json as thermalHoldUntilNominal. The head is now baee1d2, which has the same tree as a7726f6: only commit messages changed (git rev-parse a7726f6^{tree} baee1d2^{tree} prints 28dcc2291a78 twice).

Setup. The maintainer's MacBook Pro (M5), macOS 26.2 (25C56), on AC power at 100%, with a dark menu bar. a7726f6 installed from a clean checkout with scripts/install.sh (the lid simulation build), starting from default settings. install.sh exited 0 and /etc/sudoers.d/insomnia held exactly the four expected pmset lines. The run was unattended, so install.sh's own password prompt was not exercised.

Step Result
Defaults The config.json written at the first launch has thermalHoldUntilNominal: true
The row Under Protect against overheating, the switch is on, with the On and Off text below
Switch off config.json changes to thermalHoldUntilNominal: false and nothing else. The text stays the same
Switch on again config.json matches the file before the switch was turned off
Before this branch On #150's build the Battery section ends with Protect against overheating and has no hold switch
Thermal state pmset -g therm records no thermal or performance warning, and the app logs "startup thermal state nominal"

Before, on #150's build: the Battery section ends with Protect against overheating

After: Keep Low Power Mode on until the Mac fully cools, on by default, with its On and Off text

The same switch turned off

Logs: app, run, config with the switch off.

Not covered: the hold itself. The Mac stayed at a nominal thermal state, and nobody should heat a Mac on purpose to try it, so the hold is left to FloorRulesTests and ConfigTests. Each step ran once.

Brings in #150's fix for a lid closed while the display list can't be
read (fe42561, 2ae53f6, d334147, 7843047). Git merged the files
cleanly.
@krishhgg

Copy link
Copy Markdown
Owner Author

The full suite at 3866e27, this head, passes on macOS 26.2 on the maintainer's MacBook: 1475 tests, 0 failures, in 28 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants