Skip to content

test(e2e): run the TUI with the Kitty keyboard protocol, ACP with a bare editor, and Chinese prompts - #5399

Closed
RealKai42 wants to merge 4 commits into
test/e2e-session-verbsfrom
test/e2e-profiles
Closed

RealKai42 wants to merge 4 commits into
test/e2e-session-verbsfrom
test/e2e-profiles

Conversation

@RealKai42

@RealKai42 RealKai42 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

新 E2E 的 TUI 只测到一种终端(不支持 Kitty 键盘协议的老式终端),ACP 只测到一种编辑器(声明了 fs 和终端能力的),提示词也只能是 ASCII。用户那边:Ghostty、Kitty、WezTerm、新版 iTerm2 都走 Kitty 键盘协议;不少编辑器不声明终端能力,产品要自己跑命令;中文用户用中文提问。这个 PR 补上这三种情形。

基于 MoonshotAI/kimi-code#5398,这个 PR 的 base 是它的分支 test/e2e-session-verbs。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

核心思路:同一套场景和自测多跑两种「跑法」,各是一个 Playwright project;驱动按跑法扮演不同的终端或编辑器。

跑法 驱动扮演什么 怎么证明不是空跑
tui-kitty 支持 Kitty 键盘协议的终端:跟踪 CLI 写的推入、弹出、设置序列,回答查询;协议开着时 Esc 和 Ctrl+C/O/Q/S 按 Kitty 编码发送,要求松开事件时这几个键和方向键另发松开事件 启动后 CLI 必须开着协议、没有退回 modifyOtherKeys;退出后协议必须关掉。破坏性检查:不回答查询时启动失败,Ctrl+S 编错时插话的正例变红
acp-bare 不声明 fs 和终端的编辑器,也不处理这些请求 产品调用了就在收尾时报「调用了编辑器没实现的方法」

其他:

改动 说明
exceptVariants 场景在某个跑法下不适用时写明理由
中文 send、queue、steer 接受任意单行文字;新场景「中文提问和回复」(四个面)、「窄窗口里中文折行」(TUI、Web)
运行摘要 从 Playwright 配置读出每个 project 的面和跑法,例如「TUI(终端支持 Kitty 键盘协议)」
CI TUI 作业同时跑 tui 和 tui-kitty,ACP 作业同时跑 acp 和 acp-bare

负责人已同意先排除(2026-11-25):acp-bare 下有 3 条「命令运行中的输出」相关的用例红:编辑器不提供终端时,产品要等命令结束才给出输出,用户看不到长命令的进度。ACP 协议允许在运行中更新工具调用的内容,所以这是产品缺口,不是协议做不到。这个 PR 用 exceptVariants 排除这 3 条,理由开头写明 Product gap;产品修好之后去掉排除。

关键决策:

决策 选择 没选 理由
怎么测 Kitty 协议 驱动在 xterm.js 前面扮演支持协议的终端 换一个支持协议的无头终端 xterm.js 5.5 不支持这个协议;协议的编码规则是公开、固定的,驱动的模拟有自测和破坏性检查兜底
跑法的组织 每种跑法一个 project,跑同一套用例 写专门的场景 键盘协议和编辑器能力影响的是所有场景走的路径

Behavior Changes and Affected Users

产品代码没有改动,受影响的是写和跑新 E2E 的人,以及 CI。

Behavior Before After Who relies on the old behavior Escape hatch
提示词 只能是可打印 ASCII 任意不含控制字符的单行文字 无 无
CI 上的 TUI、ACP 作业 各跑一个 project 各跑两个 等 CI 的人 无

验证结论:两种跑法下现有的场景和自测全部再跑了一遍;Kitty 跑法的启动检查和按键编码做过破坏性检查。

验证细节

本机 macOS arm64,构建产物,这个 PR 的头上:

project 通过 不适用
tui + tui-kitty + acp + acp-bare 643(其中两个 ACP project 在最后的头上又跑了一遍:289) 99
web 178 8
desktop 172 14

破坏性检查:

改坏 结果
不回答 Kitty 协议的查询 启动检查报「CLI 退回了 modifyOtherKeys」
Ctrl+S 的 Kitty 编码写错 插话的正例变红

acp-bare 第一次全套:140 条过,3 条红都是「命令运行中的输出」:编辑器不提供终端时产品要等命令结束才给出输出。这 3 条按上面说的先排除,负责人已同意。

评审:只读 agent 报了 1 条 P1,就是这 3 条的理由写成了协议做不到,已改成如实写产品缺口;P2:方向键补了松开事件,CLI 要了不模拟的标志位、多弹出一层都报错。干净 worktree 里 pnpm lint 以 0 退出,pnpm run check:duplication 3ce987582 没有新增重复。

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.

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9a8999f

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 25, 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-25T11:45:16.806104Z 7449a28 New commits
🔒 Security Review ✅ Completed 2026-11-25T07:38:35.572419Z b5b1917 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 25, 2026 •

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

commit: 7449a28

…editor, and allow Chinese prompts

Two more ways to run the existing scenarios and self-tests, each its own
Playwright project:

- tui-kitty: the driver plays a terminal that supports the Kitty keyboard
  protocol. It follows the protocol sequences the CLI writes, answers the
  flags query, and sends Esc and the Ctrl keys in Kitty encoding with
  release events when asked. Start-up fails if the CLI does not use the
  protocol or falls back to modifyOtherKeys, and expectTerminalRestored()
  requires the protocol to be off again after the CLI exits.
- acp-bare: the editor declares no fs or terminal capability and handles
  no such requests. The product reads, writes and runs commands itself;
  a command's output is read from the tool call text. The three cases about
  a running command's output are not applicable there, since the agent
  only reports the output once the command ends.

Scenarios can leave a variant out with exceptVariants. The run summary
names variant projects from the Playwright config. send(), queue() and
steer() accept any single line of printable text, and two scenarios cover
a Chinese prompt and reply, including wrapping in a narrow window.
- The three running-output cases left out of acp-bare now say they are a
  product gap awaiting the owner's decision; the guide allows such an
  exclusion only for a recorded gap the owner agrees to.
- The Kitty terminal also sends release events for the arrow keys when
  asked, and fails when the CLI asks for flags it does not emulate or pops
  more levels than it pushed.

@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: 9a8999fc81

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

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/e2e/surfaces/acp.ts

private missingEditorEvidence(tool: ToolView, expectation: ToolExpectation): string | undefined {
if (expectation.status === 'rejected' || this.replayedTurn()) return undefined;
if (expectation.status === 'rejected' || this.replayedTurn() || this.bare) return undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve question-response evidence in bare-editor mode

In acp-bare, this early return also bypasses the AskUserQuestion check below, although the bare editor still implements session/request_permission. Consequently, expectTool({ name: 'AskUserQuestion', ..., status: 'done' }) accepts a completed tool notification even if the editor never answered that question, masking regressions in the question flow. Only filesystem and terminal evidence should be waived for missing editor capabilities; keep the question-response check active in both ACP variants, as required by the documented expectTool contract.

AGENTS.md reference: tests/e2e/AGENTS.md:L95-L95

Useful? React with 👍 / 👎.

@RealKai42
RealKai42 added this pull request to stack #5419 November 25, 2026 11:34
@RealKai42

Copy link
Copy Markdown
Collaborator Author

已并入 #5423:叠着的四个 PR 合成一个,避免 squash 合并后每个都要再解一次冲突。改动不变,请在 #5423 继续评审。

@RealKai42 RealKai42 closed this Nov 25, 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