fix(agent): only upgrade to codex_responses for models that require it#23734
Open
AllynSheep wants to merge 2 commits into
Open
fix(agent): only upgrade to codex_responses for models that require it#23734AllynSheep wants to merge 2 commits into
AllynSheep wants to merge 2 commits into
Conversation
Previously, any direct OpenAI URL (api.openai.com) would trigger an upgrade from chat_completions to codex_responses transport. This caused GPT-4o (which uses Chat Completions API) to receive the `include: ["reasoning.encrypted_content"]` parameter, which is only supported by o1/o3 series via Responses API. Fix: only upgrade to codex_responses when the model actually requires the Responses API (gpt-5.x), not for all api.openai.com models. Fixes NousResearch#23450
Collaborator
|
Likely duplicate of #23460 — both fix the same root cause (codex transport sends This PR removes |
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
Previously, any direct OpenAI URL (
api.openai.com) would trigger an upgrade fromchat_completionstocodex_responsestransport. This caused GPT-4o (which uses Chat Completions API) to receive theinclude: ["reasoning.encrypted_content"]parameter, which is only supported by o1/o3 series via Responses API.Root Cause
In
run_agent.pylines 1267-1282, the condition included_is_direct_openai_url()which returnedTruefor ALLapi.openai.comURLs, even for models that don't support theincludeparameter.Fix
Removed
_is_direct_openai_url()from the upgrade condition. Now the upgrade tocodex_responsesonly happens when_provider_model_requires_responses_api()returnsTrue(i.e, for GPT-5.x models).Testing
api.openai.com/v1now useschat_completionstransport (correct)codex_responsestransportincludeparameter is only sent for models that support Responses APIFixes
Closes #23450