MoonshotAI / MoonshotAI/kimi-code
[Windows] Hooks spawn a visible console window on every run (native single-binary CLI)
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.tomlas shell-string commands (e.g.python3 C:/.../hook.py pre-tool-use);PreToolUsewithout 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 freshconhost.exechild — the hook command is wrapped incmdand 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
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 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