Repository navigation
Python: [Bug]: Chat Completions streaming loses logprobs after null chunks #8996
Copy link
Copy link
Closed
Copy link
Labels
agentsUsage: [Issues, PRs], Target: Single agentUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
Description
Activity
- addedpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythontriageUsage: [Issues], Target: All issues that still need to be triagedUsage: [Issues], Target: All issues that still need to be triaged
on Oct 3, 2026 - addedreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
on Oct 3, 2026 🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro:
python/packages/openai/agent_framework_openai/_chat_completion_client.py::_get_metadata_from_chat_choiceemitslogprobs: Nonefor a terminal streaming choice, and_parse_response_update_from_openaiplaces it in update metadata. Use a mocked two-chunk stream containing populated logprobs with"hello", followed by an empty delta with null logprobs andfinish_reason="stop", then callget_final_response()and observe that final logprobs areNone.- Failing test:
python/packages/openai/tests/openai/test_openai_chat_completion_client.py::test_streaming_final_response_preserves_logprobs_after_null_chunk - Files examined: python/packages/openai/agent_framework_openai/_chat_completion_client.py, python/packages/openai/tests/openai/test_openai_chat_completion_client.py, python/packages/core/agent_framework/_clients.py, python/packages/core/agent_framework/_types.py, python/packages/openai/pyproject.toml
- Tests run: test_streaming_final_response_preserves_logprobs_after_null_chunk, test_streaming_closes_provider_stream_on_completion
- Reported version:
agent-framework-openai 1.15.0 - Current version:
agent-framework-openai 1.15.0
- Failing test:
- addedagentsUsage: [Issues, PRs], Target: Single agentUsage: [Issues, PRs], Target: Single agentand removedtriageUsage: [Issues], Target: All issues that still need to be triagedUsage: [Issues], Target: All issues that still need to be triaged
on Oct 3, 2026
Metadata
Metadata
Labels
agentsUsage: [Issues, PRs], Target: Single agentUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
Type
Projects
- StatusShow more project fieldsDone
Description
A Chat Completions streaming chunk with
choice.logprobs=Noneoverwrites populated logprobs from an earlier chunk during final response aggregation. A terminal chunk with an empty delta is sufficient to reproduce this.Expected: The final response retains the last populated logprobs object.
Actual:
response.textishello, butresponse.additional_properties["logprobs"]isNone.Code Sample
This uses a mocked provider/client and makes no service request.
Package Versions
Source checkout
e9857bd75a21843803431a2e7dfa41ee9b017ac7:agent-framework-core1.20.0,agent-framework-openai1.15.0; OpenAI SDK 3.23.0.Python Version
Python 3.12.12.
Additional Context
I will submit a focused fix with regression coverage for this behavior.