MoonshotAI / MoonshotAI/kimi-cli

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

Open
#1,807 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with kimi_cli/ui/shell/keyboard.py and inspect _listen_for_keyboard_unix(), especially its finally block and TTY handling. Reproduce with kimi --yolo "some command" in Ghostty or macOS Terminal, then verify that the terminal returns to cooked mode after kimi exits or crashes and no longer requires stty sane.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.