MoonshotAI / MoonshotAI/kimi-code

[Windows] statusLine spawn lacks windowsHide — visible console popup steals focus on every refresh

Open
#3,329 1 comment 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

  • OS: Windows 11 (Chinese locale), Windows Terminal set as default terminal
  • kimi-code: 0.39.0
  • User config: custom statusLine command (a shell script), plus hooks

Symptom

Every statusline refresh spawns a visible console window (titled as a console host popup, hosted by Windows Terminal) that steals keyboard focus. With a custom statusLine this fires every few seconds, making the TUI nearly unusable.

Root cause (from source, v0.39.0)

The main hook/Bash spawn paths were fixed in #957 / #1466 (windowsHide → libuv CREATE_NO_WINDOW), but the statusline path was missed:

  • apps/kimi-code/src/tui/utils/status-line-command.ts:46 — spawns cmd /d /s /c <statusline command> without windowsHide
  • same file, line ~62 — the timeout taskkill spawn also lacks windowsHide

Same batch of remaining spawns missing windowsHide (worth auditing together):

  • packages/agent-core/src/services/fs/fsSearchService.ts:183
  • apps/kimi-code/src/utils/clipboard/clipboard-common.ts:73
  • MCP stdio servers via StdioClientTransport (one flash per server start)

Evidence

Process-monitor capture at popup timestamps shows cmd.exe /d /s /c "...statusline.sh" parented to the kimi TUI process at each popup moment, 1:1.

Mechanism (verified by reproduction)

On Windows, when a parent process has no console and spawns a console-subsystem program without CREATE_NO_WINDOW, the OS allocates a new console, which the default terminal (Windows Terminal) surfaces as a popup window. Adding windowsHide: true fixes it — same pattern as #1466.

Impact

Any Windows user with a custom statusLine (or an MCP server via cmd) gets focus-stealing popups continuously. Especially confusing for non-technical users.

Local workaround (in case it helps triage)

We redirected ComSpec to a GUI-subsystem cmd shim so all shell-outs go through a windowless proxy (byte-level transparent). Works, but it's a user-side hack — the real fix belongs in these spawn sites.

Happy to test a nightly build.

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 with apps/kimi-code/src/tui/utils/status-line-command.ts and compare its statusline and timeout spawns with the windowsHide pattern from #1466. Check the remaining spawn sites named in packages/agent-core/src/services/fs/fsSearchService.ts, apps/kimi-code/src/utils/clipboard/clipboard-common.ts, and MCP StdioClientTransport. Done means Windows statusline refreshes and listed shell-outs no longer create focus-stealing console popups.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.