You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Session-backed runs can end up replaying reasoning items with server-assigned rs_... IDs from prior turns. Those IDs are not guaranteed to be stable across turns, and replaying them can trigger a 404 ("Item with id 'rs_...' not found") in a subsequent responses.create call.
This change strips the id field from reasoning items loaded from non-Conversations sessions before building model input, so the reasoning payload can still be replayed without relying on server-side item retention.
Tests:
uv run ruff format src/agents/run_internal/session_persistence.py tests/test_agent_runner.py
uv run ruff check src/agents/run_internal/session_persistence.py tests/test_agent_runner.py
uv run pyright --project pyrightconfig.json src/agents/run_internal/session_persistence.py tests/test_agent_runner.py
Could you add this check in the _strip_reasoning_item_ids_from_history_item for this case?
# Drop the item entirely if summary is missing or empty if not sanitized.get("summary"): return None
`
{
"input":[
{
"content":"User id is u_123. Help me choose the best subscription plan.",
"role":"user"
},
{
"id":"rs_0b61d86498c245ce016a17c138fc588199b2a78d6a1b3a6776",
"summary":[
Done in 13e004c. I changed the session-history sanitizer to drop replayed reasoning items when summary is missing or empty, while still preserving reasoning items that have a summary and stripping only their id.
Ran: uv run pytest tests/test_agent_runner.py::test_prepare_input_with_session_strips_reasoning_item_ids_from_history tests/test_agent_runner.py::test_prepare_input_with_session_drops_reasoning_items_without_summary
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
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 #2020
Session-backed runs can end up replaying
reasoningitems with server-assignedrs_...IDs from prior turns. Those IDs are not guaranteed to be stable across turns, and replaying them can trigger a 404 ("Item with id 'rs_...' not found") in a subsequentresponses.createcall.This change strips the
idfield fromreasoningitems loaded from non-Conversations sessions before building model input, so the reasoning payload can still be replayed without relying on server-side item retention.Tests: