Skip to content

fix(tui): track steer read state across turns - #4627

Merged
Grapedge merged 11 commits into
mainfrom
steer-unread
Nov 3, 2026
Merged

Grapedge merged 11 commits into
mainfrom
steer-unread

Conversation

@Grapedge

@Grapedge Grapedge commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

终端 steer 目前主要靠消息正文识别 turn.steer。取消后转入后续轮次、goal continuation 的普通队列、相同正文、多客户端、skill/媒体转换,以及 drain 后立即取消时,确认可能缺失或配错,表现为消息误恢复或永久淡化。

这个 PR 让终端使用 core 已有的 promptId 追踪投递,直到 core 真正消费消息才恢复实色,并补齐 blocked、失败和 reload 的退出路径。无独立关联 issue。

Bug Reproduction Steps

  1. 在运行中的轮次按 Ctrl-S 提交 steer,在 core 消费前取消。旧实现会在 turn.ended 清空待确认记录,却不恢复消息上的淡化标记;后续 turn.prompt 也不会被识别。
  2. 对没有 tracked active prompt 的 continuation 提交 steer。core 只把消息放进普通队列,旧 SDK 返回 void,终端一直等待不会到来的 turn.steer。
  3. 让另一个客户端注入相同正文,或让注入后的正文经过转换。旧文本匹配可能确认错误消息,或漏掉正确消息。
  4. 在一个 step 完成后、下一次 gate 前取消。core 已从通知队列取出消息,但旧 settle 路径没有 mirror,因而没有 turn.steer 确认。

上述路径均已固化成回归测试;真实终端另用本地 provider 验证了正常 steer 的淡化与恢复。

Root Cause

根因有三层,属于根本性修复而不是增加延迟或隐藏错误:

  • core 已生成 promptId,但 Session.steer() / promptWithSkills() 把身份和提交状态丢成了 void,终端只能用正文关联。
  • 终端把 turn.steer 当唯一已读事件,并在 turn.ended 清空关联记录;后续新轮和普通队列没有确认出口。
  • core 在取消抢先于下一次 gate 时,没有对已 drain 的 nudge 做最后的 mirror,导致上下文与事件确认不一致。

Code Changes

**核心思路:**复用 core 已生成的 id,不新增客户端 id 协议。提交结果告诉终端该等当前轮注入还是自己的新轮;事件里的 id 决定何时恢复实色。正文仅用于无 id 事件和 seeded 合并消息的兼容回退。

概念 回答的问题 本 PR 之后
promptId 这是哪一次提交 core 生成,经 klient / SDK 返回给 TUI;不依赖正文
state 提交去了哪里 running / queued / blocked 保持原含义
steered 是否已并入当前 tracked turn true 等 turn.steer;false 且 queued 等自己的新轮
早到的消费 id 事件先于 RPC 返回怎么办 暂存 id,提交结果返回后核销,避免晚到结果重新淡化
flowchart TD
    A[提交 steer] --> B{core 返回状态}
    B -->|steered| C[等待 turn.steer.promptIds]
    B -->|queued| D[等待 turn.prompt / turn.started 的 promptId]
    B -->|普通新轮| E[按普通 prompt 显示]
    B -->|blocked / error / reload| F[释放本地未读状态]
    C --> G[恢复实色]
    D --> G
    H[消费事件先到] --> I[按 id 暂存并在 RPC 返回后核销]
    I --> G
Loading

正常 tracked turn 仍走原来的 turn.steer,只是主匹配键从正文换成 id。turn.ended 不再清空关联;直接开启普通新轮仍保持实色。公开 Event 联合没有增加成员,TUI 使用严格运行时守卫,因此 SDK 使用者的穷尽 switch 不需要新增分支。

queued 提交在后续 prompt gate 被 rejected 时,复用 prompt.completed(blocked|failed) 按 id 释放本地未读状态;failed 现在也通过 SDK mapper,成功完成的 prompt.completed(completed) 仍不透传。blocked 的 turn finalize 行为保持不变。

关键决策:

决策 选择 没选 理由
身份从哪来 透出 core 已有 promptId 和提交状态 客户端预生成并传入 id 覆盖普通与 skill steer,且能区分 accepted / queued / 普通新轮
跨轮怎么确认 复用 turn.prompt / turn.started 给新 turn 补发 turn.steer 避免把新轮 opening prompt 错投成当前轮 steer 帧
公开事件类型 保持 Event 联合不变,TUI 做严格守卫 向联合添加两个事件 不破坏 SDK 使用者的穷尽分支;运行时转发行为原本就存在
drain 后取消 在确定结束的 settle 分支补 mirror 新增确认 RPC 或在所有结束路径无条件 mirror 保留 live-nudge continuation 和 seeded 新轮语义,上下文只写一次
klient 兼容性 steered 输出字段可选,SDK 映射为布尔值 要求旧服务端也返回该字段 新客户端仍能读取旧的 promptWithSkills 结果

阅读指南:

  1. packages/agent-core-v2/src/agent/loop/promptChannel.ts:普通 steer 的 id、queued / blocked / running 与 steered 返回逻辑。
  2. packages/agent-core-v2/src/features/skill/skillService.ts:skill steer 使用同一提交语义。
  3. packages/node-sdk/src/session.ts 与 sdk-rpc-client-v2.ts:SDK 的 PromptSubmissionResult 和 snake_case → camelCase 映射。
  4. apps/kimi-code/src/tui/kimi-tui.ts:pending 记录、早到 id、跨轮确认与失败 / reload 收尾。
  5. apps/kimi-code/src/tui/controllers/session-event-handler.ts:当前轮和后续轮事件入口。
  6. packages/agent-core-v2/src/agent/loop/loopService.ts:仅在确定结束的 settle 分支补 mirror,不影响正常 continuation。

klient contract、facade、事件转发、测试和双语用户文档主要是接线和回归覆盖,可以略读。

Screenshots / Recordings

以下快照来自本 PR 分支的真实 CLI:本地 provider 保持第一轮请求时提交 Ctrl-S,再释放响应。图片只从终端 ANSI 快照渲染同一条中性示例消息,不包含工作区路径、会话 id 或凭据;左侧原始输出包含 ESC[2m,右侧不包含。

等待 core 消费 core 消费后
steer 未读淡化 steer 已读恢复

请求日志同时确认第二次模型调用包含 focus on tests,且只出现一次。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
运行中 steer 的文字外观 立即实色;本分支早前版本按正文等 turn.steer 按 promptId 等到 core 注入后恢复实色 终端 Ctrl-S、WaitFor、goal / tower steer 用户 无。旧的立即实色不再提供
取消后转入后续轮次的 steer turn.ended 清掉关联,可能永久淡化 跨轮保留,直到自己的 turn.prompt / turn.started 确认 在 steer 消费前取消当前轮的终端用户 无;这是修复永久未读,而不是新配置
goal continuation 等普通队列 steer SDK 无身份,终端盲等 turn.steer 返回 queued id,等新轮开始确认 goal / untracked active prompt 用户 无;旧行为没有可用的已读确认
相同正文或转换后的 steer 按正文配对,可能误确认或漏配 id 为主;仅无 id / seeded 合并消息回退正文 多客户端、重复输入、skill / 媒体输入用户 无;旧文本主匹配不再作为可靠身份
blocked、投递失败、reload 可能留下无法确认的淡化文字 恢复实色并走原有错误或 reload 流程 prompt hook、失败重试、切换 / reload 会话用户 无;失败不被冒充成已读
queued 后在 prompt gate 被 rejected RPC 已返回 queued,之后没有新轮事件;blocked 只 finalize,failed 被 mapper 丢弃,消息永久淡化 `prompt.completed(blocked failed)` 按 promptId 释放;completed 仍不透传 goal / untracked queued 提交被 hook blocked 或 gate failed 的终端用户
直接开启普通新轮的 steer 实色 仍为实色 idle 状态提交 steer 的终端用户 无变化
Session.steer() 返回值 Promise<void>;untracked queued 也无可观察身份 返回 PromptSubmissionResult,含 promptId / state / steered 忽略返回值的 SDK / ACP / VS Code 调用方不受影响;显式断言结果为 undefined 的外部脚本会观察到新对象 忽略返回值即可保持原流程;需要队列语义时读取 state
Session.promptWithSkills() 返回值 Promise<void> 返回同一提交结果;skill steer 也带 id 同上;desktop / web 的 REST submit → steer 两段流程未改 忽略返回值即可;旧 klient 输出缺少 steered 时仍可读
turn.prompt / turn.steer 事件联合 运行时转发,但公开联合未包含 运行时和公开联合均保持原样;仅 TUI 内部守卫使用 对 Event 做穷尽 switch 的 TypeScript 用户 不需要新增分支,无变化
drain 后提前结束 已出队消息可能没有 turn.steer 仅在确定结束的 settle 分支补一次 mirror / 事件;正常 continuation 与 seeded 新轮不变 取消、失败、max-steps 等边界的事件 / transcript 消费方 无;修复缺失确认,未新增协议
旧会话、配置、环境变量、prompt 文本 原有行为 无迁移、无配置或 prompt 文本修改 旧数据、ACP / SDK、desktop / web、print 模式 无变化

对应覆盖:core prompt queue 测 accepted、untracked queued、blocked、drain-cancel 和 seeded 新轮;skill 测试测 accepted / queued;klient 测试保留旧输出兼容;SDK 测试测返回值映射、事件 id 转发和 blocked / failed 透传;TUI 测试测真实 ANSI 外观、错误 id、同文本、跨轮、goal queued、提交时 blocked、queued 后 rejected 和 reload。

验证命令与结果
  • core prompt / skill:45 tests passed。
  • TUI 完整相关回归:470 tests passed。
  • SDK 相关与 v2 集成:34 tests passed;事件兼容最终 15 tests passed。
  • klient facade:32 tests passed。
  • core、klient、SDK、CLI、kap-server typecheck:全部通过。
  • pnpm lint:0 errors(仓库现有 warnings)。
  • 文档 VitePress build:通过。
  • 真实 CLI + 本地 OpenAI 兼容 provider:等待时含 dim SGR,core 消费后消失;第二次请求中的 steer 恰好一次。
  • 真实 tmux + goal continuation + 本地 provider + exit 2 UserPromptSubmit hook 做 A/B:修复前 f2db5f9c2 在 queued 后被真实 hook 拒绝,消息行仍为 ESC[1;2m;当前修复版本恢复为 ESC[1m。两次均保存了 provider 请求、hook 调用和 ANSI 屏幕证据。blocked 为真实运行复现;failed 由 SDK mapper 与 TUI 回归覆盖,不将其表述为真实运行复现。
  • 针对 rejection-before-RPC 评论,另在相同真实环境交替执行 steer-first / release-first 6 轮:6/6 均为 rpc.result(queued) 先于 prompt.completed(blocked)(约 44–74ms),最终消息行均无 dim,未复现该竞态,因此未增加 rejected-id buffer。
  • 未运行 desktop / web E2E;其 REST 提交路径未修改。

Checklist

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

A steer message stays faint until turn.steer matches its text. A rejected steer returns to solid text and keeps the error.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 18:23
@changeset-bot

changeset-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0b816e2

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 2, 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-03T07:25:16.168889Z 0b816e2 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 2, 2026 •

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

commit: 0b816e2

@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: 27e2ca9685

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

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved

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

Steer acknowledgment matching can consume stale entries and fail for image-only or augmented/merged inputs, leaving accepted messages and summaries incorrectly dimmed.

3 open issues
What changed in this PR

本 PR 为终端中注入当前轮次的消息增加待接收状态:文字先显示为淡色,收到 turn.steer 确认或发送失败后恢复实色,帮助用户区分提交与接收。

Changes:

  • 跟踪 steer 提交,并根据确认事件更新消息状态。
  • 为用户消息正文和吸顶摘要应用淡色效果,不改变图片显示。
  • 增加匹配、渲染及失败恢复测试,同步中英文文档和 changeset。
File Description
docs/​zh/​reference/​tools.md 补充等待期间注入文字的淡色说明。
docs/​zh/​reference/​keyboard.md 说明 Ctrl-S 消息接收前的显示状态。
docs/​en/​reference/​tools.md 同步英文工具行为说明。
docs/​en/​reference/​keyboard.md 同步英文快捷键说明。
apps/​kimi-code/​test/​tui/​utils/​steer-input.test.ts 增加确认文本匹配测试。
apps/​kimi-code/​test/​tui/​kimi-tui-message-flow.test.ts 覆盖 Ctrl-S 确认及失败后的显示恢复。
apps/​kimi-code/​test/​tui/​components/​messages/​sticky-user-message.test.ts 验证吸顶摘要的淡色状态。
apps/​kimi-code/​src/​tui/​utils/​steer-delivery.ts 新增文本提取与待确认批次匹配逻辑。
apps/​kimi-code/​src/​tui/​types.ts 为消息条目增加待接收标记。
apps/​kimi-code/​src/​tui/​kimi-tui.ts 管理提交跟踪、确认和失败恢复。
apps/​kimi-code/​src/​tui/​controllers/​session-event-handler.ts 转交 turn.steer 确认事件。
apps/​kimi-code/​src/​tui/​components/​messages/​user-message.ts 根据待接收状态渲染淡色文字。
apps/​kimi-code/​src/​tui/​components/​messages/​sticky-user-message.ts 让吸顶摘要同步消息的淡色状态。
.changeset/​fade-steer-until-accepted.md 记录用户可见的显示行为变化。

Review effort: Balanced

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved
Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved

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

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

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved
Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved

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

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

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved

@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: 787dfd16c1

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

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved
Comment thread .changeset/fade-steer-until-accepted.md Resolved

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

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

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved

@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: 8f862bea04

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

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved
@Grapedge Grapedge changed the title feat(tui): fade steer text until the turn accepts it fix(tui): track steer read state across turns Nov 3, 2026

@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: 0b816e2fe7

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

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved
@Grapedge
Grapedge merged commit a5724dd into main Nov 3, 2026
18 checks passed
@Grapedge
Grapedge deleted the steer-unread branch November 3, 2026 09:04
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
…ng turn

First slice of upstream MoonshotAI/kimi-code a5724dd (MoonshotAI#4627): the engine
now tells the caller what happened to a steer instead of returning undefined.

IAgentPromptChannel.submitSteer returns SteerResult: prompt id, creation time,
state (running / queued / blocked) and a steered flag that is true only when the
prompt was accepted into the turn that was already running. A steer submitted
while the loop is running-but-not-steerable, paused, or has a queue returns
'queued' immediately instead of blocking; a blocked handle returns 'blocked';
the promptWithSkills result carries the same optional steered flag.

evaluateSettle now mirrors drained nudges when the turn ends without a current
step, so a consumed steer is projected even when the turn is cancelled,
filtered, step-capped, stopped, failed, or completed between steps.

Local note: this fork's promptWithSkills already had the queued/blocked result
states; only the steered flag was missing there.

Verified: engine/app/kap-server typechecks clean; prompt, loop and skill suites
304 pass (8 snapshots). The SDK and TUI halves of MoonshotAI#4627 follow in the next
commit; the ledger row stays in_progress until they land.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Port of upstream MoonshotAI/kimi-code a5724dd (MoonshotAI#4627). A steer was
rendered at full intensity the moment it was submitted, so a user could
not tell whether the agent had actually picked it up — and a steer that an
interrupted turn carried into the next turn looked delivered long before
the new turn started.

Engine: `IAgentPromptChannel.submitSteer` and
`IAgentSkillService.promptWithSkills` resolve with `SteerResult` — the
submission's `prompt_id`, `created_at`, `state` (`running` / `queued` /
`blocked`) and `steered`, which is true only when the running turn took the
text. `evaluateSettle` mirrors drained nudges back onto the turn so a
consumed steer is reported once.

Wire: `steerResultSchema` replaces the `maybe(promptLaunchResultSchema)`
output of `agentPromptService.submitSteer`, and the SDK maps it to
`PromptSubmissionResult`.

TUI: `SteerDelivery` keeps each submitted batch faded
(`currentTheme.fade`) until its prompt id comes back on `turn.steer`,
`turn.prompt`, `turn.started` or `prompt.completed`, or the text matches the
legacy `turn.steer` payload for engines that carry no ids. Matching is
boundary-aware, so a short steer cannot be confirmed by a substring of a
different message, and the prompt-id path keeps a stale id from stealing a
later submission of the same text.

Local-form notes:
- `KimiTUI` has no `dispatchPreparedInput`: message dispatch lives in
  `MessageDispatchController`, so the state machine sits there and
  `KimiTUI` only exposes the four `SessionEventHost` hooks.
- The fork carries two `steerMessage` implementations (`KimiTUI` and
  `MessageDispatchController`); both are wired, because the automatic queue
  drain and the manual Ctrl-S path each call one.
- `SteerResult` is imported through the package root, matching the facade's
  existing `PromptLaunchResult` alias style.
- `AgentEvent` does not include `turn.prompt` / `turn.steer`, so the handler
  narrows them through the same `object` guards upstream uses instead of
  widening the public union.
- `promptWithSkills` / `steer` drop `async` on both SDK entry points because
  they now just return the inner promise; keeping `async` adds
  `require-await` warnings.

Restored a local regression on the way: `event-mapper` dropped
`prompt.completed` entirely, so a v2 gate-blocked or rejected prompt could
not settle a client. The type is forwarded again with the upstream
`blocked|failed` filter.

Verified: apps/kimi-code and klient typecheck clean; klient 32 tests,
node-sdk session suites 22 pass (16 on the post-async re-run),
sdk-rpc-client-v2 78 pass / 3 skip, kimi-tui message flow 420 pass — all
green. check:no-comments, check:no-hardcoded-prose, check:locale-keys and
check:t-coverage pass. Reverting the `steerPending` clear in
`setSteerEntriesPending` reddens four of the new cases (goal-queue
confirmation, `blocked` release, `failed` release, same-text takeover) and
restoring it turns them green again. Pre-existing, unchanged: node-sdk's
own `tsc` reports `#/errors` member errors from agent-core-v2's path
aliases.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
The harness's `steer` facade still re-implemented the pre-MoonshotAI#4627 behavior:
it submitted through `IAgentLoopService` and answered `{turn_id}` on
launch, `undefined` otherwise. The engine now answers a `SteerResult`
with the submission's state and whether the running turn took the text,
so the facade follows upstream and delegates to
`IAgentPromptChannel.submitSteer`.

`activateSkill`'s steer cases now pin `steered: true` for a merged steer
and `steered: false` for a queued one, which is the signal the TUI's
fade-until-read state machine consumes.

Verified: agent-core-v2 typecheck clean; prompt + skill suites 185 pass,
loop + task suites 373 pass / 1 skip, no failures.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
The steer read state lands in full: the engine answers `SteerResult`, the
wire and SDK carry `PromptSubmissionResult`, and the TUI keeps each steer
faded until its own prompt id (or, on engines without ids, its text) comes
back on `turn.steer` / `turn.prompt` / `turn.started` /
`prompt.completed`.

Probe: `fades a Ctrl-S steer until turn.steer` in the kimi-tui message-flow
suite, which drives a real Ctrl-S submission through the editor and asserts
the fade appears and clears on the event.
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