Skip to content

refactor(kap-server): drop the turn_id alias from the file-history queries - #4826

Merged
wbxl2000 merged 1 commit into
mainfrom
refactor/file-history-drop-turn-id
Nov 11, 2026
Merged

wbxl2000 merged 1 commit into
mainfrom
refactor/file-history-drop-turn-id

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Requirement or Bug

#4788 把 file-history 两个查询的参数改名为 turn_number,旧名字 turn_id 暂时作为别名保留,等客户端切换完。现在 desktop(MoonshotAI/kimi-code-app#1250)和 CLI 自带的 web 界面(#4816 同步进来的产物)都已改传 turn_number,本 PR 删掉这个别名。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

 rest-file-history.ts
-  turn_number?  (describe: required unless turn_id is given)
-  turn_id?      (describe: deprecated alias)
-  transform withTurnNumber: turn_number ?? turn_id, both missing → issue
+  turn_number   z.coerce.number().int().nonnegative()   # 必填,和 #4788 之前的 turn_id 写法一致
  • 路由本来就读 req.query.turn_number,不用改。
  • turn_id 现在和其他未知查询参数一样被忽略,只带它的请求因为缺 turn_number 返回 40001。
  • server-api.md(中英)删掉「仍接受已弃用的别名 turn_id」。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
file-history 的 changes / content 查询只带 turn_id 当作 turn_number 接受 返回 40001(缺少 turn_number) 还在传 turn_id 的外部 API 调用方。desktop(kimi-code-app#1250)和 CLI 自带的 web 界面(#4816)都已改传 turn_number;仓库里没有其他调用方 无,改传 turn_number。维护者已确认直接移除(这组 API 在文档中标注为实验性)
同时带 turn_number 和 turn_id 用 turn_number 用 turn_number,turn_id 被忽略 — —

契约:OpenAPI 里这两个接口的查询参数去掉 turn_id;apiSurface 快照只记路径,没有变化。changeset 写明了失去的行为。

测试(test/fileHistory.test.ts):

  • 「no longer takes the turn number as turn_id」:两个查询只带 turn_id 时返回 40001,在改动前的代码上会失败;
  • 原有的「requires the turn number」继续覆盖缺参数的情况。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).(没有关联 issue,背景见上)
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

…eries

The file-history queries took turn_id as a deprecated alias of turn_number while clients moved over. The desktop and bundled web clients now send turn_number, so the alias goes and turn_id alone fails validation like any missing turn number.
@changeset-bot

changeset-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ddce3f4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T06:58:16.697295Z ddce3f4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@ddce3f4
npx https://pkg.pr.new/@moonshot-ai/kimi-code@ddce3f4

commit: ddce3f4

@wbxl2000
wbxl2000 merged commit 13590cd into main Nov 11, 2026
28 of 29 checks passed
@wbxl2000
wbxl2000 deleted the refactor/file-history-drop-turn-id branch November 11, 2026 08:47
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 15, 2026
…th 2.6.0

MoonshotAI#4772: end tool calls cut short by a stop as interrupted, and keep a tool error failed when the step itself failed.

MoonshotAI#4826: drop the deprecated turn_id alias from the file-history queries; a turn_id-only query now fails validation with 40001.

MoonshotAI#4730: a streamed item no longer ends early from the feed clock. The source shape is in place; the remaining live-feed gap is recorded in the ledger row.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants