[macOS] Codex Desktop repeatedly steals foreground focus while tasks run in the background

Resolved 💬 2 comments Opened Jul 17, 2026 by takove Closed Jul 17, 2026

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

ChatGPT/Codex Desktop 26.715.21425 (CFBundleVersion 5488)

Bundle identifier: com.openai.codex

What subscription do you have?

ChatGPT account; exact plan does not appear relevant to the behavior.

What platform is your computer?

macOS 26.5.1 (25F80)
Darwin 25.5.0 arm64

What issue are you seeing?

While a Codex task is active, switching to Chrome or another application does not reliably keep that application focused. After a few seconds, ChatGPT/Codex makes itself the frontmost macOS application without user input.

This interrupts typing and clicking in the application the user intentionally selected. It makes it difficult to leave Codex working in the background.

The behavior was reproduced with a controlled focus trace that activated Chrome programmatically, so it was not caused by an accidental click, Cmd-Tab, the default double-Command Appshot shortcut, or another keyboard shortcut.

At the time of the trace:

  • Codex had one ordinary AXStandardWindow.
  • The window was not modal.
  • There was no permission dialog or approval request.
  • Chrome became frontmost normally.
  • About 3.5 seconds later, LaunchServices granted RoleUserInteractiveFocal to com.openai.codex, and WindowServer made ChatGPT/Codex frontmost.

An abbreviated macOS unified-log trace:

02:33:16.176 WindowServer  frontmostProcess: Google Chrome
02:33:19.662 runningboardd acquiring "frontmost" assertion for application.com.openai.codex
02:33:19.663 WindowServer  frontmostProcess: ChatGPT

A separate reproduction correlated the focus change with a background Ambient Suggestions generation completing:

07:26:37.792Z ephemeral_generation ... feature=ambient_suggestions ... status=success
07:26:37.815Z Received turn/completed for unknown conversation ... rendererWindowFocused=true

This does not prove Ambient Suggestions is the only trigger. Additional traces show the app can request foreground focus while a normal task is emitting progress updates, so the broader problem may be a generic desktop-shell path that calls show() / focus() for background or ephemeral events.

What steps can reproduce the bug?

  1. Start a task in ChatGPT/Codex Desktop on macOS and let it continue working.
  2. Switch to Chrome or another application.
  3. Continue working there or wait several seconds.
  4. Observe ChatGPT/Codex becoming the frontmost application without any user action directed at Codex.
  5. Switch away again.
  6. The behavior may repeat while the task or related background activity is running.

For a keyboard-independent reproduction, activate Chrome using:

open -a "Google Chrome"

Then observe the frontmost process through System Events or macOS unified logs.

What is the expected behavior?

Codex should preserve the user's currently focused application while tasks, background suggestions, notifications, browser surfaces, and internal/ephemeral turns update.

The main Codex window should become frontmost only after an explicit user action, such as:

  • clicking the Codex window or Dock icon;
  • selecting a Codex notification;
  • invoking a configured global shortcut; or
  • approving an action that explicitly requires foreground interaction.

Agent-initiated and background events should use non-activating presentation paths and must not call a focus-stealing application activation path.

Additional information

Possible areas to inspect:

  1. Generic handling for turn/started or turn/completed events whose conversation is not attached to the visible renderer.
  2. Ambient Suggestions and other ephemeral generations completing while the app is unfocused.
  3. Desktop notification and in-app Browser/PiP lifecycle paths that restore or focus the owner window.
  4. Calls equivalent to Electron BrowserWindow.show(), BrowserWindow.focus(), or macOS app.focus({ steal: true }) that do not distinguish explicit user actions from background events.

Related but distinct issues:

  • #18541 documents another Ambient Suggestions background-lifecycle problem.
  • #25321 and #30532 concern failure to acquire input focus when Codex should be focused.
  • #33662 concerns the in-app Browser stealing foreground focus on Windows.

This report is specifically about the main ChatGPT/Codex application repeatedly taking macOS foreground focus away from another application while background work is running.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗