MoonshotAI / MoonshotAI/kimi-cli
CLI stream hangs indefinitely during generation, session becomes unusable
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What version of Kimi Code CLI is running?
0.31.1
Which open platform/subscription were you using?
Moonshot Platform API
Which model were you using?
kimi-k2.7-code
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What issue are you seeing?
Kimi Code occasionally hangs indefinitely while streaming a response
The model starts normally, reads files, thinks, and begins generating code
However, near the end of the response, the stream suddenly stops and no additional output is ever produced
The CLI does not report any error or timeout. It simply waits forever, and the current session becomes unusable
This is not limited to a single session
After it happens, newly created sessions may also start freezing until some time has passed
Unfortunately I cannot show it 100% consistently, but it happens frequently, especially during longer coding tasks
Example prompt:
Write x by reading y, z and t.
The model successfully reads the files, starts implementing the code, then the stream freezes before the response completes
No error messages are displayed
What steps can reproduce the bug?
- Start a coding task
- Ask the model to read several source files
- Let the model begin implementing code
- During streaming (usually near the end of the response), the output suddenly stops
- Wait several minutes
The stream never resumes, no timeout occurs, and the session never recovers
This happens more frequently with longer responses, although I have also experienced it on shorter tasks
What is the expected behavior?
The response should either:
- finish streaming successfully, or
- terminate with an appropriate error if the connection or stream is interrupted
The CLI should never wait indefinitely without reporting an error
Additional information
- Installed using the official PowerShell installer (
irm) - Using the official Moonshot API with an API key
kimi doctorreports all checks PASS- Happens in multiple terminals (PowerShell, IntelliJ terminal, etc.)
- Internet connection remains stable
- During the hang,
kimi.exeremains running and responsive - In some cases,
netstatshows that the process no longer has any active TCP connections even though the CLI is still waiting indefinitely - Switching models after the hang does not help
- Multiple long generations have been lost because the stream freezes before completion
The behavior looks similar to the CLI waiting forever for a streaming event that never arrives instead of detecting a broken stream and reporting an error
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 by reproducing the hang with a longer generation on Windows, then trace the CLI's streaming path and its handling of a closed connection. Done means the response either completes or exits with an appropriate error instead of leaving the session waiting indefinitely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100