MoonshotAI / MoonshotAI/kimi-code

长会话中 LLM 请求连续挂起无响应(ttft 165s),客户端无超时/无提示/无自动重试,会话假死

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

现象

长会话进行中,LLM 流式请求连续多次长时间无任何响应:无首 token、无错误、无超时提示,UI 表现为"假死"。用户只能 Esc 取消后重发,但每次重发依旧挂起。约 10 分钟内连续 8 个请求全部挂起(07:13–07:22 本地时间),会话完全不可用。

环境

  • kimi-code 版本:0.41.0(darwin/arm64,node v24.15.0,shell 模式)
  • 模型:kimi-code/k3,thinkingEffort=high
  • 会话:session_d8f2c1dc-6f9f-4039-886c-9a7b4f33e34c
  • 故障时上下文规模:约 216,624 tokens / 525 条消息(含 4 个 coder 子 agent)

时间线(UTC,2026-09-09)

会话此前一切正常(turn 27–30.7,ttft 3–29s)。从 turn 30.8 开始:

时间 事件 结果
03:13:07 turn 30.8 llm request 无响应,21s 后用户取消
03:13:58 turn 31.1 request 无响应,107s 后取消
03:15:48 turn 32.1 request 无响应,6s 后取消
03:16:31 turn 33.1 request 无响应,1s 后取消(期间用户重启过客户端,token 正常)
03:16:36 turn 34.1 request 无响应,1s 后取消
03:16:39 turn 35.1 request 无响应,68s 后取消
03:18:55 turn 36.1 request 无响应,74s 后取消
03:22:37 turn 37.1 request 03:25:32 才返回,ttftMs=164687(serverFirstTokenMs=164684)
03:25:32 turn 37.2 request ttftMs=44064
03:26:22 起 turn 37.3 / 37.4 恢复正常(ttft 9–10s)

关键日志(~/.kimi-code/sessions/wd_huoxihuo_db03d9ce9c30/session_d8f2c1dc-6f9f-4039-886c-9a7b4f33e34c/logs/kimi-code.log):

2026-09-09T03:22:37.652Z INFO  llm request  turnStep=37.1
2026-09-09T03:25:32.004Z INFO  llm response  turnStep=37.1 ttftMs=164687 streamDurationMs=9661 outputTokens=538 requestBuildMs=3 serverFirstTokenMs=164684 serverDecodeMs=9641 clientConsumeMs=20

日志全程无任何 ERROR/WARN——挂起的请求在日志里只留下一行 llm request,之后什么都没有。

对照

  • 同机另一会话 session_b54f3de3 在 03:23–03:27 正常出 token(ttft 2–14s),说明并非全局网络故障;
  • 另一会话 session_3892596e 在 03:18:19 发出的请求同样没有等到响应,说明当时不止一个会话受影响;
  • ttftMs ≈ serverFirstTokenMs(164687 vs 164684),延迟发生在服务端(排队/prefill),不是本地连接中断。

分析

  1. 服务端:该时段对长上下文请求出现分钟级排队/慢 prefill(165s 首 token)。可能是容量或调度问题,也可能与 ~216k tokens 的大上下文有关。
  2. 客户端(本 issue 主要诉求):对挂起的流式请求没有任何保护——
    • 无首 token 超时 / 停滞检测,请求可以无限挂起;
    • 无自动重试(带退避);
    • UI 没有任何"仍在等待服务端"的反馈,用户无法区分"服务端慢"和"客户端死",只能盲试 Esc+重发,而重发又落入同样的排队,形成"会话故障"体验。

建议

  1. 客户端为 LLM 流式请求增加首 token 超时与停滞检测(如 60–120s 无数据则提示/自动重试);
  2. 等待超过阈值时在 UI 显示已等待时长和状态("服务端响应缓慢,已等待 Ns");
  3. 服务端对超长上下文请求的排队/延迟做观测和限流提示,避免分钟级静默。

Environment: kimi-code 0.41.0, macOS arm64, node v24.15.0, model kimi-code/k3. All timestamps from local logs; happy to provide the full wire.jsonl / kimi-code.log if needed.

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 by tracing the CLI's streaming LLM request path and inspect the session log at ~/.kimi-code/sessions/wd_huoxihuo_db03d9ce9c30/session_d8f2c1dc-6f9f-4039-886c-9a7b4f33e34c/logs/kimi-code.log. Reproduce a request with no first token and determine where timeout, status feedback, and retry behavior belong. Done means a prolonged wait is visible to the user and no longer leaves the session silently hung.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.