fix: preserve unsafe integers in OpenAI trace payloads#3438
Closed
pragnyanramtha wants to merge 1 commit into
Closed
fix: preserve unsafe integers in OpenAI trace payloads#3438pragnyanramtha wants to merge 1 commit into
pragnyanramtha wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2094 by normalizing trace
input/outputfields sent to the default OpenAI tracing ingest endpoint so integers outside JavaScript's safe integer range are stringified before browser-based trace viewers can round them. Runtime tool inputs and custom tracing endpoints are unchanged.Root cause: function trace inputs can contain JSON strings or structured payloads with Python integers larger than
Number.MAX_SAFE_INTEGER. Those values are valid JSON numbers, but browser JSON viewers can lose precision when parsing/displaying them.Change:
input/outputpayloads.Test plan
uv run pytest tests/test_trace_processor.py -k 'unsafe_integers or keeps_unsafe_integers or truncates_oversized_output or keeps_small_input'uv run pytest tests/test_trace_processor.py -m 'not serial'uv run ruff format --check src/agents/tracing/processors.py tests/test_trace_processor.pyuv run ruff check src/agents/tracing/processors.py tests/test_trace_processor.pygit diff --checkNot run to completion:
uv run pytest tests/test_trace_processor.pybecause existing serial testtest_tracing_atexit_cleanup_timeout_preserves_process_exit_code_on_504timed out; rerunning that single test also timed out.uv run mypy src/agents/tracing/processors.py tests/test_trace_processor.pybecause it produced no output for several minutes and was stopped.Issue number
Fixes #2094
Checks
make lintandmake formatNotes: no docs were needed for this internal tracing-export normalization. I ran focused
ruffformat/lint checks on the touched files rather than fullmake lint/make format.