fix(openai): drop response item ids when store is false - #38372
Merged
Mason Daugherty (mdrxy) merged 7 commits intoJun 22, 2026
Conversation
Mason Daugherty (mdrxy)
temporarily deployed
to
Scheduled testing
June 22, 2026 22:08 — with
GitHub Actions
Inactive
Mason Daugherty (mdrxy)
temporarily deployed
to
Scheduled testing
June 22, 2026 22:08 — with
GitHub Actions
Inactive
Mason Daugherty (mdrxy)
deleted the
mdrxy-openai-store-false-response-ids
branch
June 22, 2026 22:27
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.
Some Responses API conversations can safely replay prior response item IDs because the server stored those items. That assumption breaks when
store=False: priorrs_*reasoning items andmsg_*assistant message IDs are not available on the server for the next turn, so replaying them can crash withItem with id 'rs_...' not foundor similar item lookup errors.This updates the Responses API payload builder to treat
store=Falseas a stateless replay mode. The visible assistant text is still preserved in history, but server-side response item IDs are not sent back unless they are usable without server persistence.In practical terms:
rs_*reasoning items are dropped forstore=Falsebecause they only reference server-side state that was not stored.encrypted_contentare preserved because OpenAI uses them as the stateless/ZDR way to carry reasoning context forward.msg_*IDs are omitted forstore=False; the assistant message is replayed as ordinary assistant text instead of as a reference to a stored server item.Dropping
msg_*IDs in this case should not remove useful user-visible context: the text content remains in the request. It only removes an item identity that the server cannot reliably resolve whenstore=False. Persistedstore=TrueResponses flows continue to replay item IDs as before.The regression test mirrors the minimal user story: make one Responses/Codex call, reuse the returned
AIMessagein a follow-up request, and verify the next payload keeps the visible assistant message and encrypted reasoning context while omitting unresolvable bare item references.