Skip to content

[openai, openai-agents] Use concrete invocation types in raw response and robust mock assertions - #744

Merged
lmolkova merged 1 commit into
open-telemetry:mainfrom
lmolkova:fix/openai-agents-mock-and-error-imports
Sep 20, 2026
Merged

lmolkova merged 1 commit into
open-telemetry:mainfrom
lmolkova:fix/openai-agents-mock-and-error-imports

Conversation

@lmolkova

@lmolkova lmolkova commented Sep 19, 2026

Copy link
Copy Markdown
Member

What does this change do?

Uses _StreamingInvocation in _raw_response.py and updates test_function_span_skips_content_when_capture_disabled to verify mocked tool invocation arguments and results remain untouched using sentinels instead of expecting AttributeError.

Why?

Removes the last remaining GenAIInvocation usage in instrumentations and decouples mock tests from whether ToolInvocation defines properties on the class.

@lmolkova
lmolkova requested a review from a team as a code owner September 19, 2026 06:43
Copilot AI lite review requested due to automatic review settings September 19, 2026 06:43
@lmolkova lmolkova added the Skip Changelog PR does not require a changelog entry label Sep 19, 2026
@lmolkova
lmolkova force-pushed the fix/openai-agents-mock-and-error-imports branch from 8d45009 to 82d2153 Compare September 19, 2026 06:43
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 19, 2026

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-20 05:11 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Review effort: Lite
Findings: None

What changed in this PR

This PR aligns Error imports with the public invocation API and makes the capture-disabled mock test independent of class-level properties.

Changes:

  • Imports Error from opentelemetry.util.genai.invocation.
  • Uses sentinel objects to verify tool content remains untouched.
File Description
instrumentation/​opentelemetry-instrumentation-genai-openai/​src/​opentelemetry/​instrumentation/​genai/​openai/​response_wrappers.py Updated as part of this pull request.
instrumentation/​opentelemetry-instrumentation-genai-openai-agents/​tests/​test_processor.py Updated as part of this pull request.
instrumentation/​opentelemetry-instrumentation-genai-openai-agents/​src/​opentelemetry/​instrumentation/​genai/​openai_agents/​processor.py Updated as part of this pull request.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lmolkova
lmolkova force-pushed the fix/openai-agents-mock-and-error-imports branch from 82d2153 to 66f6eef Compare September 19, 2026 06:46
@lmolkova lmolkova changed the title Use public Error import and robust mock assertions in OpenAI and OpenAI Agents Use concrete invocation types in OpenAI raw response and robust mock assertions in OpenAI Agents Sep 19, 2026
@lmolkova lmolkova changed the title Use concrete invocation types in OpenAI raw response and robust mock assertions in OpenAI Agents [openai, openai-agents] Use concrete invocation types in raw response and robust mock assertions Sep 19, 2026
@lmolkova
lmolkova added this pull request to the merge queue Sep 20, 2026
Merged via the queue into open-telemetry:main with commit a29476c Sep 20, 2026
75 checks passed
@lmolkova
lmolkova deleted the fix/openai-agents-mock-and-error-imports branch September 20, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PR does not require a changelog entry

Development

Successfully merging this pull request may close these issues.

3 participants