codex icon indicating copy to clipboard operation
codex copied to clipboard

macOS ChatGPT app: Sleep prevention drops between automatic goal turns, allowing system sleep

Open gvellut opened this issue 1 week ago • 1 comments

What version of the Codex App are you using (From “About Codex” dialog)?

ChatGPT desktop 26.1117.31558 (build 29513)

What subscription do you have?

Pro

What platform is your computer?

macOS 26.7.3 (25G342), Apple Silicon / arm64, connected to AC power

What issue are you seeing?

macOS ChatGPT app: Sleep prevention drops between automatic goal turns, allowing system sleep

Environment

  • ChatGPT desktop app: 26.1117.31558, build 29513
  • Bundle identifier: com.openai.codex
  • macOS: 26.7.3, build 25G342
  • Architecture: arm64
  • Power: AC
  • Desktop setting Prevent sleep while running enabled
  • An unfinished goal was running through automatic continuation turns

This report concerns the standard desktop setting, not the experimental CLI sleep-prevention flag.

A similar sleep-prevention gap between automatic goal turns is reported for the CLI in https://github.com/openai/codex/issues/52399. This report concerns the desktop app, which uses a separate sleep-prevention implementation.

Problem

The desktop app briefly released its sleep-prevention assertion between two automatic turns of an active goal. macOS initiated idle sleep during that gap, before the next turn could restore protection.

The goal was still active and continuing automatically. Intermediate progress messages did not indicate that the overall work had finished.

Recorded timeline

All times below are November 24, 2026, CET (UTC+01:00). Session timestamps were converted from UTC.

Time Event
01:47:19.427 macOS recorded an explicit screen lock: kLWLockFromDirectLock (8).
01:47:49 Display turned off. macOS released its separate Powerd - Prevent sleep while display is on assertion. ChatGPT retained its assertion.
01:58:04.653 The session recorded task_complete for an intermediate turn.
01:58:04.656 ChatGPT released NoIdleSleepAssertion "Electron". macOS reported [System: No Assertions].
01:58:04.657 The kernel reported user inactive 11 min, time to idle sleep 0 min and sleep timer expired.
01:58:04.671 The next turn started automatically with turn_trigger: "goal".
01:58:04.683 powerd received kIOMessageSystemWillSleep.
01:58:09.708 macOS logged Entering Sleep state due to 'Idle Sleep'.
11:48:22 Full wake from Deep Idle following HID activity.

There were brief maintenance DarkWakes during the overnight sleep period.

Assertion replacement

A subsequent ChatGPT assertion remained held until 12:02:44, when its recorded age was 10:04:39. This places its creation at approximately 01:58:05.

That creation time is inferred from assertion ages, rather than an explicit creation event.

The evidence suggests that the replacement arrived after macOS had already initiated the sleep transition.

Repeated pattern

Earlier ChatGPT assertion releases at 00:13:13, 00:36:25, 01:28:53, and 01:42:18 also coincided with intermediate turn completion followed by automatic goal continuation.

At 01:42, macOS still held its display-related sleep-prevention assertion. By 01:58, that additional protection was gone.

Locking the screen did not immediately remove ChatGPT protection: its assertion remained held for approximately another 11 minutes.

Requested investigation

Please investigate whether the desktop assertion lifetime follows individual turns rather than the active goal, leaving a gap during automatic continuation.

What steps can reproduce the bug?

  1. Open the desktop app on macOS.
  2. Enable Settings → General → Prevent sleep while running.
  3. Start a long-running goal that requires multiple automatic continuation turns.
  4. Manually lock the screen and allow the display to turn off.
  5. Leave the Mac unattended beyond its configured idle-sleep timeout.
  6. Observe that, at an intermediate turn boundary, the Mac can enter system sleep while the goal remains unfinished and the next turn starts automatically.

The failure is intermittent. These are the conditions of the recorded incident; deterministic reproduction has not yet been established.

What is the expected behavior?

Sleep protection should remain continuous while an active goal is being pursued, including transitions between automatic turns, while allowing the screen to remain locked and the display to turn off.

Additional information

No response

gvellut avatar Nov 24 '26 11:11 gvellut

Your timeline shows the window is only a few milliseconds wide (release at .656, sleep timer fires at .657, next goal turn at .671), so anything that holds its own assertion across the turn boundary closes it. Until the desktop app keeps its assertion for the whole goal, you can hold one from Terminal before you lock the screen:

# keep the Mac from idle-sleeping for up to 8 hours, or until the ChatGPT app quits
caffeinate -i -t 28800 -w "$(pgrep -nx ChatGPT)"

-i only blocks idle system sleep, so the screen can still lock and the display can still turn off as in your setup. While it runs, pmset -g assertions lists a PreventUserIdleSystemSleep from caffeinate "on behalf of" the ChatGPT PID (checked on ChatGPT desktop 26.1117 / macOS 26). The next morning, pmset -g log | grep -E "Entering Sleep|Wake from" should show no Idle Sleep entry for the night.

Trade-offs: it doesn't know when the goal finishes, so the Mac stays awake until the timeout or until you press Ctrl-C (pick -t to match how long you expect the goal to run). It also doesn't cover closing the lid on battery.

Disclosure: I build Lidnight, a Mac menu bar app that watches Codex and Claude Code sessions and keeps the Mac awake only while they're active, with a grace period so short gaps between turns don't let it sleep: https://lidnight.app/en/

whereisdw avatar Nov 26 '26 02:11 whereisdw