fix: preserve required IDs in OpenAI conversation items#2897
Draft
yu2001-s wants to merge 2 commits intoopenai:mainfrom
Draft
fix: preserve required IDs in OpenAI conversation items#2897yu2001-s wants to merge 2 commits intoopenai:mainfrom
yu2001-s wants to merge 2 commits intoopenai:mainfrom
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.
Fixes #2865
Summary
idfrom conversation items when the Conversations API shape is known to tolerate it (role == "user"andtype == "function_call_output")file_search_call,web_search_call, andcode_interpreter_callduring OpenAI Conversations persistencesave_result_to_session()regression tests for the OpenAI Conversations pathTesting
uv run ruff check src/agents/run_internal/session_persistence.py tests/test_run_internal_items.py tests/test_agent_runner.pyuv run pytest -q tests/test_run_internal_items.py::test_sanitize_openai_conversation_item_preserves_required_tool_call_ids tests/test_agent_runner.py::test_save_result_to_session_preserves_required_built_in_tool_call_ids tests/test_agent_runner.py::test_save_result_to_session_sanitizes_original_input_items tests/test_agent_runner.py::test_save_result_to_session_keeps_tool_call_payload_api_safe