Repository navigation
fix(kap-server): end tool calls cut short by a stop as interrupted - #4772
Conversation
🦋 Changeset detectedLatest commit: 4aaee6f 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: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41a454d162
ℹ️ 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
|
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
…th 2.6.0 MoonshotAI#4772: end tool calls cut short by a stop as interrupted, and keep a tool error failed when the step itself failed. MoonshotAI#4826: drop the deprecated turn_id alias from the file-history queries; a turn_id-only query now fails validation with 40001. MoonshotAI#4730: a streamed item no longer ends early from the feed clock. The source shape is in place; the remaining live-feed gap is recorded in the ledger row.
MoonshotAI#4663 and MoonshotAI#4789 now describe the recorded-event fold that serves the pinned bundle: task links come from persisted TaskStarted records, and the feed no longer rebuilds from the model-context view. MoonshotAI#4730 moves from partial to ported (record-driven items seal once, with the recorded reasoning duration), and MoonshotAI#4772's probe follows the feed suite it now lives in. MoonshotAI#4893 is unblocked: `kap.conversation` stages its replay, publishes once after rehydration, and gates live dispatch only while a mutable participant restores. The PLAYBOOK note on the release-branch commits carries the correction for MoonshotAI#4888 for the same reason.
Requirement or Bug
用户在 desktop / web 里按停止后,正在执行的工具卡片会变成红色的失败状态,卡片里显示的是写给模型的提示语(「The user manually interrupted … Do not retry automatically …」)。这些工具是用户停掉的,不是自己失败的。
Bug Reproduction Steps
sleep 60。Interrupted by user,或者引擎补写的那段给模型的提示语。Root Cause
停止一轮时,引擎先写
turn.cancel,再中止正在运行的工具。被中止的工具会返回isError: true的结果:Bash 返回Interrupted by user,还没返回结果的工具由循环补写一条给模型的提示语。kap-server 的 fold 只看isError,所以这些工具都以outcome: failed结束,客户端就显示成报错。fold 在收到
turn.cancel时已经给这一轮记了临时结局interrupted(provisionalEnds),只是没有用在工具结果上。这是根本修复。Code Changes
endToolCall改为直接接收结局。interrupted和failed一样,把结果文本放在error里、不带output和media。客户端对interrupted只读output,所以写给模型的提示语不会显示出来,数据仍然保留在 wire 上。interrupted。停止前已经返回的结果不变;步骤因错误中断(turn.step.interrupted的 reason 为error)时,工具错误仍是failed。Behavior Changes and Affected Users
outcomefailed,error为工具返回的文本interrupted,error文本保留interrupted显示为「已取消」isError记为completed/failedfailedfailedturn.cancel,这次不覆盖受影响模块:
packages/kap-server/src/services/conversation/conversationFold.ts、conversationItems.ts。实时推送和历史读取都经过同一个 fold。测试:
test/services/conversation.test.ts新增两个用例。一个覆盖停止前已完成、停止前已失败、停止后被中止、停止后补写四种工具结果;另一个钉住步骤出错时工具错误仍是failed。在改动前的代码上,第一个用例会失败。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.