Skip to content

Fix OpenInference trace patch lifecycle - #1726

Open
tconley1428 wants to merge 1 commit into
mainfrom
fix/openai-otel-trace-patch-lifecycle
Open

Fix OpenInference trace patch lifecycle#1726
tconley1428 wants to merge 1 commit into
mainfrom
fix/openai-otel-trace-patch-lifecycle

Conversation

@tconley1428

Copy link
Copy Markdown
Contributor

Summary

  • scope the OpenInference trace-start patch to active OpenAI Agents tracing contexts
  • prevent nested wrappers when multiple contexts are active
  • restore the original method after the final context exits
  • add a regression test for the patch lifecycle

Why

The patch previously remained installed after instrumentation was removed. Each new OTel-enabled AgentEnvironment wrapped the previous patch, causing suite-order-dependent context work during workflow replay.

Validation

  • uv sync --all-extras
  • poe build-develop
  • poe test -s -k 'otel_trace_start_patch_does_not_nest or test_sdk_trace_to_otel_span_parenting'
  • poe lint (Ruff and Pyright passed; the Mypy step did not return a final status before the command session ended)

@tconley1428
tconley1428 requested review from a team as code owners August 5, 2026 21:15
@tconley1428
tconley1428 force-pushed the fix/openai-otel-trace-patch-lifecycle branch from 8065080 to f105e90 Compare August 5, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant