Repository navigation
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
MohammedAlkindi
left a comment
There was a problem hiding this comment.
The findCallBuffer ambiguity guard is the right call. Returning undefined when a compatibility call_id matches two buffers drops the event instead of attaching arguments to the wrong call, and the third test pins exactly that case.
All three new tests should fail tsc. ResponsesTurnParams declares input: unknown[] as required and has no messages member, and each new case calls streamResponsesTurn({ config, messages: [], tools: [] }). Vitest strips types rather than checking them, so they pass at runtime because fetch is mocked and the missing input just serializes as undefined. I raised this on #2553 and re-checked it against openai-responses.ts on main today rather than assuming it carried over. Swapping messages for input in all three cases fixes it.
#2551 is still open and fixes the same bug by keying on item_id without the call_id fallback. That leaves three PRs for one event-correlation bug, differing only on whether the old call_id lookup survives. Picking one looks more useful than reviewing all three diffs in parallel.
Generated by Claude Code

Summary
Fixes #2550. OpenAI Responses streaming identifies
response.function_call_arguments.deltaand.doneevents withitem_id, while the created function-call item carries the downstreamcall_id. Buffering bycall_idtherefore discarded valid argument events and causedMCPAgent.stream()to emit no tool-call steps.The parser now buffers events by
item_id(withcall_idas a compatibility fallback), retains the function item\u0027scall_idfor the ready payload and subsequent tool output, and rejects ambiguous/missing correlations instead of silently attaching data to a different call.Design and boundaries
item_idis the primary correlation key because it is the Responses event contract;call_idremains accepted for compatibility producers.call_id, so driver/executor call sites keep their existing identity contract.Validation
pnpm exec vitest run src/llm/__tests__/openai-responses.test.ts— 9 passedpnpm run build— tsup build and declaration generation passedgit diff --check origin/main...HEADThe local Node is 22.16.0 while the workspace declares >=22.22.2; the focused tests and build completed despite that version warning. CI remains the full matrix.
Summary by cubic
Fixes OpenAI Responses streaming so tool argument events are correlated by
item_id, restoring tool-call steps thatMCPAgent.stream()previously dropped.The parser now keys buffers by
item_id, acceptscall_idonly when it uniquely identifies one output item, and drops unknown or ambiguous correlations instead of attaching data to the wrong call. The public tool-call payload still usescall_id, so driver/executor call sites keep their existing identity contract.Bug Fixes
item_id, withcall_idaccepted only for unambiguous compatibility producers.call_idin the public tool-call payload so driver/executor call sites keep their existing identity contract.Written for commit ea58ab9. Summary will update on new commits.