Skip to content

Add support for inhibiting suspend while inference is running#2515

Merged
superm1 merged 1 commit into
mainfrom
superm1/inhibit-suspend
Jul 2, 2026
Merged

Add support for inhibiting suspend while inference is running#2515
superm1 merged 1 commit into
mainfrom
superm1/inhibit-suspend

Conversation

@superm1

@superm1 superm1 commented Jul 1, 2026

Copy link
Copy Markdown
Member

The idea here is that if a user is using lemonade remotely or they are running a local task that is taking a long time and step out for coffee they probably don't want system automatic suspend to cause problems for them.

@github-actions github-actions Bot added enhancement New feature or request area::tray System tray app (LemonadeServer.exe, lemonade-tray) labels Jul 1, 2026
@superm1 superm1 force-pushed the superm1/inhibit-suspend branch from 00a49cd to 8638cf0 Compare July 1, 2026 20:18

@fl0rianr fl0rianr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR — the overall design looks good to me. Putting the inhibitor around execute_inference() / execute_streaming() seems like the right level, and the FD lifetime / RAII approach looks appropriate.

A couple of follow-up thoughts, mostly around robustness and maintainability:

  1. The current refcounting test mostly validates a mock implementation with duplicated logic rather than the production refcounting path. That may be fine for avoiding a real logind dependency in tests, but would you be open to factoring the refcounting into a small testable helper or injectable backend so the test exercises the same logic used by the Linux implementation?

  2. Since inhibit_suspend defaults to true, Linux builds with HAVE_SYSTEMD but without a usable logind/system bus — for example some containers, WSL-like setups, or minimal/headless environments — may warn on ordinary inference requests. It might be worth degrading to no-op after detecting logind is unavailable, or making expected “environment unavailable” failures debug-level rather than warning-level.

Minor docs nit: could we document that this currently only has an effect on Linux/systemd-logind and is a no-op on Windows/macOS?

Not blocking from my side, but I think those would make the feature safer to ship broadly.

@superm1 superm1 force-pushed the superm1/inhibit-suspend branch from 8638cf0 to 03748e5 Compare July 2, 2026 01:15

@fl0rianr fl0rianr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the updates. The refcounting change and the one-shot logind fallback address my main concerns from the earlier review.

Only tiny remaining nit from my side: it might still be worth documenting that this currently only has an effect on Linux/systemd-logind and is a no-op on Windows/macOS. Non-blocking.

The idea here is that if a user is using lemonade remotely or they
are running a local task that is taking a long time and step out
for coffee they probably don't want system automatic suspend to
cause problems for them.
@superm1 superm1 force-pushed the superm1/inhibit-suspend branch from 03748e5 to 05e9140 Compare July 2, 2026 14:16
@superm1

superm1 commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

FYI - confirmed functionality on a real system as well.

image

@fl0rianr fl0rianr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great - and thanks for the updates — the refcounting change and the one-shot logind fallback address my main concerns.

The remaining docs clarification is minor and non-blocking from my side. Approved.

@superm1 superm1 enabled auto-merge July 2, 2026 15:35
@superm1 superm1 added this pull request to the merge queue Jul 2, 2026
Merged via the queue into main with commit 29abdea Jul 2, 2026
144 of 146 checks passed
@superm1 superm1 deleted the superm1/inhibit-suspend branch July 2, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area::tray System tray app (LemonadeServer.exe, lemonade-tray) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants