Skip to content

Preserve OpenAI Agents trace context across Temporal boundaries - #26

Merged
brianstrauch merged 3 commits into
mainfrom
fix/openai-agents-trace-context
Sep 17, 2026
Merged

brianstrauch merged 3 commits into
mainfrom
fix/openai-agents-trace-context

Conversation

@brianstrauch

@brianstrauch brianstrauch commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Summary

  • use propagated OpenTelemetry IDs as a remote parent instead of recording caller-span replicas
  • finish OpenInference traces and Temporal callback spans in the Context where they started
  • preserve child-workflow command ordering while tracing
  • make tracing assertions robust to valid client/worker callback interleaving
  • add regression coverage for shared-worker parentage, context restoration, native tracing, replay, and command ordering

This ports the OpenAI Agents changes from temporalio/sdk-python#1856 and the validated test stabilization from temporalio/sdk-python#1870 into the standalone temporalio-openai-agents package. The SDK-only TemporalIdGenerator cleanup is intentionally excluded.

Fixes temporalio/sdk-python#1852
Fixes temporalio/sdk-python#1853
Fixes temporalio/sdk-python#1855

Validation

  • make format
  • make lint
  • make sync
  • make test PYTEST_ARGS="tests/test_openai_tracing.py::test_tracing -q" (10/10 stress attempts passed)
  • make test PYTEST_ARGS="tests/test_openai_tracing.py" (24 passed)
  • make test (246 passed before the test-only stabilization)
  • make build
  • repository convention check
  • wheel and sdist checks

Port the tracing fix and regression coverage from temporalio/sdk-python#1856 to the standalone OpenAI Agents integration.

Co-authored-by: 1fanwang <1fannnw@gmail.com>

Co-authored-by: David Hyde <DABH@users.noreply.github.com>
@brianstrauch
brianstrauch requested a review from a team as a code owner September 17, 2026 18:20
@CLAassistant

CLAassistant commented Sep 17, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Port the validated test stabilization from temporalio/sdk-python#1870 to the standalone OpenAI Agents integration.
@brianstrauch
brianstrauch force-pushed the fix/openai-agents-trace-context branch from 5e7f40a to d46dc70 Compare September 17, 2026 18:35
@brianstrauch
brianstrauch merged commit 0009d04 into main Sep 17, 2026
14 checks passed
@brianstrauch
brianstrauch deleted the fix/openai-agents-trace-context branch September 17, 2026 21:33
tconley1428 pushed a commit to temporalio/sdk-python that referenced this pull request Oct 5, 2026
The OpenAI Agents OTel interceptor, the only caller of seed_span_id and
seed_trace_id, now propagates the caller's span as a remote parent instead
of re-minting it under the caller's IDs (temporalio/ai-integrations#26), and
#1868 removes it from this repository. Drop the two methods, their
context-local seed queues, the seed-consumption branches in the generate_*
methods, and the test that only exercised the seeding.
tconley1428 pushed a commit to temporalio/sdk-python that referenced this pull request Oct 5, 2026
* Remove TemporalIdGenerator span/trace ID seeding

The OpenAI Agents OTel interceptor, the only caller of seed_span_id and
seed_trace_id, now propagates the caller's span as a remote parent instead
of re-minting it under the caller's IDs (temporalio/ai-integrations#26), and
#1868 removes it from this repository. Drop the two methods, their
context-local seed queues, the seed-consumption branches in the generate_*
methods, and the test that only exercised the seeding.

* condense changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants