MoonshotAI / MoonshotAI/kimi-cli

CLI stream hangs indefinitely during generation, session becomes unusable

Open
#2,582 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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?
  1. Start a coding task
  2. Ask the model to read several source files
  3. Let the model begin implementing code
  4. During streaming (usually near the end of the response), the output suddenly stops
  5. 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 doctor reports all checks PASS
  • Happens in multiple terminals (PowerShell, IntelliJ terminal, etc.)
  • Internet connection remains stable
  • During the hang, kimi.exe remains running and responsive
  • In some cases, netstat shows 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.