MoonshotAI / MoonshotAI/kimi-cli

Kimi CLI hangs after detached child-process tool call

Open
#2,468 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

What version of Kimi Code CLI is running?

Kimi CLI 1.47.0.

Which open platform/subscription were you using?

API-compatible local mock provider with a fake API key.

Which model were you using?

OpenAI-compatible local mock provider.

What platform is your computer?

Linux x86_64 Docker.

What issue are you seeing?

When Kimi CLI receives a shell tool call that starts a detached child process, the CLI does not return control within the bounded run. The standalone reproducer downloads public Kimi CLI 1.47.0, starts a local OpenAI-compatible mock provider, sends a child-spawning shell tool call, and verifies the behavior without requiring this repository or any private fuzzing harness.

Kimi CLI accepts the child-spawning shell tool call, records the detached child PID side effect, and then fails to finish normally before the bounded timeout. The reproducer prints REPRODUCED only when provider traffic is observed, the child-spawning command records its PID, and the CLI exits by timeout or signal.

What steps can reproduce the bug?

Prerequisites: Docker, Python 3, and the GitHub CLI (gh) for the clone command below. The linked reproducer is self-contained and uses only Python standard-library modules plus Docker. It downloads the affected public Linux release asset, starts a local mock provider, and runs the CLI in an isolated workspace. The Docker run is limited to 2 CPUs and 4 GiB RAM by default.

Complete self-contained reproducer: https://gist.github.com/N0zoM1z0/707db65552981ab1c84109517315bd2f

The Gist contains kimi-cli-child-process-cleanup.reproduce.py. Download and run:

gh gist clone 707db65552981ab1c84109517315bd2f kimi-cli-child-process-cleanup-reproducer
cd kimi-cli-child-process-cleanup-reproducer
python3 kimi-cli-child-process-cleanup.reproduce.py

To reuse an already-built local image:

python3 kimi-cli-child-process-cleanup.reproduce.py --skip-build

Key output from a local run against the affected version:

provider_requests_at_least: observed=... expected>=1
side_effect_file_exists detached-child.pid: bytes=... expected>=1
timeout_or_signal: returncode=... timed_out=True
REPRODUCED

What is the expected behavior?

Kimi CLI should track, terminate, and reap tool-started child processes, then return control without hanging.

Additional information

  • Target: MoonshotAI/kimi-cli
  • Affected version checked with the public reproducer: 1.47.0
  • Current public latest checked on 2026-06-22: GitHub release 1.47.0
  • Environment: Linux x86_64 Docker, public release asset
  • Provider/model: local OpenAI-compatible mock provider, gpt-4o

This report targets stock public Kimi CLI 1.47.0 from the GitHub release asset. No upstream issue has been filed from this draft yet.

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

Run kimi-cli-child-process-cleanup.reproduce.py from the linked Gist against the affected release to confirm the provider request, detached-child.pid side effect, and timeout. The report names no repository source file or test, so trace the CLI shell-tool child-process lifecycle; done means the child is terminated and reaped and the bounded run returns without the timeout or signal result.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.