Skip to content

Conversation

@OiPunk
Copy link
Contributor

@OiPunk OiPunk commented Feb 9, 2026

Summary

This PR fixes the tracing regression reported in #2444 where OpenAI trace ingestion rejects payloads containing span_data.usage.requests.

Root cause

GenerationSpanData.usage started including SDK-specific fields such as requests. The OpenAI tracing ingestion endpoint does not accept that field and returns:

Unknown parameter: 'data[...].span_data.usage.requests'

Changes

  • Add OpenAI-ingest sanitization in BackendSpanExporter before POST.
  • For generation spans, keep only tracing-compatible usage keys:
    • input_tokens
    • output_tokens
    • total_tokens
    • input_tokens_details
    • output_tokens_details
  • Preserve non-generation span payloads unchanged.
  • Add regression tests covering:
    • unsupported usage keys are removed (requests)
    • non-generation usage is untouched
    • generation usage with only allowed keys is untouched
    • non-dict generation usage is safely ignored

Validation

  • uv run ruff check src/agents/tracing/processors.py tests/test_trace_processor.py
  • env -u ALL_PROXY -u all_proxy -u HTTPS_PROXY -u https_proxy -u HTTP_PROXY -u http_proxy uv run mypy src/agents/tracing/processors.py
  • env -u ALL_PROXY -u all_proxy -u HTTPS_PROXY -u https_proxy -u HTTP_PROXY -u http_proxy uv run pytest -q tests/tracing/test_processor_api_key.py tests/test_trace_processor.py
  • env -u ALL_PROXY -u all_proxy -u HTTPS_PROXY -u https_proxy -u HTTP_PROXY -u http_proxy uv run coverage run -m pytest -q tests/test_trace_processor.py
  • env -u ALL_PROXY -u all_proxy -u HTTPS_PROXY -u https_proxy -u HTTP_PROXY -u http_proxy uv run coverage report -m src/agents/tracing/processors.py

Changed-line coverage for src/agents/tracing/processors.py is 100%.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc5317189b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@seratch seratch added this to the 0.8.x milestone Feb 9, 2026
@seratch seratch added the bug Something isn't working label Feb 9, 2026
@seratch
Copy link
Member

seratch commented Feb 9, 2026

Closing this in favor of #2448 (the credit for your contribution is kept)

@seratch seratch closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants