Enter key stops responding after task completion in tmux (TUI input stuck)

Open 💬 5 comments Opened Feb 24, 2026 by probepark

Bug Description

After a model turn completes (or after interrupting with Escape), the composer input field accepts text characters but Enter (submit) no longer responds. This happens consistently when running codex inside tmux.

Environment

  • codex-cli: 0.104.0 (Homebrew, aarch64-apple-darwin)
  • macOS 15.4 (arm64)
  • tmux 3.5a (inside byobu)
  • Terminal: iTerm2

Steps to Reproduce

  1. Launch codex inside a tmux session
  2. Send a prompt and let the model complete a turn
  3. Type a new prompt in the composer
  4. Press Enter → nothing happens
  5. Text remains in the prompt, turns:0 shown in statusbar

Expected

Enter should submit the text and trigger a new turn.

Actual

  • Characters are received and displayed in the composer
  • Enter key is completely ignored
  • tmux send-keys C-m also fails
  • Only workaround: Ctrl+C to kill the session and restart

Analysis

Looking at the source, codex enables the kitty keyboard enhancement protocol:

// tui.rs:73-79
PushKeyboardEnhancementFlags(
    KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
        | KeyboardEnhancementFlags::REPORT_EVENT_TYPES
        | KeyboardEnhancementFlags::REPORT_ALTERNATE_KEYS
)

tmux has limited support for the kitty keyboard protocol. After a model turn completes, the terminal state may not properly reset the keyboard enhancement flags, causing the Enter key event (KeyCode::Enter with KeyModifiers::NONE) to not match the expected pattern in chat_composer.rs:1396.

The EventBroker pause/resume cycle during external command execution (with_restored) may also leave the crossterm EventStream in a state where key events are silently dropped.

Suggested Fix

  1. Add a fallback in handle_key_event that accepts raw \r (0x0d) as Enter even when keyboard enhancement reports don't match
  2. Or re-push keyboard enhancement flags after each turn completes
  3. Or detect stale input state and auto-recover

Workaround

Kill codex with Ctrl+C and restart the session.

View original on GitHub ↗

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