Skip to content

fix(streaming): handle dupe-index delta entries#3204

Open
hrolfurinn wants to merge 1 commit intoopenai:mainfrom
hrolfurinn:fix/accumulate-delta-duplicate-index
Open

fix(streaming): handle dupe-index delta entries#3204
hrolfurinn wants to merge 1 commit intoopenai:mainfrom
hrolfurinn:fix/accumulate-delta-duplicate-index

Conversation

@hrolfurinn
Copy link
Copy Markdown

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Handles case where multiple tool call entries in a single streaming delta share the same index. That dupe index shape is permissible according to the spec. Previously could result in initial tool call arg chunk being dropped, e.g. intended arguments { "city": "Reykjavik"} become truncated city": "Reykjavik" } . Bug was observed against vLLM with spec. decoding enabled.

Route the first delta through the index-merge path. Duplicate-index entries now merge instead of becoming separate list elements. The early-return branches (key not in acc, acc_value is None) copied the delta list as-is, skipping the merge. Same fix in _assistants.py. _completions.py now seeds initial snapshots through accumulate_delta.

Additional context & links

Fixes #3203. See also #3201.

@hrolfurinn hrolfurinn requested a review from a team as a code owner May 7, 2026 01:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57597c785c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/openai/lib/streaming/_deltas.py
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.

accumulate_delta drops tool_call fragments when one chunk has multiple entries at the same index

1 participant