-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(claude): forward done-only Responses tool arguments #4652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lidge-jun
merged 1 commit into
lidge-jun:dev
from
RHODIZSECURITY:fix/claude-done-only-tool-args-20260914
Sep 16, 2026
+48
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 50375
🤖 get_repo_knowledge executed:
get_repo_knowledge lidge-jun/opencodex /tmp/coderabbit-repo-knowledge/lidge-jun-opencodex-7afea732/learnings /tmp/coderabbit-repo-knowledge/lidge-jun-opencodex-7afea732/conventionsLength of output: 13748
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 50375
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 50376
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 21444
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 50375
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 50375
🌐 Web query:
OpenAI Responses API official streaming events ordering output_item.added function_call_arguments.delta function_call_arguments.done output_item.done multiple function calls💡 Result:
<search_synthesis>
When using the OpenAI Realtime API, streaming events related to function calls follow a predictable lifecycle [1]. The authoritative ordering for these events is as follows [1][2]: 1. response.output_item.added: This event signals that a function_call item has been created in the conversation [1]. It contains the metadata needed to track the call, including the item_id, call_id, and the function name [1][3]. 2. response.function_call_arguments.delta: This event is emitted multiple times as the model streams the JSON arguments for the tool call [1]. You should buffer these deltas by appending them to a string to reconstruct the arguments [1]. 3. response.function_call_arguments.done: This event signals that the model has finished generating the arguments [1][3]. The
argumentsfield in this event represents the complete, final JSON string for that specific function call [1][3]. 4. response.output_item.done: This event signifies that the function_call item is complete [1]. At this point, the tool call is considered "issued," and the application should proceed to execute the function [1]. For multiple function calls, the API maintains separate output indices and item IDs [1]. You should track each function call independently using its unique item_id or call_id [1][3]. Because events for different function calls may be interleaved, you must buffer deltas on a per-item_id basis [4][1]. Important implementation notes: - Authoritative arguments: While you can render streamed deltas incrementally, theresponse.function_call_arguments.doneevent (or theargumentsfield in the finaloutput_item.doneevent) should be treated as the source of truth [4][1]. - Validation drift: Historically, some client SDKs have experienced issues whereresponse.function_call_arguments.doneevents omit thenamefield [5]. When this occurs, you should correlate the event back to the originalresponse.output_item.addedevent using theitem_idto retrieve the function name [5][1].</search_synthesis>
<source_evidence>
Citations:
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 27697
🌐 Web query:
site:platform.openai.com/docs/guides/function-calling Responses API streaming function_call_arguments.done output_item.done event order💡 Result:
For the Responses API streaming event order, function-call arguments are emitted roughly as:
response.function_call_arguments.donecontains the finalized JSON arguments and should be used to invoke your function.response.output_item.donethen marks the entire function-call output item as complete. Use each event’ssequence_numberas the authoritative ordering mechanism rather than assuming timing. (platform.openai.com)Note:
response.function_call_arguments.donemay also be emitted when a response is interrupted, incomplete, or cancelled. (platform.openai.com)Citations:
Correlate
response.function_call_arguments.donewithopen.itemId.responsesSseToAnthropicSsestores one tool block inopen, but the handler atsrc/claude/outbound.ts:527-531does not comparedata.item_idwithopen.itemId. If call B is added before call A's done event, A's arguments can be emitted into B.toolArgsEmittedthen suppresses B's arguments. Track tool blocks by item ID or buffer unmatched completions. Add a regression test for A added, B added, A done, and B done. The serialized ordering insrc/bridge.ts:724-728does not cover every upstream stream passed throughsrc/server/claude-messages.ts:991.🤖 Prompt for AI Agents
Sources: Coding guidelines, Path instructions