fix(openai): avoid orphaned Responses item ids - #13054
Open
d3f4w2 wants to merge 1 commit into
Open
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Description
Fixes #12935.
The OpenAI adapter reconstructs Responses API input from Chat Completions history. That history does not contain the separate Responses reasoning item or output-item identity, but the converter was inventing
msg_*IDs for assistant messages and treatingfc_*tool-call correlation IDs as Responses output-item IDs. On the following tool turn, the Responses API can therefore require a reasoning item that the reconstructed history cannot provide.This change:
msg_*output-item ID;call_id, instead of also treatingfc_*values as Responses item IDs;This is separate from the core converter's context-compaction sanitizer: this path is the standalone
packages/openai-adaptersChat Completions-to-Responses adapter, where reasoning/output-item metadata is unavailable by construction.AI assistance disclosure: Codex assisted with investigation, implementation, and tests; I reviewed the resulting diff and validation results.
AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
Not applicable: this fixes request serialization and is covered by adapter regression tests.
Tests
cd packages/openai-adapters && npm test -- --run— 145 passed, 5 skippedcd packages/openai-adapters && npm run buildnpx prettier --check packages/openai-adapters/src/apis/openaiResponses.ts packages/openai-adapters/src/test/openai-responses.vitest.tsgit diff --check