Codex Desktop pet overlay can leave the main composer without focus on macOS

Resolved 💬 3 comments Opened Jun 5, 2026 by liuyenhui Closed Jun 6, 2026

On macOS, after opening the desktop pet overlay, Codex sometimes stops accepting input in the main composer.

The app is still frontmost. Clicking the composer does not always restore typing. Closing the pet immediately fixes it.

I originally noticed this with a custom pet at:

~/.codex/pets/doudou

The pet assets look valid: the spritesheet is 1536x1872, matching the expected 8 x 9 atlas with 192x208 cells. This does not look like an asset-format issue.

Environment

App: Codex Desktop
OS: macOS
Bundle: /Applications/Codex.app
Observed Chromium/Electron framework path: 149.0.7827.54
Custom pet: ~/.codex/pets/doudou

Steps

  1. Open Codex Desktop.
  2. Open the pet overlay.
  3. Switch away from Codex.
  4. Switch back to Codex.
  5. Click the composer and type.

Expected

The composer should accept input.

The pet overlay should still be visible and clickable.

Actual

Codex is frontmost, but the composer does not receive input.

Closing the pet overlay restores typing immediately.

Evidence

I captured the state with a local focus logger. During the broken state:

frontmost=Codex pid=59414
no focused window
no focused element
codex_window_count=2
codex_window name=Codex focused=false
codex_window name=Codex focused=false

CoreGraphics showed two Codex windows:

cg_window id=4314 pid=59414 owner=Codex layer=3 x=0 y=39 w=356 h=320
cg_window id=4182 pid=59414 owner=Codex layer=0 x=221 y=39 w=1579 h=1130

The layer=3 window appears to be the pet/avatar overlay. The layer=0 window is the main Codex window.

Unified log showed keyboard events still going to Codex:

destinations for Keyboard event: (<keyboardFocus; Codex.59414; token: viewbridge-key-window>)
delivery manager destinations for kCGSEventKeyDown event: <keyboardFocus; pid: 59414; token: viewbridge-key-window>

So the OS is sending keyboard events to Codex, but no focused element exists inside the app.

Local workaround tested

I patched the packaged app locally to stop the avatar overlay from taking keyboard focus.

The relevant packaged code is in:

/Applications/Codex.app/Contents/Resources/app.asar
.vite/build/main-*.js

The problematic path appears to be the avatar overlay keyboard interaction handler. In the packaged JS it does roughly this:

n.setFocusable(true);
n.show();
app.focus({ steal: true });
n.focus();
n.webContents.focus();

I tested a local patch that keeps pointer interaction working but prevents the overlay from becoming keyboard-focusable:

this.applyPointerInteractivityPolicy();
n.setFocusable(false);
return;

With that narrower patch, the pet remains visible and activity bubble clicks still work, while the main composer no longer gets stuck as easily.

Possible fix

The avatar overlay should probably not call setFocusable(true), app.focus({ steal: true }), window.focus(), or webContents.focus() unless an actual text input inside the overlay needs keyboard input.

Pointer interaction for pet messages/replies can remain enabled. Keyboard focus should stay with, or return to, the main Codex window/composer.

View original on GitHub ↗

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