Skip to content

feat(sleep-inhibitor): add Linux and Windows idle-sleep prevention#11766

Merged
yvolovich-cyber merged 23 commits intomainfrom
codex/sleep-inhibitor-linux-windows
Feb 24, 2026
Merged

feat(sleep-inhibitor): add Linux and Windows idle-sleep prevention#11766
yvolovich-cyber merged 23 commits intomainfrom
codex/sleep-inhibitor-linux-windows

Conversation

@yvolovich-cyber
Copy link
Contributor

@yvolovich-cyber yvolovich-cyber commented Feb 13, 2026

Background

Summary

  • extend codex-utils-sleep-inhibitor with Linux and Windows backends while preserving existing macOS behavior
  • Linux backend:
    • use systemd-inhibit (--what=idle --mode=block) when available
    • fall back to gnome-session-inhibit (--inhibit idle) when available
    • keep no-op behavior if neither backend exists on host
  • Windows backend:
    • use Win32 power request handles (PowerCreateRequest + PowerSetRequest / PowerClearRequest) with PowerRequestSystemRequired
  • make prevent_idle_sleep Experimental on macOS/Linux/Windows; keep under development on other targets

Testing

  • just fmt
  • cargo test -p codex-utils-sleep-inhibitor
  • cargo test -p codex-core features::tests::
  • cargo test -p codex-tui chatwidget::tests::
  • just fix -p codex-utils-sleep-inhibitor
  • just fix -p codex-core

Semantics and API references

Chromium vs this PR

Why we differ from Chromium

  • Linux implementation mechanism:
    • Chromium uses in-process D-Bus APIs plus UI-integrated screen-saver suspension.
    • This PR uses command-based inhibitor backends (systemd-inhibit, gnome-session-inhibit) instead of linking a Linux D-Bus client in this crate.
    • Reason: keep codex-utils-sleep-inhibitor dependency-light and avoid Linux CI/toolchain fragility from new native D-Bus linkage, while preserving the same runtime intent (hold an inhibitor while a turn runs).
  • Linux UI integration scope:
    • Chromium also uses display::Screen::SuspendScreenSaver() in its UI stack.
    • Codex codex-rs does not have that display abstraction in this crate, so this PR scopes Linux behavior to process-level sleep inhibition only.
  • Windows wake-lock type breadth:
    • Chromium supports both display/system wake-lock types and extra display-specific handling for some pre-Win11 scenarios.
    • Codex’s feature is scoped to turn execution continuity (not forcing display on), so this PR uses PowerRequestSystemRequired only.

@yvolovich-cyber
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42fe936b61

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yvolovich-cyber
Copy link
Contributor Author

@codex review thoroughly please

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends codex-utils-sleep-inhibitor from macOS-only to include Linux and Windows backends for preventing idle system sleep during active turns, and updates feature staging to mark prevent_idle_sleep as Experimental on those OSes.

Changes:

  • Add Linux inhibitor backend using systemd-inhibit with gnome-session-inhibit fallback.
  • Add Windows inhibitor backend using Win32 power request handles (PowerCreateRequest/PowerSetRequest/PowerClearRequest).
  • Wire platform selection in codex-utils-sleep-inhibitor and mark the feature Experimental on macOS/Linux/Windows.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
codex-rs/utils/sleep-inhibitor/src/windows_inhibitor.rs New Windows backend using Win32 power requests.
codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs New Linux backend that spawns systemd-inhibit or gnome-session-inhibit.
codex-rs/utils/sleep-inhibitor/src/lib.rs Select Linux/Windows backends by target OS; dummy backend for others.
codex-rs/utils/sleep-inhibitor/Cargo.toml Add target-specific deps (notably windows-sys).
codex-rs/core/src/features.rs Mark prevent_idle_sleep Experimental on macOS/Linux/Windows.
codex-rs/Cargo.lock Lockfile updates for new Windows dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 420fcae545

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yvolovich-cyber
Copy link
Contributor Author

@codex please review

@yvolovich-cyber yvolovich-cyber force-pushed the codex/sleep-inhibitor-linux-windows branch from 5c956a3 to 9e122be Compare February 13, 2026 21:38
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c956a3209

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Feb 14, 2026
@jif-oai
Copy link
Collaborator

jif-oai commented Feb 16, 2026

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e122beedf

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yvolovich-cyber
Copy link
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Swish!

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yvolovich-cyber yvolovich-cyber force-pushed the codex/sleep-inhibitor-linux-windows branch from 97a4bac to e182331 Compare February 18, 2026 11:08
@yvolovich-cyber
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e182331dc7

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yvolovich-cyber
Copy link
Contributor Author

@codex review please

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c2c3d93df

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yvolovich-cyber
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0af4813bc1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yvolovich-cyber yvolovich-cyber force-pushed the codex/sleep-inhibitor-linux-windows branch from cc822f4 to 9a54a06 Compare February 20, 2026 14:11
@yvolovich-cyber
Copy link
Contributor Author

@codex review

@yvolovich-cyber
Copy link
Contributor Author

@lopopolo-openai addressed. I added the Linux invariant unit test for BLOCKER_SLEEP_SECONDS == i32::MAX, bumped windows-sys to 0.61.2, and replied in the inline test suggestion thread with validation details.

Copy link
Collaborator

@iceweasel-oai iceweasel-oai left a comment

Choose a reason for hiding this comment

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

👍 for Windows

@yvolovich-cyber yvolovich-cyber force-pushed the codex/sleep-inhibitor-linux-windows branch from 2d5f3fa to 1e8b7d2 Compare February 24, 2026 19:16
@yvolovich-cyber yvolovich-cyber merged commit 67d9261 into main Feb 24, 2026
38 of 40 checks passed
@yvolovich-cyber yvolovich-cyber deleted the codex/sleep-inhibitor-linux-windows branch February 24, 2026 19:51
@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants