Repository navigation
fix(plugins): confirm stopping Windows CU processes before install - #4670
Conversation
|
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6a60fa5b7
ℹ️ 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".
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 002cc0ed68
ℹ️ 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".
* 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>
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.
… resolve seam The row looked like a 34-file mechanical port, but its installer call goes through `installResolvedMarketplacePlugin(plugins, input, resolved, requiredSkill)`, which needs `marketplace.resolveInstall` and the `MarketplacePluginInstall` type from upstream's `app/plugin/marketplaceService.ts`. That file has no counterpart here: the marketplace port (MoonshotAI#4525, equivalent) carried the entry model and parser only, and this tree installs through `manager.install` plus `availability.matchByArtifact`, so there is nothing for the capability entry to hand over. A trial apply was written and then fully reverted (11 conflicted files, and the new pluginService/kimiCu imports resolve against symbols this tree does not export), and the engine typecheck is clean again. The row now names the prerequisite: port the resolveInstall seam and the type, and the row turns back into a mechanical port.
…tall Port of upstream MoonshotAI/kimi-code 5e85af3 (MoonshotAI#4670). Installing or updating the Windows Kimi Computer Use plugin while its processes are running fails on a locked directory, and the old failure surfaced only after the installer had already started. The capability now asks first: `install` reports `confirmationRequired: 'stop-processes'` instead of throwing, the caller re-invokes it with `stopRunningProcesses: true`, and only then are the matching processes stopped and the install retried. Process discovery is scoped precisely: only `kimi-cu.exe` images whose executable sits at one of the known install paths, in the current session, and whose command line starts with an `agent` / `agent-background` / `mcp` mode. Anything else with that name is left alone, and the stop path re-verifies each process's image path and start time before killing it, so a recycled pid cannot take out an unrelated process. `IPluginService.withMcpServersSuspended(id, task)` holds a plugin's MCP servers out of the projection for the duration of a task and restores them afterwards — the running MCP child process would otherwise keep the plugin directory busy. The confirmation reaches the surfaces: the TUI mounts a stop-processes dialog and cancels cleanly on Escape, kap-server accepts an optional install body, and klient / node-sdk forward it. Local-form notes: - `kimiCu.ts` installs through `installPluginLayer(ctx, windowsPlugin())` here; upstream routes it through `installResolvedMarketplacePlugin` from the marketplace service this fork does not have (MoonshotAI#4525's seam). The wrapper sits around the existing call, so the suspension and the consent check apply identically. - The dialog copy and the "still running" notice go through `t()` with en/zh keys, and the two new error codes get `errorCodes.*` entries, since both gates are enforced here. - `capabilityInstallOptionsSchema` is `.strict()`, which `check:strict-request-bodies` requires at this boundary. - Two test-only fixes for this host rather than for the product: the integration case compares the executable through `[IO.Path]::GetFullPath` on both sides and accepts either form in the command line, because a short-path `%TEMP%` (`ADMINI~1`) otherwise never matches; and its temp directory is removed with retries, since Windows releases the image handle just after `exit`. Both reproduce on the unmodified upstream test. Verified: agent-core-v2 typecheck clean; kimiCu 43 pass, windowsCuProcesses 1 pass (twice in a row), capabilityService 13, pluginService 33, pluginCommand 2, skillCatalog 24, agentProfileLoader 24; kap-server capabilities + sessionEventBroadcaster + sessions 176; klient 32; node-sdk sdk-rpc-client-v2 86; apps/kimi-code plugins-capability 15 and plugins-selector 50; oxlint --type-aware 0 errors; check:no-comments, check:no-hardcoded-prose, check:locale-keys, check:locale-placeholders, check:t-coverage, check:strict-request-bodies and check:status-surface-i18n green.
Requirement or Bug
Windows 用户安装或更新 Computer Use 插件时,旧的后台进程可能仍占用插件目录,安装立即失败。该进程可以独立于客户端存活,因此重启客户端不一定能恢复。
本次为 TUI 和客户端安装接口增加明确的确认流程:告知会中断正在进行的电脑操作,用户同意后结束相关进程并继续安装。无关联 issue。
Bug Reproduction Steps
/plugins或 desktop/web 插件设置中安装或更新 Windows Computer Use。EBUSY,提示重启客户端;旧后台进程仍可能存活并继续占用目录。Root Cause
Windows 不允许重命名被进程作为工作目录使用的目录。安装器在替换插件目录前未处理运行中的 Computer Use 进程,而本进程的 MCP 连接也可能重新启动插件进程。
本次在安装前解除已识别进程造成的占用,并在替换期间暂停该插件的 MCP 连接。其他应用造成的占用仍按安装错误报告,不再误称一定由当前客户端占用。
Code Changes
安装接口继续接受无请求体的 POST,并将省略的选项归一为空对象。进程枚举独立选择可用的 PowerShell,只有运行时需要安装时才检查完整安装器命令。
把“需要结束进程”作为安装状态返回,只有确认后的重试带
stopRunningProcesses: true。TUI、SDK、klient、REST 和 WebSocket 使用同一契约。flowchart TD UI[TUI 或 desktop/web] --> START[请求安装] START --> CHECK{Windows CU 进程运行中} CHECK -- 是且未授权 --> ASK[返回 confirmationRequired] ASK --> CONFIRM[界面二次确认] CONFIRM -- 取消 --> END[结束本次安装] CONFIRM -- 同意 --> RETRY[携带 stopRunningProcesses 重试] RETRY --> SUSPEND[暂停目标插件 MCP 并等待断开] CHECK -- 否 --> SUSPEND SUSPEND --> STOP[再次检测并按授权结束匹配进程] STOP --> INSTALL[执行原插件和运行时安装] INSTALL --> RESTORE[成功或失败均恢复 MCP]暂停和恢复属于插件服务的临时状态,不修改用户的启用配置。安装期间的 reload 也保留暂停状态,避免替换文件时重新拉起 MCP。
进程筛选限定在当前登录会话、已知安装路径或配置路径,以及
agent/agent-background/mcp模式。结束进程前再次核对可执行文件和创建时间,并等待退出。没有按进程名批量终止。运行时安装器保留原有启动后台进程的行为;只更新插件时恢复 MCP,由后续使用按需启动。
阅读顺序:
windowsCuProcesses.ts查看识别及结束范围,kimiCu.ts查看安装顺序,pluginService.ts查看临时暂停及恢复,tui/commands/plugins.ts查看确认与重试。其余协议、SDK 和测试文件是透传与覆盖。Screenshots / Recordings
以下为本分支确认组件经虚拟终端渲染的原始文本快照,默认选中 Cancel;确认选项必须显式选择后按 Enter。
Behavior Changes and Affected Users
/plugins用户仅 Windows CU 安装入口启用进程控制。其他平台、其他插件沿用原安装入口。desktop/web 的二次确认在 kimi-code-app #1144,app submodule 由维护者另行处理。
已验证未确认时不结束进程、确认重试、结束失败后的恢复、MCP 暂停期间 reload、协议字段透传、TUI 默认取消/Esc/重试失败,以及真实 Windows 临时进程占用目录释放。真实进程测试同时验证不同路径的同名进程和
doctor模式不被终止。未对用户实际安装的 CU 进程执行终止测试。验证详情
git diff --check通过。Checklist
gen-changesetsskill — 按维护者明确要求,本 PR 不添加 changeset。