Skip to content

fix: track accumulator finished choice index#673

Open
MukundaKatta wants to merge 1 commit into
openai:mainfrom
MukundaKatta:codex/accumulator-choice-index
Open

fix: track accumulator finished choice index#673
MukundaKatta wants to merge 1 commit into
openai:mainfrom
MukundaKatta:codex/accumulator-choice-index

Conversation

@MukundaKatta
Copy link
Copy Markdown

Fixes #428.\n\n## Summary\n- track finished accumulator state per streamed choice instead of only inspecting choice 0\n- return finished tool calls from the correct accumulated choice\n- expose the finished tool call choice through ChoiceIndex while preserving Index as the tool-call index\n- add a regression test for a tool call finishing on choice 1 while choice 0 continues streaming\n\n## Tests\n- go test . -run 'TestAccumulator(JustFinishedToolCallUsesChoiceIndex|NegativeToolCallIndex|EmptyToolCallsArray)'\n- go test ./... -run TestAccumulatorJustFinishedToolCallUsesChoiceIndex\n- git diff --check\n\nNote: I also tried the existing TestStreamingAccumulatorWithToolCalls, but it depends on the repo's localhost mock server setup and panicked on a nil mocked response in this environment before exercising this change.

@MukundaKatta MukundaKatta requested a review from a team as a code owner May 15, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

streaming: why ChatCompletionAccumulator.JustFinishedToolCall only handle first Choice?

1 participant