Skip to content

fix: allow Responses API auto-upgrade for custom providers serving GPT-5.x - #23895

Open
moxi-2534 wants to merge 1 commit into
NousResearch:mainfrom
moxi-2534:fix/custom-provider-responses-api-upgrade
Open

moxi-2534 wants to merge 1 commit into
NousResearch:mainfrom
moxi-2534:fix/custom-provider-responses-api-upgrade

Conversation

@moxi-2534

Copy link
Copy Markdown

Summary

Fix the auto-upgrade guard in AIAgent.__init__ that prevents custom providers from switching to codex_responses mode for GPT-5.x models.

Problem

The condition api_mode is None at line ~1268 of run_agent.py is always False for custom providers, because runtime_provider.py always passes api_mode="chat_completions" explicitly. This means _provider_model_requires_responses_api() (which correctly detects GPT-5.x) never gets a chance to trigger the upgrade.

Users with custom OpenAI-compatible proxies (Codex Manager, one-api, etc.) serving GPT-5.x models get empty responses on every tool call.

Fix

-            api_mode is None
+            (api_mode is None or api_mode == "chat_completions")

Allows the default chat_completions to be auto-upgraded for GPT-5.x, while still respecting explicitly chosen non-default modes.

Fixes #23893

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openai OpenAI / Codex Responses API labels May 11, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for isolating the original api_mode handoff issue. Current main has since taken an intentionally different safety direction.

Problems

  • run_agent.py:1397-1401 now explicitly keeps generic provider="custom" GPT-5 relays on Chat Completions because they may not implement full Responses semantics. Commit 0e4c879 added this policy and regression coverage for https://relay.example.com/v1.
  • The proposed api_mode == "chat_completions" branch would also override an explicitly supplied Chat Completions mode, contrary to the contract documented in agent/agent_init.py:481-482.
  • The target initialization code moved to agent/agent_init.py:486-505; this one-line patch no longer applies to current main.

Suggested changes

  • Any follow-up should use a verified endpoint capability signal or a named-provider configuration path, while retaining the plain-custom-relay safeguard.
  • Add coverage for both a Responses-capable proxy and a GPT-5 relay that only supports Chat Completions.

Automated hermes-sweeper review.

Comment thread run_agent.py
@@ -1265,7 +1265,7 @@ def __init__(
# does NOT support the Responses API — skip the upgrade for Azure

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current main intentionally keeps generic provider="custom" GPT-5 relays on Chat Completions (run_agent.py:1397-1401, commit 0e4c879) because many OpenAI-compatible relays do not implement full Responses semantics. This broad condition would undo that regression fix and also override an explicit api_mode="chat_completions" choice.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPT-5.x models on custom providers never auto-upgrade to Responses API

3 participants