Skip to content

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

Closed

Description

@takove

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:

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

Activity

  1. added
    bug
    app
    on Jul 17, 2026
  2. github-actions commented on Jul 17, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. takove commented on Jul 17, 2026

    @takove
    Author

    Closing this report after identifying the actual cause as local environment state rather than a Codex Desktop focus bug.

    Two stale launchctl submit jobs created during an earlier local Codex task had been inferred as keep-alive daemons. One repeatedly executed open /Applications/ChatGPT.app, while the other repeatedly attempted to terminate an obsolete PID. They had run more than 4,500 times each, explaining both the recurring foreground activation and the app reopening after quit.

    After removing both jobs, a controlled foreground test kept Chrome frontmost for every sample and the behavior stopped. The earlier Ambient Suggestions correlation was incidental. Sorry for the false report.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions