Conversation
6 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for isolating the original api_mode handoff issue. Current main has since taken an intentionally different safety direction.
Problems
run_agent.py:1397-1401now explicitly keeps genericprovider="custom"GPT-5 relays on Chat Completions because they may not implement full Responses semantics. Commit0e4c879added this policy and regression coverage forhttps://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 inagent/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.
| @@ -1265,7 +1265,7 @@ def __init__( | |||
| # does NOT support the Responses API — skip the upgrade for Azure | |||
Collaborator
There was a problem hiding this comment.
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.
This was referenced Jul 28, 2026
Closed
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
Fix the auto-upgrade guard in
AIAgent.__init__that prevents custom providers from switching tocodex_responsesmode for GPT-5.x models.Problem
The condition
api_mode is Noneat line ~1268 ofrun_agent.pyis alwaysFalsefor custom providers, becauseruntime_provider.pyalways passesapi_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
Allows the default
chat_completionsto be auto-upgraded for GPT-5.x, while still respecting explicitly chosen non-default modes.Fixes #23893