Repository navigation
fix: 失败的 render_ui 不再算作已交付;同回合合成上下文不再清掉回合状态(#236 review 确认的两处漏补救) - #262
Merged
Merged
Conversation
…no longer wipes turn state (#236 review) Two gaps confirmed on #236 review that survived the merge: 1. A render_ui tool CALL marked the turn delivered. A failed render left the user with nothing while the boundary stayed silent forever. Delivery is now decided by the tool/result: success = no internal error identity and a non-isError result block. A call whose result has not arrived blocks steering at the boundary instead of racing the late result. 2. The user/message handler reset per-turn state for ANY non-plugin user message, so same-turn synthetic context (agent.inject() notices, team member messages) wiped validatedThisTurn/deliveredThisTurn before the boundary could use them. Reset now happens on the formal turn/start boundary and on direct human prompts (source.kind === 'user') only.
This was referenced Oct 5, 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.
修复 #236 review 中确认、合入 main 后仍保留的两处漏补救(CI 绿、相关 issue 关闭不代表这两条场景已修复)。
漏补救 ①:失败的
render_ui调用被算作已交付deliveredSomething在assistant/message里见到tool-call(name=render_ui)就把deliveredThisTurn置真——只看调用、不看结果。渲染卡失败后用户什么都没有,回合边界却认为已交付,nothing_delivered提醒永远不会发出。修复:交付只由
tool/result决定(事件携带message.content[0]的toolCallId/isError与事件级error):tool/call(render_ui)记入pendingRenders;tool/result无事件级error且结果块非isError⇒ 交付成立;否则不算;pendingRenders非空不纠正),避免与晚到结果赛跑(review 第 3 条「晚到结果不重复纠正」);turn/start清空残留。漏补救 ②:同轮上下文消息清掉验证状态
user/message分支对任何非插件来源的消息执行回合状态重置。但宿主的user/message明确包含三类:真实用户提示、agent.inject()合成上下文(文件变更通知、AGENTS.md、skill 内容等)、成员消息——后两类到达于回合中途,把validatedThisTurn/deliveredThisTurn清空,回合边界检查时信号已丢失。修复:重置只发生在——
turn/start(SessionEventMap 的正式回合边界,0.1.2-rc.1 起可用);source.kind === 'user',作为老宿主的兜底)。agent.inject()通知与成员消息(source.kind !== 'user')不再清状态。测试(
tests/fence-feedback.spec.ts43 项,+4)error/ 结果块isError)⇒ 提醒照发;turn/start开启干净回合 ⇒ 新回合可再次提醒。验证
npx vitest run全量 994 passed / 99 skipped;npx tsc --noEmit无错误。