fix(openai): preserve tools on websocket transcript replacement - #5420
Open
DarkPaper2022 wants to merge 1 commit into
Open
fix(openai): preserve tools on websocket transcript replacement#5420DarkPaper2022 wants to merge 1 commit into
DarkPaper2022 wants to merge 1 commit into
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.
Summary
Problem
Codex sends model-visible tool declarations in the WebSocket prewarm request. When resuming or forking an existing thread, the next request can carry a complete transcript and a prewarm previous_response_id while omitting additional_tools.
For an HTTP/SSE upstream, CLIProxyAPI cannot retain the synthetic prewarm response chain. It removes previous_response_id and forwards the replacement transcript, but previously discarded the prewarm tool declarations. The model then receives the full conversation without shell or other client tools and correctly reports that they are unavailable.
The fix prepends only the previous request additional_tools items when the replacement input does not already include them. It does not merge stale conversation items, and current declarations win when present.
Related reports:
/modelrestores them openai/codex#41265 describes the same user-visible loss of all tools after resume or fork through a custom Responses endpoint.Validation