Skip to content

Commit 2cf4021

Browse files
committed
fix: skip content_block_delta events for unknown tool_use blocks
When mode is null (unknown tool skipped), content_block_delta events with input_json_delta would still call sendActionExecutionArgs using the previous valid tool call ID, corrupting its arguments.
1 parent 7e02057 commit 2cf4021

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/runtime/src/service-adapters/anthropic/anthropic-adapter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ export class AnthropicAdapter implements CopilotServiceAdapter {
396396
mode = "function";
397397
}
398398
} else if (chunk.type === "content_block_delta") {
399+
if (mode === null) {
400+
// Skip deltas for unknown/skipped content blocks
401+
continue;
402+
}
399403
if (chunk.delta.type === "text_delta") {
400404
const text = filterThinkingTextBuffer.onTextChunk(
401405
chunk.delta.text,

0 commit comments

Comments
 (0)