MoonshotAI / MoonshotAI/kimi-code
Windows 开发脚本 spawn EINVAL + thinking 刷新率过高导致闪烁
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
What version of Kimi Code is running?
0.6.0
Which open platform/subscription were you using?
win10/opencodeGO
Which model were you using?
deepseek-v4-flash
What platform is your computer?
win10
What issue are you seeing?
描述
在 Windows 上搭建本地开发环境时发现两个小问题:
1. pnpm run dev:cli 报 spawn EINVAL
apps/kimi-code/scripts/dev.mjs 中调用 spawn('tsx.cmd', [...]) 时没有加 shell: true。Windows 上
node_modules/.bin/ 里的 .cmd 文件是批处理脚本,不能直接用 Node.js spawn() 启动,需要通过 cmd.exe
来执行。导致:
Error: spawn EINVAL
at ChildProcess.spawn (node:internal/child_process:441:11)
修复方式:仅在 Windows 上添加 shell: true(POSIX 不需要)。
2. Thinking 内容 50ms 刷新导致闪烁刺眼
STREAMING_UI_FLUSH_MS = 50 意味着 ThinkingComponent 的文本内容在快速流式输出时每秒刷新多达 20 次。live
模式只展示末尾 2 行(尾滚动),快速的原地文本替换会产生频闪效果,长时间观看眼睛容易疲劳。
建议:改为 200ms,每秒 5 次刷新,闪烁基本消除,终端响应感依然流畅。
改动内容
两个修改已实现在 https://github.com/Bronya0/kimi-code,包含以下文件:
1. **`apps/kimi-code/scripts/dev.mjs`** — Windows 上 spawn `tsx.cmd` 时加 `shell: true`;屏蔽 DEP0190 警告(dev
脚本参数安全)
2. apps/kimi-code/src/tui/constant/streaming.ts — STREAMING_UI_FLUSH_MS 从 50 改为 200
环境
- 操作系统: Windows
- Node.js: 24.15.0
- pnpm: 10.33.0
What steps can reproduce the bug?
修复方式:仅在 Windows 上添加 shell: true(POSIX 不需要)。
2. Thinking 内容 50ms 刷新导致闪烁刺眼
STREAMING_UI_FLUSH_MS = 50 意味着 ThinkingComponent 的文本内容在快速流式输出时每秒刷新多达 20 次。live
模式只展示末尾 2 行(尾滚动),快速的原地文本替换会产生频闪效果,长时间观看眼睛容易疲劳。
建议:改为 200ms,每秒 5 次刷新,闪烁基本消除,终端响应感依然流畅。
改动内容
两个修改已实现在 https://github.com/Bronya0/kimi-code,包含以下文件:
1. **`apps/kimi-code/scripts/dev.mjs`** — Windows 上 spawn `tsx.cmd` 时加 `shell: true`;屏蔽 DEP0190 警告(dev
脚本参数安全)
2. apps/kimi-code/src/tui/constant/streaming.ts — STREAMING_UI_FLUSH_MS 从 50 改为 200
What is the expected behavior?
No response
Additional information
No response
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 with apps/kimi-code/scripts/dev.mjs and reproduce pnpm run dev:cli on Windows to inspect the spawn failure. Then read apps/kimi-code/src/tui/constant/streaming.ts and verify the streaming interval change against the reported Thinking flicker. Done means the CLI starts without spawn EINVAL on Windows and fast Thinking output no longer visibly flickers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100