fix: wrap copilot Responses-API models in CodexAuxiliaryClient for auxiliary tasks - #6953
Closed
hermes-agent-dhabibi wants to merge 3 commits into
Closed
Conversation
…xiliary tasks
GPT-5+ models (except gpt-5-mini) are only accessible via the Responses
API on Copilot. When these models were configured as the compression
summary_model (or any auxiliary task), the plain OpenAI client sent them
to /chat/completions which returned a 400 error:
model "gpt-5.4-mini" is not accessible via the /chat/completions endpoint
resolve_provider_client() now checks _should_use_copilot_responses_api()
for the copilot provider and wraps the client in CodexAuxiliaryClient
when needed, routing calls through responses.stream() transparently.
Adds tests for both the wrapping (gpt-5.4-mini) and non-wrapping
(gpt-4.1-mini) paths.
hermes-agent-dhabibi
force-pushed
the
pr/copilot-responses-api-auxiliary
branch
from
April 10, 2026 04:35
5e7e9b1 to
f79fa17
Compare
Contributor
|
Merged via #7541 with authorship preserved. Thanks for the contribution! |
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.
Problem
GPT-5+ models (except
gpt-5-mini) are only accessible via the Responses API on Copilot. When one of these models is configured as the auxiliary/compressionsummary_modelwithsummary_provider: copilot, the plainOpenAIclient sends the request to/chat/completions, which returns:Root Cause
resolve_provider_client()creates a plainOpenAIclient for thecopilotprovider regardless of which model is requested. TheCodexAuxiliaryClientadapter (which routes throughresponses.stream()) was only used for theopenai-codexprovider branch, notcopilot.Fix
After creating the
OpenAIclient in the copilot path, check_should_use_copilot_responses_api(model). If the model requires the Responses API, wrap the client inCodexAuxiliaryClientsocall_llm()transparently routes throughresponses.stream().Tests
test_copilot_responses_api_model_wrapped_in_codex_client— verifiesgpt-5.4-minigets wrapped inCodexAuxiliaryClienttest_copilot_chat_completions_model_not_wrapped— verifiesgpt-4.1-ministays as a plainOpenAIclient