Repository navigation
Description
Summary
Codex.app became unresponsive on macOS shortly after I ran:
brew upgrade --cask codexwhile the Codex desktop app was already running with active local work.
macOS generated a hang stackshot for /Applications/Codex.app/Contents/MacOS/Codex. The app did not crash with a signal; it stayed alive but unresponsive for ~239 seconds before sampling.
Important nuance: the Homebrew cask named codex appears to install/update the standalone CLI binary, not the /Applications/Codex.app bundle itself. On this machine, the Homebrew CLI symlink was updated on May 20, 2026, while the app bundle timestamp remained May 16, 2026. So this report is framed as a possible Desktop app / standalone CLI / app-server or IPC interaction after a Homebrew cask CLI upgrade while Desktop is live, not as proof that Homebrew replaced the app bundle while it was running.
Environment
- Platform: macOS 26.5, Build 25F71
- Host architecture: arm64e
- Codex process architecture: arm64
- Hardware: Mac16,8
- Memory: 48 GB
- Codex app path:
/Applications/Codex.app/Contents/MacOS/Codex - Codex app identifier:
com.openai.codex - Codex app version from stackshot / Info.plist:
26.513.31313 (2867) - Homebrew cask:
codex 0.132.0 - Homebrew CLI path:
/opt/homebrew/bin/codex - Homebrew CLI target:
/opt/homebrew/Caskroom/codex/0.132.0/codex-aarch64-apple-darwin
Local timestamps after the event:
May 16 13:30:56 2026 /Applications/Codex.app
May 16 13:30:54 2026 /Applications/Codex.app/Contents/Resources/codex
May 20 15:10:24 2026 /opt/homebrew/bin/codex
brew info --cask codex reports:
codex (Codex): 0.132.0
OpenAI's coding agent that runs in your terminal
Artifacts:
codex-aarch64-apple-darwin -> codex (Binary)
Steps to reproduce
Observed once so far:
-
Start Codex.app on macOS.
-
Have Codex running local work / local project threads.
-
In a terminal, run:
brew upgrade --cask codex
-
Leave Codex.app open during/after the upgrade.
-
Codex.app becomes unresponsive.
-
macOS records a hang report / stackshot.
Actual behavior
Codex.app became unresponsive. macOS stackshot details:
Command: Codex
Path: /Applications/Codex.app/Contents/MacOS/Codex
Identifier: com.openai.codex
Version: 26.513.31313 (2867)
Architecture: arm64
Event: hang
Duration: 240.24s
Duration Sampled: 1.30s (process was unresponsive for 239 seconds before sampling)
Target process details:
Process: Codex [24813]
Path: /Applications/Codex.app/Contents/MacOS/Codex
Identifier: com.openai.codex
Version: 26.513.31313 (2867)
Architecture: arm64
CPU Time: 0.009s
Note: Unresponsive for 239 seconds before sampling
Num threads: 52
Main thread:
Thread 0x1d82c
DispatchQueue "com.apple.main-thread"(1)
Thread name "CrBrowserMain"
13 samples (1-13)
last ran 238.045s ago
The heaviest main-thread stack is in Electron/AppKit/status-bar UI and blocks on a synchronous dispatch wait:
-[NSStatusBarButtonCell drawWithFrame:inView:]
-[NSSystemStatusBar drawBackgroundInRect:inView:highlight:]
-[NSSceneStatusItem _setSelectedContentFrame:options:]
-[NSStatusItemScene updateSettings:transition:]
-[FBSScene _updateClientSettings:]
-[FBSScene _sendUpdate:]
-[FBSWorkspaceScenesClient scene:didUpdateClientSettings:withDiff:transitionContext:]
-[BSServiceDispatchQueue performAsyncAndWait:]
_dispatch_async_and_wait_f
_dispatch_async_and_wait_f_slow
__DISPATCH_WAIT_FOR_QUEUE__
_dispatch_event_loop_wait_for_ownership
kevent_id
CPU usage was low during sampling, so this does not look like a CPU-bound loop. It looks like the UI main thread was blocked in AppKit / status item update after the Homebrew cask CLI upgrade happened while the desktop app was active.
Expected behavior
Running brew upgrade --cask codex while Codex.app is open should not leave the desktop app permanently unresponsive.
Possible acceptable behaviors:
- Codex.app detects the standalone CLI/cask changed and prompts the user to restart.
- Desktop ignores the changed standalone CLI until restart, but does not deadlock.
- Desktop/app-server/IPC handles version skew between the running app and standalone Homebrew CLI with a timeout/error path.
- The Homebrew cask or Codex updater warns that Codex.app is running if that combination is unsupported.
Related issues checked
- codex 0.125.0 (Homebrew cask) hangs on startup on macOS — no TUI, no output, no error #20025 is related but not the same. It reports the standalone Homebrew cask CLI hanging on startup while the Desktop app was running, likely around app-server/IPC/version mismatch. This report is about the Desktop app process itself becoming unresponsive after running
brew upgrade --cask codexwhile Desktop was already open. - App is almost unresponsive for 5 mins after starting up #16158 is a broader Desktop app startup unresponsiveness issue, but it is not tied to a Homebrew cask CLI upgrade or this AppKit/status-item stack.
- Codex App UI freezes: worker crashes, massive git/worktree errors, and concurrent orphaned app-server processes #11090 is a broader Desktop UI freeze involving worker crashes, git/worktree errors, and orphaned app-server processes, but it does not cover this Homebrew cask upgrade sequence.
- tccutil reset All com.openai.codex #19291 is a Desktop launch/UI hang where backend handshake succeeds, but it is not tied to Homebrew cask upgrade or the AppKit status-item stack.
- Codex Desktop 26.422.71525 triggers AppleSystemPolicy/spctl failures and was involved in a macOS 26.4.1 kernel panic #20283 covers AppleSystemPolicy/spctl/kernel-panic class failures. This stackshot does not show that class of failure.
I also searched for open issues containing NSStatusItemScene, NSStatusBarButtonCell, BSServiceDispatchQueue, and __DISPATCH_WAIT_FOR_QUEUE__ and did not find an existing matching issue.
Diagnostics available
I have a local macOS stackshot file, but it is a full system stackshot with many unrelated processes and local paths, so I did not attach it wholesale. I can provide a redacted target-process excerpt if useful.
Activity
jshaofa-ui commentedon May 20, 2026
Solution: codex #23695 — Codex.app Hangs After Homebrew Cask CLI Upgrade
Executive Summary
Issue: Codex.app becomes unresponsive on macOS after running
brew upgrade --cask codexwhile the desktop app is already running. macOS generates a hang stackshot, but the app doesn't crash — it just freezes indefinitely.Impact: Users who upgrade Codex via Homebrew while the app is running experience a complete freeze requiring force-quit. This is a reliability and user experience issue for the significant portion of macOS users who use Homebrew.
Severity: P1 (app freeze, requires force-quit)
Estimated Value: $1,500–$2,500
Competition: Zero (0 comments, 0 PRs)
Root Cause Analysis
Problem Statement
When
brew upgrade --cask codexruns while Codex.app is active, Homebrew:/Applications/Codex.appThis is a classic binary replacement during execution problem on macOS.
Root Cause: macOS App Bundle Replacement While Process is Running
Why This Causes a Hang (Not a Crash)
On macOS, when a running process's executable file is replaced:
spindump/hangtracerdetects the app is not responding and generates a stackshotSpecific Failure Points
App-Server Subprocess Disconnection: Codex.app likely spawns an
app-serversubprocess. When Homebrew replaces the bundle, the subprocess may:Code Signature Mismatch: After Homebrew replaces the bundle, the running process's code signature no longer matches the on-disk binary. macOS may restrict certain operations (like loading frameworks) for processes with mismatched signatures.
File Descriptor Invalidation: If the app holds open file descriptors to bundle resources, and those files are replaced, subsequent reads may return unexpected data or fail.
Proposed Fix
Fix 1: Detect Bundle Replacement and Prompt Restart
Fix 2: Graceful Degradation on App-Server Disconnection
Fix 3: Homebrew-Specific Upgrade Hook
Test Plan
Unit Tests
Integration Tests
brew upgrade --cask codexbehavior (replace bundle while running), verify graceful handlingRegression Tests
Impact Assessment
Codex/AppDelegate.swiftor similar — bundle change monitoringCodex/AppServerManager.swift— app-server reconnection logicRecommended Approach
Implement Fix 1 + Fix 2 together: Bundle change detection + graceful app-server disconnection handling. This covers both the detection and the mitigation. Fix 3 (Homebrew hook) is a nice-to-have but requires coordination with the Homebrew maintainers.
Files to Examine (for deeper analysis)
Codex/— Main app code (Swift/SwiftUI)app-server/— App-server subprocess codeCasks/codex.rbor similarfix(macos): close both macOS 26 main-thread deadlock doors and restor…
fix(macos): close both macOS 26 main-thread deadlock doors and restor…