MoonshotAI / MoonshotAI/kimi-code

kimi export 卡死:没有会话时无限挂起,-y 也没用

Open
#3,120 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

What version of Kimi Code CLI is running?
0.37.2
Which open platform/subscription were you using?

DeepSeek API(OpenAI-compatible provider,非官方订阅;与 provider 无关,CLI 层行为)

Which model were you using?

deepseek/deepseek-v4-flash

What platform is your computer?
Darwin 25.4.0 arm64 arm
What issue are you seeing?

kimi export 在不指定会话 ID 时会犯病,而且一犯就是俩:

病 1(装死):一个会话都没有的时候,敲 export 它一句话不说、直接装死——不报错、不退出、一直卡住,只能 Ctrl+C 强杀。

病 2(无视 -y):明明有会话,敲 kimi export -y 想跳过确认,它当没看见,照样弹 "Export previous session ...? [Y/n]" 然后卡住等你输入。

技术细节:

A. 无任何会话时,命令无限挂起、零输出、永不退出(实测 60s+,进程处于 sleep 状态,CPU ~0%),无报错、无提示、无超时机制,只能外部强杀。

B. 存在会话但使用 -y/--yes(不带 sessionId)时,确认提示仍出现并阻塞;help 明确写 -y, --yes Skip previous-session confirmation,但实际仍打印 Export previous session "session_xxx"? [Y/n] 并等待输入;stdin 关闭(EOF)时同样无限挂起。

What steps can reproduce the bug?

场景 A(无会话挂起)——全新/隔离配置目录,无任何 session:

export KIMI_CODE_HOME=/tmp/empty-kimi-home
mkdir -p /tmp/empty-kimi-home
kimi export
# 结果:无任何输出,进程无限挂起(需 Ctrl+C 或 kill)

场景 B(-y 不生效)——目录内存在至少一个 session:

kimi export -y
# 结果:仍打印 "Export previous session \"...\"? [Y/n]" 并阻塞
echo "y" | kimi export -y   # stdin 管道输入也一样会卡住等待

对照(正常路径)——显式传 sessionId 时 -y 任意位置生效:

kimi export -y session_xxx -o out.zip   # 正常导出,exit 0
What is the expected behavior?
  • 无 session 可导出时应立即明确报错(如 "No session found")并以非 0 退出
  • -y/--yes 在默认路径(不带 sessionId)下应同样跳过确认,直接导出
Additional information
  • 相关 PR #1727(feat(cli): improve export session UX,merged 2026-04-02)正是引入 --yes 的改动,但 CLI 测试未覆盖默认路径场景,导致该缺口
  • 非交互/CI 场景下 B 问题会导致脚本永久阻塞,无超时
  • 复现时使用 KIMI_CODE_HOME 指向全新目录即可,无需任何历史数据

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 kimi export CLI entry point and review the CLI tests associated with PR #1727, which introduced --yes. Reproduce both cases with an empty KIMI_CODE_HOME and with an existing session, then add coverage for the no-session error and the default-path -y behavior; done means both paths exit or export without blocking.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.