Skip to content

fix: clarify wire version upgrade guidance - #4662

Merged
sailist merged 1 commit into
mainfrom
feat-327-11-02-wire-min-reader-version
Nov 4, 2026
Merged

sailist merged 1 commit into
mainfrom
feat-327-11-02-wire-min-reader-version

Conversation

@sailist

@sailist sailist commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Requirement or Bug

跟随 #4638。读取声明了更高最低读取版本的会话时,CLI、TUI、SDK 和 kap-server 用户会在公开错误中看到 wire.jsonl 与协议版本号等实现细节。本 PR 将主提示统一为直接升级 Kimi Code,同时把双方版本保留在结构化错误详情和诊断日志中。

Bug Reproduction Steps

  1. 准备首条 metadata 声明 min_protocol_version: '9.9' 的会话,使用支持协议 1.5 的客户端恢复或冷 fork。
  2. 观察 wire.version_too_low / 40930 WIRE_VERSION_TOO_LOW 错误。
  3. 修改前,公开消息包含内部文件名和双方协议版本,kap-server 部分错误响应没有携带版本详情;修改后,主提示只要求升级,版本号可从 details.minReaderVersion 和 details.readerVersion 获取。

Root Cause

公开错误消息直接插值了诊断用版本号,且 kap-server 的公开详情白名单和局部错误映射没有完整传递该错误的 details。这是根本修复:公开文案与诊断数据分离,而不是在各个展示端分别隐藏版本号。

Code Changes

  • core 与 SDK 使用面向产品的升级标题、行动建议和公开消息,不再把 wire.jsonl 与协议版本放进主提示。
  • kap-server 的通用 transport、全局异常处理器和 fs 路由统一传递 minReaderVersion / readerVersion,保持错误码与既有恢复语义不变。
  • CLI 启动失败和 TUI 恢复失败日志仅在 WIRE_VERSION_TOO_LOW 时附加结构化详情,便于诊断且不影响其他错误日志。
  • 更新 core、kap-server 和 transport 契约测试,并添加 CLI patch changeset。

Screenshots / Recordings

以下文本来自变更前后的公开错误定义与契约测试。

Before After
This wire.jsonl requires reader protocol 9.9; current Kimi Code supports 1.5. Upgrade Kimi Code to read this session. This session requires a newer version of Kimi Code. Upgrade Kimi Code to the latest version to read this session.

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
最低读取版本不兼容的公开标题与消息 主提示包含 wire.jsonl 和双方协议版本 主提示只说明需要升级 Kimi Code 读取不兼容会话的 CLI、TUI、desktop/web 与 SDK 用户;精确匹配旧英文文案的外部脚本 版本号改从结构化 details 和诊断日志获取;精确匹配旧文案没有兼容退路
kap-server 兼容性错误响应 部分通用或局部映射不返回版本详情 40930 响应统一携带 minReaderVersion / readerVersion desktop/web、SDK 与直接调用 REST 的客户端 仅新增详情字段,无旧行为移除
CLI/TUI 兼容性失败日志 只有错误本体 同类错误附加双方版本详情 排查启动或恢复失败的 CLI/TUI 用户 仅增加诊断信息,无旧行为移除
  • core:packages/agent-core-v2/test/index.test.ts 固定公开消息和结构化版本详情。
  • kap-server:sessions.test.ts 覆盖冷 fork 的 40930、新消息和详情;transport-errors.test.ts 覆盖通用映射、全局异常处理器以及既有 session-conflict 详情保持不变。
  • CLI/TUI:共享错误契约由 core 测试覆盖;日志分支由此前真实启动与恢复调用验证,本次变基后未重复手动步骤。
验证
  • corepack pnpm vitest run packages/agent-core-v2/test/index.test.ts packages/kap-server/test/sessions.test.ts packages/kap-server/test/transport-errors.test.ts:3 个测试文件,126/126 通过。
  • 未在本地运行全量测试,由 PR CI 覆盖。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • 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.

Simplify the public upgrade error without exposing wire protocol versions.
Preserve reader versions in API error details and CLI/TUI diagnostic logs.
@changeset-bot

changeset-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e53670d

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 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T02:34:52.077732Z e53670d 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 4, 2026

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

commit: e53670d

@sailist
sailist merged commit 8fc5e22 into main Nov 4, 2026
17 checks passed
@sailist
sailist deleted the feat-327-11-02-wire-min-reader-version branch November 4, 2026 02:37
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
…target

MoonshotAI#4638 lands in four slices: core enforcement (4d49fcb), the kap-server
mapping and route declarations (8988dea), search skipping an
unreadable wire (1a34ae1), and the SDK entry with a regenerated
manifest (65a6412).

MoonshotAI#4662 stays pending rather than closed: its reworded message has a site
now, but it also lands on the full route-declaration set, and four
routes here (environment, interactions, sessionRating, tools) carry no
`WIRE_VERSION_TOO_LOW` declaration because their error maps use anchors
this fork does not have.

Ledger: closed 40 -> 43, remaining 56.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Port of upstream 8fc5e22 (MoonshotAI#4662). A session written by a newer reader
failed with `This wire.jsonl requires reader protocol 1.5; current Kimi Code
supports 1.4`, which tells the user nothing actionable and exposes an
internal protocol number.

The thrown error and the public error action now say that the session needs a
newer Kimi Code and to upgrade to the latest version, while
`minReaderVersion`/`readerVersion` stay in `details` — which is why
`wire.version_too_low` joins `PUBLIC_DETAIL_CODES` and the kap-server error
handler forwards them. Startup and session-resume failures log the details
too, so a support report still carries the versions.

Local-form notes: the CLI entry point is `apps/kimi-code/src/main.ts`, not
upstream's `cli/main.ts`, and it is that file's `logStartupFailure` that logs
the details. `routes/fs.ts` has no `WIRE_VERSION_TOO_LOW` branch here — the
fork routes it through the shared `mapError`, which is the path
`PUBLIC_DETAIL_CODES` covers. A separate copy of the old wording remains in
`packages/kap-server/src/search/indexCore.ts`; it reports the search index's
own protocol version, has no upstream counterpart, and is out of scope.

Verified: agent-core-v2 and apps/kimi-code typecheck clean, check-no-comments
clean; new `readerVersion.test.ts` 2 pass, `test/wire` 111 pass with the same
2 pre-existing failures as `HEAD` (confirmed by stashing the wire changes and
re-running: `heals a torn final line left by a disk-full crash` fails there
too), kap-server transport-errors 18 pass.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
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.

2 participants