Skip to content

fix: preserve required IDs in OpenAI conversation items#2897

Draft
yu2001-s wants to merge 2 commits intoopenai:mainfrom
yu2001-s:codex/preserve-required-tool-call-ids
Draft

fix: preserve required IDs in OpenAI conversation items#2897
yu2001-s wants to merge 2 commits intoopenai:mainfrom
yu2001-s:codex/preserve-required-tool-call-ids

Conversation

@yu2001-s
Copy link
Copy Markdown
Contributor

Fixes #2865

Summary

  • only strip id from conversation items when the Conversations API shape is known to tolerate it (role == "user" and type == "function_call_output")
  • preserve required IDs for built-in tool-call items such as file_search_call, web_search_call, and code_interpreter_call during OpenAI Conversations persistence
  • add direct sanitizer coverage and save_result_to_session() regression tests for the OpenAI Conversations path

Testing

  • uv run ruff check src/agents/run_internal/session_persistence.py tests/test_run_internal_items.py tests/test_agent_runner.py
  • uv 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

@seratch seratch changed the title [codex] Preserve required IDs in OpenAI conversation items fix: preserve required IDs in OpenAI conversation items Apr 15, 2026
@github-actions github-actions bot added the bug Something isn't working label Apr 16, 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:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_sanitize_openai_conversation_item strips required id from built-in tool-call items

1 participant