Repository navigation
Conversation
update_trace_properties_from_span_data dereferenced span_data.response unconditionally, but the OpenAI Agents SDK only populates response when sensitive data is included in the trace. With RunConfig(trace_include_sensitive_data=False) every ResponseSpanData arrives with response=None and the AttributeError escaped DeepEvalTracingProcessor.on_span_end, leaving the LlmSpan unexited. Guard the None response the same way update_span_properties_from_response_span_data already does.
|
@BlueX888 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
update_trace_properties_from_span_data()indeepeval/openai_agents/extractors.pydereferencesspan_data.responseunconditionally. The OpenAI Agents SDK only populates that attribute when sensitive data is included in the trace, so withRunConfig(trace_include_sensitive_data=False)everyResponseSpanDatareaches the trace processor withresponse=Noneand the call raisesAttributeError.Why
Root cause,
deepeval/openai_agents/extractors.py:431-440(before this change):The sibling extractor for the same span data already handles this case —
update_span_properties_from_response_span_data()returns early whenresponse is None(deepeval/openai_agents/extractors.py:95-98) — but the trace-level one does not.The SDK side (
agents/models/openai_responses.py:613-619, openai-agents 0.22.3) assigns the span data only behindif tracing.include_data()::So with
trace_include_sensitive_data=False(ModelTracing.ENABLED_WITHOUT_DATA) the span carries only_response_id;responseandinputstayNone.Impact:
DeepEvalTracingProcessor.on_span_end()(deepeval/openai_agents/callback_handler.py:121) raises inside the SDK's processor loop, which logs and swallows it (agents/tracing/provider.py:162-173). Execution never reachesobserver.__exit__(callback_handler.py:136-138), so theLlmSpanstays open incurrent_span_context/trace_manager.active_spans, itsObserverstays inspan_observers, and the trace loses the span silently. Verified locally against openai-agents 0.22.3: before the fix the SDK logsError in trace processor during on_span_endandcurrent_span_context.get()is still non-Noneafter the run; after the fixspan_observersis empty and the current span is cleared.Changes
deepeval/openai_agents/extractors.py— return early fromupdate_trace_properties_from_span_data()when aResponseSpanDatahasresponse=None, mirroring the existing guard inupdate_span_properties_from_response_span_data().tests/test_integrations/test_openai_agents/test_extractors.py— regression test: build aResponseSpanData(response=None, input=None)and call the extractor; it must not raise and must leavetrace.input/trace.outputunset.No other files are touched; the
GenerationSpanDatabranch is unchanged.Testing
Regression test on the unpatched tree (test file present,
extractors.pyatHEAD~1):Same command on the patched tree:
Whole
openai_agentsmodule, patched:15 failed, 1 passed, 1 skipped; same tree withextractors.pyreverted:16 failed, 1 skipped. The failure sets are identical apart from the new test (red → green); the 15 remaining failures are pre-existing and environmental —openai.OpenAIError: Missing credentials ... set the OPENAI_API_KEY environment variable— since this sandbox has noOPENAI_API_KEY, and the CI job is gated onif: ${{ env.OPENAI_API_KEY != '' }}.Format and lint:
(mypy is scoped to
^deepeval/telemetry/by the repo's pre-commit config, so it does not cover this diff.)Notes
Related, separate report: #3314 covers the same failure mode for
GenerationSpanDatawithusage=Noneinupdate_span_properties_from_generation_span_data(a different function and a different span type); that is not addressed here. This change is limited to theResponseSpanDatabranch ofupdate_trace_properties_from_span_data.