Skip to content

fix(genai-openai): fix for ChoiceBuffer crashes on streaming tool-call deltas with arguments=None.#4350

Merged
xrmx merged 11 commits intoopen-telemetry:mainfrom
eternalcuriouslearner:fix/streaming-tool-call-none-arguments
Mar 25, 2026
Merged

fix(genai-openai): fix for ChoiceBuffer crashes on streaming tool-call deltas with arguments=None.#4350
xrmx merged 11 commits intoopen-telemetry:mainfrom
eternalcuriouslearner:fix/streaming-tool-call-none-arguments

Conversation

@eternalcuriouslearner
Copy link
Copy Markdown
Contributor

Description

Fix for ChoiceBuffer crashes on streaming tool-call deltas with arguments=None.

Fixes #4344

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Added unit tests in tests/test_choice_buffer.py covering:

  • TestToolCallBuffer::test_append_arguments_with_none_is_skipped — verifies None arguments are skipped and "".join() succeeds
  • TestToolCallBuffer::test_append_arguments_all_none — verifies all-None arguments produce an empty string
  • TestChoiceBuffer::test_append_tool_call_with_none_arguments — end-to-end regression test reproducing the exact scenario from issue openai-v2: ChoiceBuffer crashes on streaming tool-call deltas with arguments=None #4344 (provider sends arguments=None on first delta chunk)
  • TestChoiceBuffer::test_append_multiple_tool_calls_with_none_arguments — multiple tool calls with None arguments
  • TestChoiceBuffer::test_append_tool_call_with_none_function — delta chunk with function=None

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@eternalcuriouslearner eternalcuriouslearner changed the title fix for ChoiceBuffer crashes on streaming tool-call deltas with arguments=None. (genai-openai): fix for ChoiceBuffer crashes on streaming tool-call deltas with arguments=None. Mar 22, 2026
@eternalcuriouslearner eternalcuriouslearner changed the title (genai-openai): fix for ChoiceBuffer crashes on streaming tool-call deltas with arguments=None. fix(genai-openai): fix for ChoiceBuffer crashes on streaming tool-call deltas with arguments=None. Mar 22, 2026
@xrmx xrmx moved this to Easy to review / merge / close in Python PR digest Mar 23, 2026
@xrmx xrmx moved this from Easy to review / merge / close to Approved PRs that need fixes in Python PR digest Mar 23, 2026
@xrmx
Copy link
Copy Markdown
Contributor

xrmx commented Mar 23, 2026

@eternalcuriouslearner please fix lint and precommit

Thanks for looking into this!

@xrmx xrmx enabled auto-merge (squash) March 25, 2026 11:15
@xrmx xrmx merged commit 822cd77 into open-telemetry:main Mar 25, 2026
860 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs that need fixes to Done in Python PR digest Mar 25, 2026
wrisa pushed a commit to wrisa/opentelemetry-python-contrib that referenced this pull request Mar 26, 2026
…l deltas with arguments=None. (open-telemetry#4350)

* wip: fix for none/null in function tool calls.

* polish: add changelog.

* wip: fixing lint and precommit.

* wip: converted class based tests.

* wip: fixing the precommit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

openai-v2: ChoiceBuffer crashes on streaming tool-call deltas with arguments=None

3 participants