Repository navigation
fix(agent-core-v2): keep the output of stopped tool calls - #4854
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 77259ac The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codex Review Summary: ✅ CompletedThis 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. |
commit: |
Merged
6 tasks done
Grapedge
added a commit
that referenced
this pull request
Nov 12, 2026
* fix(agent-core-v2): truncate oversized skill content (#4834) * fix(kap-server): bind the main agent when a session is created (#4839) * fix(kap-server): bind the main agent when a session is created * fix(kap-server): reject a profile on prompt submissions * fix(kap-server): reject a profile change through the session profile * fix(kap-server): wait for model configuration before binding a new session * fix(agent-core-v2): deduplicate restored task notifications (#4836) * fix(agent-core-v2): deduplicate restored task notifications * chore: add notification replay fix changeset * fix(agent-core-v2): preserve task notifications after prompt-only crashes * fix(agent-core-v2): complete prompts before ending turns * test: align lifecycle snapshots with prompt completion order * fix(agent-core-v2): settle all prompts during turn finalization * fix(kap-server): drop reserved metadata keys from session profile updates (#4842) * fix(kap-server): drop reserved metadata keys from session profile updates * fix(kap-server): keep stored reserved metadata keys on profile updates * docs: split and rewrite the server API reference (#4841) * docs: split and rewrite the server API reference * docs: redirect old server API anchors to the split pages * docs: describe profile metadata as a replacement * docs: mark question responses as answered-only * fix(kap-server): avoid heartbeat timeout after scheduling stalls (#4823) * fix(kap-server): avoid heartbeat timeout reaping after stalls or clock jumps * fix(kap-server): grace heartbeat window for short scheduling stalls * fix(kap-server): treat only clearly late heartbeats as scheduling stalls * fix(kap-server): time heartbeats on a monotonic clock and drain queued input before reaping --------- Co-authored-by: Kimi Code (Grok Bot) <[email protected]> * fix(kap-server): undo a turn only once when requests race (#4846) * docs: describe heartbeat stall handling (#4849) * docs: describe heartbeat stall handling * docs: explain the monotonic clock in the heartbeat notes * fix(agent-core-v2): acquire session lock before loop restoration (#4848) * fix(agent-core-v2): acquire session lock before loop restoration * chore: add session lock lifecycle changeset * fix(agent-core-v2): hold session lock through loop restoration - add an operation-scoped lease to the session run gate - hold it across loop initialization, reset, and pending drains - cover idle timeout and release ordering * fix(agent-core-v2): keep the output of stopped tool calls (#4854) * fix(kap-server): drop the partial reply of a retried step (#4855) * fix(agent-core-v2): dedupe historical tool schemas (#4862) * fix(agent-core-v2): dedupe historical tool schemas * chore: add duplicate tool schema changeset * fix(agent-core-v2): preserve first tool schema declaration * fix(agent-core-v2): remind on changed tool schemas * fix(agent-core-v2): block stale tool schema calls * fix(agent-core-v2): normalize registry schemas in pending checks * fix(agent-core-v2): import registry tool metadata type * fix(agent-core-v2): preserve abort handling during validation * fix(agent-core-v2): refine validation hook preparation * fix(agent-core-v2): make validation hooks synchronous * fix(agent-core-v2): preserve tool result notes on fork (#4867) * fix(agent-core-v2): preserve tool result notes on fork * chore: add fork tool result note changeset * fix(agent-core-v2): scope tool result note restoration to forks * fix(agent-core-v2): normalize inherited tool result notes * fix(agent-core-v2): isolate fork note restoration * feat(tui): sweep running titles toward text and add KIMI_CODE_TUI_ANIMATION_FPS (#4843) (#4870) * chore: sync web dist from code-app (#4871) code-app: 8ab17294e031323186d357d121c5360b8353900e Co-authored-by: kimi-agent-bot <[email protected]> * ci: release packages (#4835) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: sync web dist from code-app code-app: 5835391dac3a2b9e0c65ffbd418f0d6042a7adb2 --------- Co-authored-by: Haozhe <[email protected]> Co-authored-by: qer <[email protected]> Co-authored-by: Kimi Code (Grok Bot) <[email protected]> Co-authored-by: grapedge <[email protected]> Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirement or Bug
停止一轮对话时,正在运行的工具(例如一个还在输出的 Bash 命令)结束后,Web / 桌面端的工具卡片和 CLI 里只剩一段固定的中断说明(
The user manually interrupted "Bash" …),命令在停止前已经打出来的输出看不到了。2.5.3 会显示「已有输出 + Interrupted by user」。这个 PR 让被停止的工具重新显示它实际产生的结果。Bug Reproduction Steps
echo line-1; sleep 60。line-1出现后点停止。line-1。Root Cause
#4630 移植 agent loop 时,
turnProjection在投影tool.ended事件时,只要工具结局是aborted,就把发往 wire 的tool.result.output换成abortedToolOutput(...)生成的固定文本,丢掉了工具 handler 的真实结果。实际上被停止的 Bash 仍会返回「已有输出 + Interrupted by user」,模型上下文里的工具消息(
event.outcome.entry)也正是这段内容;只有发给客户端的那一份被替换了,所以界面和模型看到的内容不一致。属于根本修复。Code Changes
entry.content就是写进模型上下文的工具消息:entry本来就由abortedToolOutcome生成,内容仍是原来的固定说明。所以去掉这个分支后,界面始终和模型看到的内容一致。不再需要的
toolName计算和abortedToolOutputimport 一并删除。文档同步:
server-api-conversation.md(中英文)里工具调用条目的output/media/error原本写着「有error时outcome必为failed」,和实现不符。现在改为:output/media只在正常完成时出现;error在失败或被停止时承载结果文本;interrupted,且不带error。Behavior Changes and Affected Users
tool.result.output与会话条目errorInterrupted by user)受影响的客户端:desktop 与 web(会话条目里的工具卡片)、TUI 与 print 模式(
tool.result事件)。测试覆盖:
loop.test.ts新增一条用例,同一轮里两个工具被停止:一个在中止时返回部分输出,断言 wire 上是它的真实输出;另一个直接抛出中止,断言仍是固定说明。去掉修复后,这条用例失败。验证
packages/agent-core-v2的test/agent:87 个文件、2234 条测试通过packages/kap-server全量:1377 条通过,1 条跳过apps/kimi-code的test/tui:3654 条通过agent-core-v2typecheck 通过turnProjection的输入:handler 结果和模型上下文都是stop-line-1\nInterrupted by user,wire 上却是固定说明Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.