Repository navigation
fix(agent): 带副作用工具成功后才发同步 send,中途发言按下标记账,老名原生调用按 send 处理 - #1235
Merged
Merged
Conversation
修 #1223 记下的三个风险:同一步 send 先于带副作用的工具发出,工具失败时「定好了」已经发进群; 供应商回空调用 ID 时中途发言的结果串到同一步的工具上;照老历史发来的原生 agent_finalize、say 调用被当成不存在的工具,白花一轮修复。
SuInk
force-pushed
the
fix/send-interim-risks
branch
from
October 27, 2026 16:26
4fc8ce1 to
6256966
Compare
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.
修复「say 和 agent_finalize 合并成 send,空正文即不说话」(#1223)里记下的三个已知风险。
Why
#1223 把 say 合进 send 后,和工具同一步发来的 send 会作为中途发言立刻发出。这带来三个问题:
interimDone按call.ID记账,ID 为空时 send 和工具撞在同一个键上:工具的结果会被回成「已经发出去了」,并行检索的结果也可能互相覆盖。agent_finalize或say时,这两个名字已不在工具列表里,会被当成不存在的工具,白花一轮修复。改了什么
web_search、browser_render、tool_search)时,send 照旧立刻发出,「我去查一下」要赶在慢检索之前。带别的工具时先执行工具,成功了才发。工具失败或被拦时这句不发,模型收到的调用结果是「这句没有发出:同一步的 X 失败了」,并标为错误。没配Interim时行为不变。call.ID。agent_finalize、say改名成send,前提是注册表里没有同名工具。老收尾的silent=true当成空text,即不说话;say 的参数本来就是text。docs/interim-messages.md。影响
sendInterim改为接收下标列表、返回map[int]string;appendToolRepair的参数类型随之改变。验证
model/agent/finalize_interim_test.go,共四个用例:runner.go时,其中三个用例失败(检索先发的用例本来就是现有行为)。scripts/test-serial.sh ./model/agent ./model/assistant:-race和TZ=UTC两遍都通过。期间TestReplyTurnSendsInterimThenFinal暴露tool_search也应算检索,已补上。gofmt、git diff --check、check-public-repo.sh都通过。