Skip to content

fix: only send reasoning.encrypted_content include for supported models#24234

Open
ambition0802 wants to merge 1 commit into
NousResearch:mainfrom
ambition0802:fix/openai-include-encrypted-content
Open

fix: only send reasoning.encrypted_content include for supported models#24234
ambition0802 wants to merge 1 commit into
NousResearch:mainfrom
ambition0802:fix/openai-include-encrypted-content

Conversation

@ambition0802

Copy link
Copy Markdown
Contributor

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:

Encrypted content is not supported with this model

Changes Made

  1. 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).

  2. agent/transports/codex.py: Updated to only send the include parameter for models that support encrypted content. Also removed include=[] when reasoning is disabled to avoid potential issues with some models.

  3. agent/auxiliary_client.py: Updated the auxiliary client's codex completions adapter with the same check.

  4. tests/agent/test_encrypted_content_support.py: Added test coverage for the new function.

Fixes

#23450

Testing

  • All unit tests for openai_supports_encrypted_content() pass
  • Verified the function correctly identifies supported models (gpt-5, o1, o3) and unsupported models (gpt-4o, gpt-4o-mini, etc.)
  • The allowlist approach ensures future models that don't support this parameter won't break

Checklist

  • Code follows the project style guidelines
  • Tests have been added or updated
  • Documentation has been updated if needed
  • All existing tests pass

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
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder provider/openai OpenAI / Codex Responses API labels May 12, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix for #23450 — see also PR #23460 which takes a simpler approach (removes include entirely for non-xAI/non-GitHub). This PR uses an allowlist approach (only sends include for o-series/gpt-5). Maintainers should pick one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants