MoonshotAI / MoonshotAI/kimi-cli

Windows console TrueType font reset when running subprocess via kaos.exec()

Open Beginner friendly
#2,197 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?

kimi, version 1.41.0

Which open platform/subscription were you using?

selfhosted vllm

Which model were you using?

Kimi-K2.6

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

On Windows, when LocalKaos.exec() spawns a subprocess (e.g. PowerShell) with redirected stdin/stdout/stderr pipes, the parent console's TrueType font — specifically Consolas — is silently reset to a raster/legacy font. After this happens, all non-ASCII characters (Cyrillic, emoji, etc.) become invisible in the parent console. Changing the code page (chcp 65001) does not help because the problem is the console font, not the code page. Other TrueType fonts such as Ubuntu Mono or Iosevka are unaffected; only Consolas is reset.

What steps can reproduce the bug?
  1. Open cmd.exe on Windows 10/11.
  2. Set code page to UTF-8: chcp 65001.
  3. Set console font to Consolas (Properties → Font).
  4. Run any Python script that calls kaos.local.LocalKaos.exec() to start a subprocess, e.g. powershell -command "echo test".
  5. After the subprocess finishes, type any Cyrillic text (e.g., привет) in the console.
  6. Observe that the characters are invisible/blank.
What is the expected behavior?

The parent console font should remain unchanged after the subprocess exits, and non-ASCII characters should continue to display normally.
Proposed fix: Pass subprocess.CREATE_NO_WINDOW in creationflags on Windows. This detaches the child process from the parent console host and prevents Windows from mutating the parent console's font selection.

      async def exec(self, *args: str, env: Mapping[str, str] | None = None) -> KaosProcess:
          if not args:
              raise ValueError("At least one argument (the program to execute) is required.")

          import subprocess

          creationflags = 0
          if os.name == "nt":
              creationflags = subprocess.CREATE_NO_WINDOW

          process = await asyncio.create_subprocess_exec(
              *args,
              stdin=asyncio.subprocess.PIPE,
              stdout=asyncio.subprocess.PIPE,
              stderr=asyncio.subprocess.PIPE,
              env=env,
              creationflags=creationflags,
          )
          return self.Process(process)
Additional information

No response

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 locating the LocalKaos.exec() implementation and reviewing how it calls asyncio.create_subprocess_exec() on Windows. Reproduce the issue with cmd.exe, Consolas, and a PowerShell subprocess, then verify that the parent font and non-ASCII display remain unchanged after execution. Done means the Windows subprocess behavior is corrected without changing non-Windows execution.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.