fix: only send reasoning.encrypted_content include for supported models#24234
Open
ambition0802 wants to merge 1 commit into
Open
fix: only send reasoning.encrypted_content include for supported models#24234ambition0802 wants to merge 1 commit into
ambition0802 wants to merge 1 commit into
Conversation
Prevent HTTP 400 errors when using OpenAI models that don't support encrypted reasoning content (e.g., gpt-4o, gpt-4o-mini) with the Responses API. The codex transport and auxiliary client previously sent include=["reasoning.encrypted_content"] unconditionally for all non-xAI, non-GitHub models. However, only o-series (o1, o3) and gpt-5 models support this parameter. GPT-4o, GPT-4o-mini, and older models reject it with: "Encrypted content is not supported with this model". Changes: - Add openai_supports_encrypted_content() function in agent/model_metadata.py to check if a model supports the encrypted reasoning content parameter - Update agent/transports/codex.py to only send the include parameter for supported models - Update agent/auxiliary_client.py similarly for auxiliary codex calls - Also remove include=[] when reasoning is disabled to avoid potential issues with some models - Add test coverage for the new function Fixes: NousResearch#23450
Collaborator
This was referenced Jun 2, 2026
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
Prevent HTTP 400 errors when using OpenAI models that don't support encrypted reasoning content (e.g., gpt-4o, gpt-4o-mini) with the Responses API.
The codex transport and auxiliary client previously sent
include=["reasoning.encrypted_content"]unconditionally for all non-xAI, non-GitHub models. However, only o-series (o1, o3) and gpt-5 models support this parameter. GPT-4o, GPT-4o-mini, and older models reject it with:Changes Made
agent/model_metadata.py: Added
openai_supports_encrypted_content()function to check if a model supports the encrypted reasoning content parameter. Uses an allowlist approach (conservative - only known-supported models get the parameter).agent/transports/codex.py: Updated to only send the
includeparameter for models that support encrypted content. Also removedinclude=[]when reasoning is disabled to avoid potential issues with some models.agent/auxiliary_client.py: Updated the auxiliary client's codex completions adapter with the same check.
tests/agent/test_encrypted_content_support.py: Added test coverage for the new function.
Fixes
#23450
Testing
openai_supports_encrypted_content()passChecklist