Skip to content

TTY input freeze in Ghostty terminal - keyboard listener raw mode not restoring #1807

@termax

Description

@termax

When running kimi --yolo in Ghostty terminal (same thing in mac native terminal with or without yolo), the input occasionally freezes - keystrokes are not echoed and terminal becomes unresponsive.
Steps to Reproduce:

  1. Open Ghostty terminal on macOS
  2. Run: kimi --yolo "some command"
  3. Occasionally terminal freezes after kimi exits
    Root Cause: The keyboard listener in kimi_cli/ui/shell/keyboard.py switches TTY to raw mode (termios) but doesn't always restore properly on exit/cr
    ash.
    Workaround: Run stty sane in frozen terminal (typed blindly) to restore cooked mode.
    Environment:
    • OS: macOS
    • Terminal: Ghostty
    • kimi-cli: 1.30.0
    Suggested Fix: Add more robust TTY state recovery in _listen_for_keyboard_unix() finally block, possibly with state verification or signal handlers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions