MoonshotAI / MoonshotAI/kimi-code

[Windows] Hooks spawn a visible console window on every run (native single-binary CLI)

Open
#3,297 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Environment

  • kimi-code 0.38.0, Windows native single-binary CLI (kimi.exe, PE32+ console)
  • Windows 11 (zh-CN), Windows Terminal as the default terminal application
  • Hooks in config.toml as shell-string commands (e.g. python3 C:/.../hook.py pre-tool-use); PreToolUse without matcher (fires on every tool call)

What happens

Every hook invocation briefly flashes a console window. With PreToolUse hooks this means dozens of flashes per agent turn — the screen visibly "flickers" while the agent works.

Forensics (window+process watcher on the machine):

  • At flash time a new cmd.exe /d /s /c "<pythonw> hook.py pre-tool-use" is born with a fresh conhost.exe child — the hook command is wrapped in cmd and gets a NEW console instead of inheriting one.
  • With Windows Terminal as default terminal, the new console is handed off to WT and appears as a transient window titled "主机弹出窗口" (Host Popup Window, class Xaml_WindowedPopupClass).

Expected

Hooks spawn with no visible window (CREATE_NO_WINDOW or equivalent), like the Bash tool path.

Notes

  • Changelog 0.23.2: "Fix console windows flashing on Windows each time a hook runs" — this looks like a regression on the native single-binary CLI introduced in 0.37.0 (the fix predates the native rewrite).
  • #1298 fixed the same class of flash for Bash tool spawns; the hook spawn path still flashes on 0.38.0.

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 at the hook spawn path in the native single-binary CLI and compare it with the Bash tool path referenced by #1298. Reproduce a config.toml PreToolUse shell-string hook on Windows, then verify hook processes run without a visible console window or flicker.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell, typescript
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.