Skip to content

fix(agent-core-v2): match regional plugin locales - #4666

Merged
liruifengv merged 1 commit into
release/2026-11-04from
fix/plugin-capability-locale-fallback
Nov 4, 2026
Merged

liruifengv merged 1 commit into
release/2026-11-04from
fix/plugin-capability-locale-fallback

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Requirement or Bug

Desktop / Web 的插件详情页在界面语言为 en 时,无法使用仅提供 en-US.json 的插件翻译,Skills 和 MCP 会回退到 manifest 的默认语言。本 PR 让语言-only locale 能正确匹配同语言的区域翻译,同时保持中文及其他默认文案行为不变。

Bug Reproduction Steps

  1. 准备一个插件:manifest 的 defaultLocale 为 zh-CN,Skills 和 MCP 默认文案为中文,只额外提供 locales/en-US.json。
  2. 将客户端界面语言设为英文,使详情请求携带 locale=en。
  3. 打开插件详情页。插件介绍可以使用英文,但 Skills 和 MCP 的名称、描述仍显示中文。

Root Cause

插件能力详情的 locale 选择只支持精确匹配,以及区域 locale 向基础语言的回退。请求为 en 时只会查找 en,不会命中 en-US,因此返回 manifest 的默认文案。

本次是根本修复:统一补全同语言区域版本的选择规则,不改客户端传参、接口协议或插件 manifest 格式。

Code Changes

在 PluginManager 共享的 locale 选择逻辑中补全回退顺序,已安装插件详情和 marketplace preview 都经过这条路径,因此 Skills 与 MCP 可以同时修复。

 resolve interface locale
   exact locale match
   regional locale -> base language match
+  same-language default locale match
+  same-language regional locale match, ordered deterministically
   fall back to manifest default interface

同语言区域版本只在前面的精确匹配和基础语言匹配均未命中时参与选择;如果 defaultLocale 与请求属于同一语言,则优先使用默认语言文案。最终仍未命中时继续返回 undefined,沿用现有 manifest 默认文案回退。

阅读入口是 packages/agent-core-v2/src/app/plugin/manager.ts 的 pluginInterfaceForLocale;其余变更为对应回归测试。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
请求 en,插件仅提供 en-US.json Skills / MCP 使用 manifest 默认语言 使用 en-US 翻译 无;原行为是中英混杂的 bug 不适用
请求其他区域版本,如 en-GB,只存在同语言区域翻译 使用 manifest 默认语言 回退到同语言区域翻译 无 不适用
精确 locale、基础语言及 manifest 默认回退 按原优先级选择 保持原优先级 现有插件及客户端 不适用

影响模块为 agent-core-v2 的插件详情与插件包 inspection。测试覆盖已安装插件的 Skills / MCP 文案、marketplace preview,以及 en、en-US、en-GB、zh、zh-CN 的选择结果。

验证记录
  • pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run test/app/plugin/manager.test.ts:28/28 passed。
  • pnpm --filter @moonshot-ai/agent-core-v2 run typecheck:通过。
  • git diff --check:通过。
  • 未运行 Desktop 端到端验证;本次验证覆盖客户端实际传入的语言-only locale 及共享详情 / preview 数据路径。

Checklist

  • I have read the CONTRIBUTING document.
  • Related issue: N/A (internal bug fix).
  • 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; changeset omitted at the author's explicit request.
  • This PR needs no doc update because it restores the intended localization behavior without changing the plugin contract.

@changeset-bot

changeset-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 78fdaa1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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-04T08:46:39.839984Z 78fdaa1 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@78fdaa1
npx https://pkg.pr.new/@moonshot-ai/kimi-code@78fdaa1

commit: 78fdaa1

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78fdaa1552

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@liruifengv
liruifengv merged commit 0f05974 into release/2026-11-04 Nov 4, 2026
15 checks passed
@liruifengv
liruifengv deleted the fix/plugin-capability-locale-fallback branch November 4, 2026 08:59
Grapedge pushed a commit that referenced this pull request Nov 4, 2026
* fix(tui): read welcome cwd and footer git status from the session environment (#4649)

* fix(tui): show remote cwd in welcome panel

* fix(tui): read footer git status through the session environment

The footer ran git and gh on the local machine, so a remote-bound session
hid the git badge. Read branch, working-tree, and pull request state through
the SDK instead: a live session's own environment, or the local work dir
before the lazy session exists. The local HEAD poll stays as a refresh
trigger only.

Core git commands now time out after 30s, and the pull request cache is
keyed by branch so a branch switch no longer serves the previous branch's
pull request.

* fix(agent-core-v2): resolve local git and gh outside the working directory

GitService spawned bare git and gh with the workspace as cwd. On Windows a
bare name is looked up in the cwd before PATH, so a binary planted in the
workspace could run, and the TUI footer now reads git status at startup,
before the workspace trust gate. Resolve both through PATH for the local
environment and refuse any match inside the working directory.

* chore: merge changesets for remote cwd and git status

* fix(tui): drop the startup Ready. row once startup succeeds

The startup progress row turned into a permanent "Ready." line under the
welcome panel. Remove it on success; a failed startup still leaves the
"Startup failed." row.

* fix(agent-core-v2): compare workspace containment case-insensitively on Windows

resolveProgramPath compared the PATH candidate against the working directory
case-sensitively, so on Windows a PATH entry spelled with different casing
(c:\repo\bin vs C:\Repo) let a workspace-local executable through.

* fix(tui): keep the footer git badge through a remote disconnect

The git cache key included the environment status, so a remote dropping to
connecting or disconnected rebuilt the cache and lost the last badge. Key
the cache by session and work dir only, and refresh it when the environment
turns ready again.

* feat: isolate plugin availability by client (#4653)

* fix: preserve marketplace descriptions

* fix: preserve localized plugin display names

* feat: isolate plugin availability by client

* fix: preserve cli marketplace loading

* fix: harden plugin availability reconciliation

* fix: hash plugin marketplace provenance

* fix: complete plugin availability reconciliation

* fix(transcript): keep realigned turn ids unique when folding cold facts (#4658)

* fix(transcript): keep realigned turn ids unique when folding cold facts

Realigning base turns to their wire ids only skipped ordinals held by
turns without a wire id. When an inherited turn held a forked turn's
wire id, that turn kept its base ordinal, and the next turn's wire id
could land on the same ordinal, so two turns shared a turn id and the
later one replaced the earlier in clients. Claim ordinals in order:
turns without a wire id or already at their wire id first, then each
realigned turn takes its wire id when free, else keeps its ordinal or
moves to the next free one.

* chore: add changeset for side chat turn order fix

* fix(kap-server): wait for an agent's history before accepting its prompt (#4659)

* fix(kap-server): backfill a side chat fork before replying to :btw

A fork's inherited history folds into a cold turn at t0, while the live
transcript only records it as markers. When the fork's first prompt
started before anything read the fork transcript, its live turn took t0;
the history backfill then merged the inherited main turn into it by turn
id, so the first side chat turn carried the main answer and the real
answer landed in a duplicate turn. Finish the fork's history backfill
before :btw replies, so the inherited turn holds t0 before the first
prompt can start.

* fix(kap-server): wait for an agent's history before accepting its prompt

Delaying the :btw reply did not order the fork's first prompt after its
history backfill: other clients learn the fork from the agent roster as
soon as it is created, and checking for a live transcript with
forSessionLive created one, so every :btw also waited for the whole main
history. Move the wait to prompt submission: a prompt for a non-main
agent awaits that agent's history backfill before it is enqueued, which
covers every client and leaves :btw unchanged. The backfill is cached
per agent, so later prompts do not wait again.

* fix: safely launch Windows SSH executors (#4664)

* feat: support Windows SSH remote environments

* Delete .changeset/windows-remote-environments.md

Signed-off-by: 7Sageer <[email protected]>

---------

Signed-off-by: 7Sageer <[email protected]>

* fix(agent-core-v2): match regional plugin locales (#4666)

* fix(plugins): confirm stopping Windows CU processes before install (#4670)

* fix(plugins): confirm stopping Windows CU processes before install

* test(plugins): cover capability install confirmation contract

* fix(plugins): preserve bodyless installs and plugin-only repairs

* chore: sync web dist from code-app (#4667)

* chore: sync web dist from code-app

code-app: 63661fc449e2ec0ce024bc08fe87f2c757d483e8

* chore: sync web dist from code-app

code-app: d0e913a6c9607be778c62f0c74ee7310bfb8862a

* chore: sync web dist from code-app

code-app: b306f4a2f9be8944e5a8064ecb076e3137c968f1

---------

Co-authored-by: kimi-agent-bot <[email protected]>

* ci: release packages (#4672)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: 7Sageer <[email protected]>
Co-authored-by: 7Sageer <[email protected]>
Co-authored-by: liruifengv <[email protected]>
Co-authored-by: qer <[email protected]>
Co-authored-by: kimi-agent-bot <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Fifteen rows enter the ledger: the six commits that landed on
upstream/main after the last refresh, and the nine commits that reach
main only through the release/2026-11-04 sync (MoonshotAI#4674), which is where
the 2.5.0 changelog entries come from.

Each 2.5.0 row records what it needs from this tree, so the next batch
starts from the blocker instead of rediscovering it:

- MoonshotAI#4658 and MoonshotAI#4659 are ported (79a4199, 7a531f5) with tests that
  fail on the pre-change tree.
- MoonshotAI#4649 is in_progress: its agent-core-v2 half landed in 2fa7b6b,
  while the footer and welcome half needs the pull-request API of MoonshotAI#4527
  and the session workdir of MoonshotAI#4062.
- MoonshotAI#4653, MoonshotAI#4666 and MoonshotAI#4670 build on the MoonshotAI#4525 plugin marketplace, absent
  here; MoonshotAI#4670 additionally needs isError2.
- MoonshotAI#4664 needs the MoonshotAI#4062 remote environments.
- MoonshotAI#4667 and MoonshotAI#4672 are generated-bundle and release commits; settling
  them as not-applicable needs a signature.

Rows were appended by a one-off writer because --refresh fetches and
that fetch does not complete on this network; the file still parses
under the tool's own column contract, and --verify --batch B5 passes
both new probes.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 5, 2026
…ection layer

The row reads as a two-file change, but it edits `pluginInterfaceForLocale`,
which this tree does not have: the fork's plugin manager parses and stores
`interfaceLocales` and declares `PluginCapabilities`, yet nothing builds the
inspection surface that consumes them (no `pluginCapabilities`,
`pluginSkillsInfo` or `pluginMcpServersInfo`). Porting the selector alone would
leave it uncalled.

Prerequisite named in the row: the inspection half of MoonshotAI#4525, which the ledger
already marks equivalent with a note listing only the entry model and parser as
ported.

Ledger: MoonshotAI#4666 blocked; closed 79, remaining 20.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 5, 2026
Port of upstream MoonshotAI/kimi-code 0f05974 (MoonshotAI#4666).

A plugin that ships `zh-CN` (or `zh_Hans`) could not answer a client asking
for `zh-TW`, and `en` never reached an `en-US` translation: the lookup only
tried the exact tag and the bare language, so any region mismatch fell
through to the unlocalized manifest. The resolution order is now exact tag,
then bare language, then the manifest's declared `defaultLocale` when it
shares the language, then the first same-language variant in a stable order.
Keys are normalized (lowercase, `_` to `-`) on both sides, so a file named
`zh_HK.json` participates like `zh-HK`.

`getPluginInfo({ id, locale })` carries the locale and the resolved interface
overrides each MCP server's `displayName`, `description` and `iconUrl`, with
the localized override ahead of the base manifest's. `PluginMcpServerInfo`
gains those three optional fields.

Local-form notes:
- Upstream resolves this through a `PluginInspection` record carrying
  per-skill records, so its test also covers `info.skills`. This fork has no
  per-skill record source (only `skillCount` and `skillInstruction`);
  `PluginCapabilities`, `PluginSkillRecord` and `PluginSkillInfo` are declared
  but have no consumer anywhere, so building that pipeline here would be new
  machinery for a dead surface. The port covers the live one: MCP server
  presentation, driven by the same `pluginInterfaceForLocale`.
- `getPluginInfo` is only called from the kimiCu capability and tests today,
  so adding `locale` to the input stays inside the engine; there is no
  kap-server route or SDK contract to update.

Verified: agent-core-v2 typecheck clean; test/app/plugin/manager.test.ts 11
pass, pluginService 32, marketplace 13, kimiCu 38, pluginCommand 2; oxlint
--type-aware 0 errors; check:no-comments green (the JSDoc that explained the
fallback order was removed rather than exempted, since this package forbids
comments). The two new cases fail if the base-language and same-language
fallbacks are dropped.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 5, 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.

1 participant