Skip to content

fix(tracing): sanitize non-finite span payloads - #4556

Closed
sylvesterkaczmarek wants to merge 1 commit into
openai:mainfrom
sylvesterkaczmarek:fix/tracing-nonfinite-json
Closed

fix(tracing): sanitize non-finite span payloads#4556
sylvesterkaczmarek wants to merge 1 commit into
openai:mainfrom
sylvesterkaczmarek:fix/tracing-nonfinite-json

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

This pull request fixes OpenAI tracing normalization so non-finite float values cannot bypass the existing JSON sanitizer merely because the surrounding input or output field is small.

BackendSpanExporter._value_json_size_bytes() now measures payloads using strict JSON semantics with allow_nan=False. A field containing NaN, Infinity, or -Infinity therefore follows the existing unserializable-value path, where _sanitize_json_compatible_value() removes the invalid nested value before the tracing payload is sent. Finite JSON payloads keep the existing fast path and are unchanged.

The change deliberately reuses the current OpenAI-ingest sanitization boundary instead of introducing another recursive traversal. Focused regression coverage exercises both input and output, all three non-finite float forms, preservation of valid sibling data, and a finite control case.

This pull request resolves #4551.

@seratch

seratch commented Aug 21, 2026

Copy link
Copy Markdown
Member

Closing this for the reason at #4551 (comment)

@seratch seratch closed this Aug 21, 2026
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.

tracing: non-finite span input/output bypasses JSON sanitization

2 participants