Skip to content

fix(openai): fix tracing exception in model response getting method when tracing is disabled #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

upphiminn
Copy link

This pull request addresses a possible issue in the OpenAIResponsesModel where an exception could occur during getting a response when tracing is disabled. When tracing is disabled there is no parent trace so withResponseSpan fails with not finding a context trace for the span it attempts to create. This leads to the whole getResponse failing. Fix found below copies the same style of span creation only when tracing is enabled as seen in getStreamedResponse method.

@upphiminn upphiminn marked this pull request as ready for review July 17, 2025 15:55
@seratch seratch added package:agents-openai bug Something isn't working labels Jul 17, 2025
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

This looks good to me; @dkundel-openai any concern?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:agents-openai
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants