fix: Remove premature pendingTools.delete in webSearchResult handler (#2743)
The webSearchResult branch deleted entries from pendingTools after rendering, which removed the duplicate-prevention guard. Subsequent streaming tokens re-iterated content blocks, re-created the serverToolUse component, and re-rendered the search result — producing 18+ duplicate blocks. The message_end handler already calls pendingTools.clear(), so the explicit deletes were unnecessary and harmful. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c5b38d69e3
commit
ef310574da
1 changed files with 0 additions and 2 deletions
|
|
@ -150,7 +150,6 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|||
content: [{ type: "text", text: "Web search disabled (offline mode)" }],
|
||||
isError: false,
|
||||
});
|
||||
host.pendingTools.delete(content.toolUseId);
|
||||
} else {
|
||||
const searchContent = content.content;
|
||||
const isError = searchContent && typeof searchContent === "object" && "type" in (searchContent as any) && (searchContent as any).type === "web_search_tool_result_error";
|
||||
|
|
@ -158,7 +157,6 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|||
content: [{ type: "text", text: host.formatWebSearchResult(searchContent) }],
|
||||
isError: !!isError,
|
||||
});
|
||||
host.pendingTools.delete(content.toolUseId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue