ref(openai-agents): Remove set_data_normalized for primitive attributes#5509
ref(openai-agents): Remove set_data_normalized for primitive attributes#5509alexander-alderman-webb wants to merge 1 commit intomasterfrom
set_data_normalized for primitive attributes#5509Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛Openai
Other
Documentation 📚
Internal Changes 🔧Openai Agents
Other
🤖 This preview updates automatically when you update the PR. |
set_data_normalized for primitive attributes
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 6.61s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 0.00%. Project has 13670 uncovered lines. Files with missing lines (180)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 25.70% 30.84% +5.14%
==========================================
Files 189 189 —
Lines 19767 19767 —
Branches 6408 6408 —
==========================================
+ Hits 5080 6097 +1017
- Misses 14687 13670 -1017
- Partials 420 467 +47Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| execute_tool_span, SPANDATA.GEN_AI_TOOL_NAME, output.name | ||
| ) | ||
| execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_TYPE, "mcp") | ||
| execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_NAME, output.name) |
There was a problem hiding this comment.
Tool name may become non-serializable
Medium Severity
Replacing set_data_normalized with Span.set_data for SPANDATA.GEN_AI_TOOL_NAME and SPANDATA.GEN_AI_TOOL_TYPE can change serialization behavior. If output.name is ever a non-primitive (e.g., enum/object), it may no longer be coerced to JSON-safe data, risking dropped span data or serialization errors during event processing.
There was a problem hiding this comment.
See updated description.


Description
Remove
set_data_normalized()for attributes that do not require normalization.The output is narrowed to an instance of
McpCall, which has a stringnamefield:https://github.com/openai/openai-python/blob/3e0c05b84a2056870abf3bd6a5e7849020209cc3/src/openai/types/responses/response_item.py#L191
Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)