Skip to content

fix(kimi-code): make fullscreen copy reach the clipboard in tmux and on Linux - #4755

Merged
Grapedge merged 16 commits into
mainfrom
fullscreen-clipboard
Nov 9, 2026
Merged

Grapedge merged 16 commits into
mainfrom
fullscreen-clipboard

Conversation

@Grapedge

@Grapedge Grapedge commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

在全屏模式下用鼠标拖选文字,松开后界面会提示 "Copied!"。但在 tmux 里和 Ubuntu 上,剪贴板里的内容并没有变。这个 PR 修好之后,全屏选区和 /copy 走同一条剪贴板路径。写入成功时提示 "Copied!",只能交给终端处理时提示 "Copied via terminal",写不进去时直接显示原因。另外加了「选中即复制」开关 copy_on_select,关掉后用 Ctrl+C 复制选区,和 Claude Code、Codex 的做法一致。

Bug Reproduction Steps

  1. 在 tui.toml 里设置 tui_mode = "fullscreen",然后在 tmux(默认配置)里启动 kimi。
  2. 用鼠标拖选 transcript 里的一段文字,然后松开。
  3. 界面提示 "Copied!",但 pbpaste 读出来的还是旧内容。在 Ubuntu 默认的 GNOME Terminal 里粘贴,也是旧内容。

Root Cause

  1. 创建 TuiAltScreen 时没有传 copySelection,pi-tui 只能写一条裸 OSC52,然后无条件提示成功。OSC52 是一种转义序列,请终端代为写入剪贴板。tmux 默认会丢掉应用发出的 OSC52,GNOME Terminal 不支持 OSC52。
  2. Linux 上的 copyTextToClipboard 会先调用 @mariozechner/clipboard 的 setText。上游 pi 已经确认,这个调用在 Linux 上返回成功,但不持有 X11 选区,所以 /copy 在 Linux 上也可能报告成功、剪贴板却是空的。另外它用 spawnSync 调用 wl-copy 和 xclip。这两个工具会 fork 出后台进程来持有选区,同步等待它们有挂住事件循环的风险。

这是根本修复,不是绕过。全屏选区改走应用的剪贴板函数,剪贴板函数按上游 pi 的路径重新排序。

Code Changes

全屏选区不再交给 pi-tui 自带的 OSC52,而是通过 copySelection 注入应用的 copyTextToClipboard。剪贴板写入拆成两步。先由纯函数 planClipboardWrite(platform, env) 算出计划,再由执行器照计划写入。计划包括三件事:要不要用原生模块,按什么顺序试哪些写入命令,OSC52 是一定发、兜底发还是不发。

flowchart TD
    M[全屏松开鼠标,或有选区时按 Ctrl+C] --> S["copySelection(tui-state.ts 注入)"]
    C["/copy、复制 mermaid、复制恢复命令"] --> K
    S --> K[copyTextToClipboard]
    K --> P["planClipboardWrite(platform, env)"]
    P --> N{"macOS / Windows?"}
    N -- 是 --> NM["@mariozechner/clipboard"]
    NM -- 失败 --> CMD
    N -- 否 --> CMD["异步写入命令<br/>pbcopy / clip.exe / termux-clipboard-set / wl-copy / xclip / xsel"]
    NM -- 成功 --> O
    CMD --> O{"OSC52"}
    O -- "SSH / mosh,或 KIMI_CODE_CLIPBOARD_OSC52=1:一定发" --> OSC["发 OSC52<br/>tmux 里同时发裸序列和 DCS 透传"]
    O -- "没写成功,且没有显示、在 WSL 或 Termux 里:兜底发" --> OSC
    O -- 其余情况:不发 --> R
    OSC --> R["'native' → Copied!<br/>'osc52' → Copied via terminal<br/>抛错 → 显示原因"]
Loading

计划是纯函数,所以每种平台和环境组合的路径都能用一张表直接断言,执行器只剩下照做。返回类型 'native' | 'osc52' 没有变,/copy 等调用方不用改。

全屏模式下按 Ctrl+C 时,先看屏幕上有没有选区高亮:

flowchart TD
    A["Ctrl+C / Ctrl+Shift+C / Cmd+C"] --> B{有选区高亮?}
    B -- 否 --> E["照旧交给输入框或对话框<br/>中断、清空输入框、退出确认"]
    B -- 是 --> D["复制选区,清除高亮<br/>不管 copy_on_select 开没开"]
    D --> G[按键到此为止,同时取消待确认的退出]
Loading

关键决策:

决策 选择 没选 理由
macOS / Windows 的写入方式 继续用 @mariozechner/clipboard,失败时改用 pbcopy / clip.exe 换成上游 pi 自带的原生 helper 等 pi-tui 支持需要的能力后一起迁移,避免项目里同时混用两套剪贴板依赖
有显示、但没装剪贴板工具的 Linux 桌面 报错,提示该装哪个工具 用 OSC52 兜底,提示 Copied via terminal 和上游 pi 一致。GNOME Terminal 这类终端会忽略 OSC52,兜底会变成假成功。WSL 和 Termux 的终端支持 OSC52,所以仍然兜底
tmux 里的 OSC52 形式 同时发裸序列和 DCS 透传 只发其中一种 实测裸序列只在 set-clipboard on 时到达外层终端,DCS 透传只在 allow-passthrough on 时到达。两种都发,开任意一个设置都能用
OSC52 的长度上限 不设上限,和改动前一致 照搬上游 pi 的 100KB 上限 上游的上限来自 Ghostty 1.3.1 上的渲染错乱报告。实测 Ghostty 1.4.0 和 kitty 0.49.2 收 4MB 文本都正常,tmux 3.7c 到 1MiB(input-buffer-size 默认值)才丢弃,屏幕也不会乱
复制选区的快捷键 Ctrl+C,另外认 Ctrl+Shift+C 和 Cmd+C Ctrl+X Claude Code、Codex、OpenCode 关掉自动复制后都用 Ctrl+C 复制选区,没有产品用 Ctrl+X。kimi 的会话列表也把 Ctrl+X 用作删除
在哪一层拦截 界面层的输入监听,对话框打开时也生效 输入框的按键处理 选区高亮在屏幕上就该能复制,不管焦点在输入框还是审批面板
复制后的选区 清除高亮 保留高亮(OpenCode) kimi 里按键不会清除选区,Esc 也不清除。保留高亮的话,Ctrl+C 会一直停在复制上,没法中断或退出
copy_on_select 开着时按 Ctrl+C 再复制一次(Codex) 只清除高亮(Claude Code) 实测 Claude Code 的做法:选中后去别的软件复制,回来按 Ctrl+C,界面提示已复制,剪贴板里却还是别的软件的内容。再复制一次和提示一致,按键处理也只剩一条路径,不用关心 copy_on_select

其他改动:

  • 写入命令改成异步执行,只接 stdin,丢弃输出,5 秒超时。在 POSIX 上放进单独的会话,关闭终端时它不会被 SIGHUP 杀掉,剪贴板也就不会被清空。
  • 写入命令启动前先用 resolveCommandPath 解析成绝对路径,只在工作区里找到的同名程序不会被执行。全屏选区在工作区信任确认之前就可能被复制,所以这条路径要守住信任关卡之前不按裸命令名启动进程的规则。
  • Linux 上 Termux、Wayland、X11 三种后端的命令和缺工具时的报错放在同一张表里,计划和报错从同一份数据得出。
  • 新配置项 copy_on_select 默认是 true,只在全屏模式下生效,和 [transcript.group] 这类全屏配置一样不带前缀。全屏模式下 /settings 里多了一项 Copy on select,切换后立即生效,/reload 也会应用这个值。
  • Cmd+C 要靠终端通过 kitty 键盘协议把它转发给应用,所以只在部分终端里有效。
  • 只发 OSC52 时,"Copied via terminal" 走 pi-tui 的提示通道里显示字符串的那一支,会停留 5 秒,比 "Copied!" 久。

阅读顺序:

  1. apps/kimi-code/src/utils/clipboard/clipboard-text.ts。路径计划和执行器都在这里。
  2. apps/kimi-code/src/tui/tui-state.ts。copySelection 的注入,以及三种提示的来源。
  3. apps/kimi-code/src/tui/controllers/editor-keyboard.ts。Ctrl+C 怎么在界面层拦截选区复制。
  4. apps/kimi-code/src/utils/clipboard/clipboard-osc52.ts。tmux 里两种形式都发。

配置项的解析与写回、设置面板、/reload、文档和测试可以略读。

Screenshots / Recordings

全屏模式下打开 /settings,列表里多了 Copy on select(PR 分支实际运行,tmux 里抓屏):

  Settings
  ↑↓ navigate · ←→ page · Enter select · Esc cancel
   ❯ Model
     Switch the active model and thinking mode.
     ...
     Thinking folding
     Choose whether to fold finished thinking.
     Copy on select
     Choose whether selecting text in fullscreen mode copies it.
     Mermaid diagrams
     Draw mermaid code blocks as diagrams, or keep them as source.
  Page 1/2

选中这一项后的子面板。选 Off 后状态栏显示 Copy on select disabled.,tui.toml 写入 copy_on_select = false:

  Copy on select
  ↑↓ navigate · Enter select · Esc cancel
   ❯ On ← current
     Copy text as soon as you select it.
     Off
     Press Ctrl-C to copy selected text.

Behavior Changes and Affected Users

行为 改动前 改动后 谁依赖旧行为 退路
全屏松开鼠标后复制 写裸 OSC52,总是提示 Copied! 走应用剪贴板,按结果给出三种提示 依赖终端 OSC52 的 SSH 用户 远程会话仍会发 OSC52
Linux 上的 /copy、复制 mermaid、复制恢复命令 先用原生插件(可能假成功),再用 spawnSync 调 wl-copy / xclip 不再用原生插件,按 Wayland 会话(WAYLAND_DISPLAY 或 XDG_SESSION_TYPE=wayland)、DISPLAY、TERMUX_VERSION 异步选用 wl-copy / xclip / xsel / termux-clipboard-set 无 无需
有显示、但没装剪贴板工具的 Linux 桌面(不含 WSL) 用 OSC52 兜底,/copy 提示无法确认 报错,提示该装哪个工具 终端支持 OSC52(kitty、WezTerm 等)但没装工具的用户 KIMI_CODE_CLIPBOARD_OSC52=1
WSL(包括同时设置了 DISPLAY 和 WAYLAND_DISPLAY 的 WSLg)、Termux 上写入工具失败 用 OSC52 兜底 仍用 OSC52 兜底,提示 Copied via terminal 没装工具、靠 Windows Terminal 或 Termux 处理 OSC52 的用户 无需
本地 macOS / Windows 复制 每次先发 OSC52,再用原生方式写入 只用原生方式写入,失败时改用 pbcopy / clip.exe,不再发 OSC52 原生插件和系统命令都失败、只能靠 OSC52 的本地终端 KIMI_CODE_CLIPBOARD_OSC52=1
远程会话里复制 先发 OSC52 直接写入之后再发 OSC52 无 无需
tmux 里的 OSC52 /copy 只发 DCS 透传形式,全屏选区只发裸序列 两种都发 同时开了 set-clipboard on 和 allow-passthrough on 的用户,外层终端会收到两次相同内容 无需
全屏模式下屏幕上有选区高亮时按 Ctrl+C 交给输入框或对话框:中断、清空输入框、退出确认、关闭对话框 第一次按复制选区并清除高亮,按键不再往下传。第二次按照旧 拖选之后习惯直接按 Ctrl+C 中断或退出的全屏用户 再按一次 Ctrl+C;中断也可以直接按 Esc,Esc 不受影响。这是有意的设计,不提供配置项
regular 模式下按 Ctrl+C 中断、清空输入框、退出确认 不变。拦截只在全屏渲染器上注册 无 无需
全屏模式下有选区时按 Ctrl+Shift+C 或 Cmd+C 交给输入框,没有绑定 同上,复制选区并清除高亮 无 无需
tui.toml 没有这个键 写入 copy_on_select = true 降级到旧版本的用户:旧版本会忽略这个键,保存设置时会把它丢掉 无需

全屏模式下 Ctrl+C 那一行没有配置项退路。维护者(本 PR 作者)确认这是预期行为。

测试覆盖:

  • 路径计划和执行器的测试在 test/utils/clipboard/clipboard-text.test.ts。计划表覆盖 macOS、Windows、X11、Wayland(包括只设了 XDG_SESSION_TYPE 的会话)、无显示、WSLg、Termux、SSH、mosh,以及 KIMI_CODE_CLIPBOARD_OSC52。执行器部分覆盖 Linux 跳过原生插件、远程会话额外发 OSC52、无显示和 WSLg 下回退到 OSC52、有显示没工具时报错、长文本不设上限、写入命令按绝对路径启动、工作区里的同名程序不会被执行,以及 tmux 里两种形式都发。
  • 全屏拖选的三种提示在 test/tui/fullscreen-layout.test.ts。
  • 配置的解析、默认值和写回在 test/tui/config.test.ts。设置面板只在全屏模式下显示、保存后立即生效,在 test/tui/commands/transcript-preferences.test.ts。
  • Ctrl+C 的测试在 test/tui/controllers/editor-keyboard.test.ts,用真实的 TuiAltScreen 驱动选区。覆盖四种按键编码、复制后清除高亮并吞掉按键、copy_on_select 开着时再复制一次、忽略按键抬起事件、取消待确认的退出、regular 模式下照常放行,以及控制器销毁后不再拦截。
  • Ubuntu(X11 / Wayland)、WSL 和 Cmd+C 在真实终端里的转发还没有实机验证。
验证记录
  • 在 macOS 的 tmux 3.7c 里实际运行 kimi,模拟 SGR 鼠标拖选。改动前提示 Copied!,剪贴板没变。改动后剪贴板就是选中的文字。
  • 同一环境下,关掉 copy_on_select 后,松开鼠标不复制,按 Ctrl+C 复制并提示 Copied!,再按一次 Ctrl+C 出现退出确认。开着 copy_on_select 时,松开鼠标就复制。之后往剪贴板写入别的内容,按 Ctrl+C 会重新写入选中的文字,再按一次出现退出确认。
  • regular 模式下实际运行,Ctrl+C 照旧先清空草稿并出现退出确认,再按一次退出。
  • 在挂了客户端 pty 的 tmux 里实测:裸 OSC52 只在 set-clipboard on 时到达外层终端,DCS 透传形式只在 allow-passthrough on 时到达,默认配置下两种都到不了。两种一起发时,开任意一个设置都能到达。
  • OSC52 长度实测:发送后查询光标位置,确认序列没有漏成屏幕上的文字,再读 pbpaste。kitty 0.49.2 和 Ghostty 1.4.0 收 6 万到 400 万字符的文本都完整进入剪贴板。kitty 里的 tmux 3.7c 收 15 万字符正常,100 万字符被丢弃,剪贴板不变,屏幕正常。
  • 一个 fork 出后台进程的写入命令,不加 detached 时会在终端关闭后被杀掉,加了以后能活下来。
  • 去掉 WSL 和 Termux 的兜底条件后,对应的 3 个测试会失败。分别去掉 Ctrl+C 路径里的清除高亮、取消退出确认和忽略抬起事件,各自的测试也会失败。
  • 每个提交单独通过类型检查,以及 test/tui 和 test/utils/clipboard 的测试。
  • apps/kimi-code 完整测试套件:4796 个通过,2 个失败。失败都在 test/scripts/native/release-artifacts.test.ts,在 base commit 上同样失败。

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.

The native clipboard module reports success on Linux without holding the
X11 selection, so copies landed nowhere. Linux now writes through
termux-clipboard-set, wl-copy, xclip or xsel, and every platform plans its
route from the platform and environment: remote sessions (SSH, mosh, or
KIMI_CODE_CLIPBOARD_OSC52=1) always emit OSC 52 after the direct write;
without a display, under WSL, or in Termux, OSC 52 backs up a failed
write; and any other desktop reports which tool to install instead of
trusting OSC 52. Clipboard commands run asynchronously from / with no
output pipes and a 5 second timeout.
Fullscreen selections were copied with a bare OSC 52 sequence, which tmux
drops by default and GNOME Terminal ignores, while the renderer still
flashed "Copied!". Selections now go through the same clipboard path as
/copy: a verified write flashes "Copied!", an OSC 52-only copy flashes
"Copied via terminal", and a failure flashes the error.
Releasing a mouse selection in fullscreen copies it right away. The new
copy_on_select key in tui.toml (default true) and the "Copy on select"
entry in /settings, shown only in fullscreen, let users keep the selection
highlighted instead. Changes from /settings and /reload apply to the
running fullscreen view, and saving any other preference keeps the choice.
In fullscreen, Ctrl+C, Ctrl+Shift+C, or Cmd+C copies a highlighted
selection and clears it, whichever dialog has focus and whether or not
copy on select already copied it, so the next Ctrl+C interrupts or clears
the input as before. A copy also cancels a pending Ctrl+C exit.
tmux forwards the bare sequence only with set-clipboard on and the DCS passthrough form only with allow-passthrough on, so send both. The env var docs now name the tmux settings.
Copilot AI balanced review requested due to automatic review settings November 9, 2026 08:59
@changeset-bot

changeset-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e33a2d5

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 9, 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-09T12:29:46.484084Z e33a2d5 New commits
ℹ️ 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 9, 2026 •

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

commit: e33a2d5

@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: 093b4792d8

ℹ️ 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".

Copilot AI 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.

🟡 Changes recommended

Clipboard copying can execute untrusted workspace binaries during the trust prompt, and copy-key handling can trigger interrupts or leave stale double-Esc state.

3 open issues
What changed in this PR

此 PR 将全屏选区复制接入 CLI 共用的剪贴板路径,改善 tmux 和 Linux 下提示成功但未实际复制的问题,并增加可配置的选区复制行为。

Changes:

  • 按平台和环境选择原生剪贴板、异步命令及 OSC 52,区分复制成功、终端转交和失败提示。
  • 新增 copy_on_select 设置及全屏选区复制快捷键,支持即时设置和 /reload。
  • 补充剪贴板、键盘交互和配置测试,以及中英文文档和发布说明。
File Description
docs/​zh/​reference/​keyboard.md 说明全屏选区复制快捷键。
docs/​zh/​configuration/​env-vars.md 说明 OSC 52 开关与远程环境检测。
docs/​zh/​configuration/​config-files.md 记录 copy_on_select 配置。
docs/​en/​reference/​keyboard.md 同步英文快捷键说明。
docs/​en/​configuration/​env-vars.md 同步英文剪贴板环境变量说明。
docs/​en/​configuration/​config-files.md 同步英文选区复制配置说明。
apps/​kimi-code/​test/​utils/​clipboard/​clipboard-text.test.ts 覆盖平台计划、后备路径及 tmux 序列。
apps/​kimi-code/​test/​tui/​fullscreen-layout.test.ts 验证选区复制调用和结果提示。
apps/​kimi-code/​test/​tui/​create-tui-state.test.ts 验证启动时应用复制设置。
apps/​kimi-code/​test/​tui/​controllers/​editor-keyboard.test.ts 覆盖复制快捷键、清除选区和事件消费。
apps/​kimi-code/​test/​tui/​config.test.ts 验证配置默认值及读写往返。
apps/​kimi-code/​test/​tui/​components/​dialogs/​mermaid-preference-selector.test.ts 验证设置项可见性和选项映射。
apps/​kimi-code/​test/​tui/​commands/​update-preferences.test.ts 验证保存其他偏好时保留复制设置。
apps/​kimi-code/​test/​tui/​commands/​transcript-preferences.test.ts 验证设置保存、即时生效及失败处理。
apps/​kimi-code/​src/​utils/​clipboard/​clipboard-text.ts 引入复制计划和异步命令执行。
apps/​kimi-code/​src/​utils/​clipboard/​clipboard-osc52.ts tmux 中同时发送裸序列和透传序列。
apps/​kimi-code/​src/​tui/​types.ts 增加选区复制状态字段。
apps/​kimi-code/​src/​tui/​tui-state.ts 注入共用复制函数和结果提示。
apps/​kimi-code/​src/​tui/​kimi-tui.ts 将复制配置传入初始状态。
apps/​kimi-code/​src/​tui/​controllers/​editor-keyboard.ts 在全屏选区存在时拦截复制快捷键。
apps/​kimi-code/​src/​tui/​config.ts 解析、默认化并保存复制配置。
apps/​kimi-code/​src/​tui/​components/​dialogs/​settings-selector.ts 添加全屏 Copy on select 设置面板。
apps/​kimi-code/​src/​tui/​commands/​reload.ts 重载时更新实时复制行为。
apps/​kimi-code/​src/​tui/​commands/​config.ts 连接设置选择、持久化和实时更新。
.changeset/​fullscreen-ctrl-c-copy.md 记录全屏 Ctrl+C 行为变化。
.changeset/​fullscreen-copy-on-select.md 记录新增选区复制设置。
.changeset/​fullscreen-copy-clipboard.md 记录剪贴板复制修复。
.changeset/​clipboard-osc52-scope.md 记录 OSC 52 使用范围及强制开关。

Review effort: Balanced

A fullscreen selection can be copied while the workspace trust prompt is
still open, so clipboard writers are now resolved with resolveCommandPath
and a writer found only inside the workspace is never run. Wayland
sessions that set XDG_SESSION_TYPE=wayland without WAYLAND_DISPLAY try
wl-copy again, as before this branch.
@Grapedge

Grapedge commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Kitty terminals report Ctrl+C with Caps Lock as an uppercase codepoint, so the copy key fell through to the editor and interrupted instead. The consumed copy key also skipped the editor's non-Escape hook, which let Esc, copy, Esc open the undo selector.

@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: 53ff65e4f4

ℹ️ 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".

process.cwd() returns the physical path, so a PATH entry that reached the workspace through a symlinked alias passed the containment check and the planted command could run before trust was granted.
In SSH, mosh, or with KIMI_CODE_CLIPBOARD_OSC52=1 the terminal copy waited for every system clipboard attempt, so a slow or stuck writer delayed it.
@Grapedge

Grapedge commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@Grapedge

Grapedge commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: e1519af8db

ℹ️ 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".

Under the kitty protocol a held Ctrl-C sends repeat events. After the press copied and cleared the selection, those repeats reached the editor as Ctrl-C and interrupted the stream or armed exit.

@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

const rel = relative(resolvedCwd, resolvedCandidate);
return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel);

P1 Badge Reject cwd children whose names start with two dots

When PATH contains a workspace child such as $PWD/..bin, relative() returns ..bin/wl-copy, so this prefix check classifies the executable as outside the workspace and allows a fullscreen selection made before the trust prompt to spawn the planted helper. Check for the parent path components .. and ../ (using the platform separator), rather than rejecting every relative path beginning with two dots.

AGENTS.md reference: apps/kimi-code/AGENTS.md:L68-L68

ℹ️ 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".

@Grapedge

Grapedge commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: f71666be11

ℹ️ 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 previously approved these changes Nov 9, 2026
# Conflicts:
#	apps/kimi-code/src/tui/commands/config.ts
#	apps/kimi-code/src/tui/components/dialogs/settings-selector.ts
#	apps/kimi-code/test/tui/components/dialogs/mermaid-preference-selector.test.ts
@Grapedge
Grapedge merged commit 322d036 into main Nov 9, 2026
16 checks passed
@Grapedge
Grapedge deleted the fullscreen-clipboard branch November 9, 2026 12:33
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 15, 2026
…on Linux

Port upstream MoonshotAI#4755.

- Rewrite the clipboard writer around planClipboardWrite: Termux, Wayland and
  X11 backends, no native module on Linux, OSC 52 forced for SSH/mosh or
  KIMI_CODE_CLIPBOARD_OSC52=1, and an OSC 52 fallback only where the terminal
  honors it.
- Spawn writers with Bun.spawn: no stdout/stderr pipes, POSIX detached session,
  5s SIGKILL timeout, and an absolute executable path that refuses anything
  reachable inside the workspace (symlink-aware physical comparison).
- Send both the bare OSC 52 sequence and the tmux DCS passthrough so
  set-clipboard on and allow-passthrough on both reach the outer terminal.
- Add the copy_on_select setting with a /settings picker, tui.toml persistence
  and /reload support; Ctrl-C, Ctrl-Shift-C and Cmd-C copy an active fullscreen
  selection, clear it, and swallow auto-repeat so holding the key cannot
  interrupt the turn.
- Extend pi-tui's copySelection to return a failure hint string and add
  resetTextSelection; localize the new copy, update both docs and add four
  changesets.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 15, 2026
…hotAI#4755 evidence

MoonshotAI#4618 is configured through [transcript].tool_call_density and [transcript].thinking, not a [transcript.group] table. The MoonshotAI#4618 probe limitation and the four-file hang noted on MoonshotAI#4755 were fixed in 580b5b5 and 4d88e05. MoonshotAI#4730 was recorded as no longer reconstructing step ids, which the step.begin case still does; the real gap was the live context-memory fold dropping the recorded content-part timing, now fixed in 008fb38. Verdicts are unchanged.
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