From 86d377a2f059214774fca6aa6ae2b1c2cb2551ef Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 27 Mar 2026 12:25:16 -0600 Subject: [PATCH] fix: remove id/type from tool_calls delta chunks in Responses API streaming (#683) In OpenAI Chat Completions streaming format, the tool call id and type should only appear on the first chunk (tool declaration). Subsequent argument delta chunks should only include index and function.arguments. Including id on every delta chunk caused openai-to-claude.ts to emit a new content_block_start for each chunk, breaking Claude Code ACP sessions with malformed Claude-format streams. Fixes #682 Co-authored-by: Chris Staley --- open-sse/translator/response/openai-responses.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/open-sse/translator/response/openai-responses.ts b/open-sse/translator/response/openai-responses.ts index 96aa862424..b22b9f5f46 100644 --- a/open-sse/translator/response/openai-responses.ts +++ b/open-sse/translator/response/openai-responses.ts @@ -464,6 +464,9 @@ export function openaiResponsesToOpenAIResponse(chunk, state) { } // Function call arguments delta + // NOTE: Do NOT include `id` or `type` here - only first chunk (response.output_item.added) + // should have them. Including `id` on every chunk causes openai-to-claude.ts to emit + // a new content_block_start for each delta, breaking Claude Code ACP sessions. if (eventType === "response.function_call_arguments.delta") { const argsDelta = data.delta || ""; if (!argsDelta) return null; @@ -480,8 +483,6 @@ export function openaiResponsesToOpenAIResponse(chunk, state) { tool_calls: [ { index: state.toolCallIndex, - id: state.currentToolCallId, - type: "function", function: { arguments: argsDelta }, }, ],