MoonshotAI / MoonshotAI/kimi-cli
TTY input freeze in Ghostty terminal - keyboard listener raw mode not restoring
Open
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:
- Open Ghostty terminal on macOS
- Run: kimi --yolo "some command"
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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