fix: use /responses for GitHub Copilot codex models#2320
fix: use /responses for GitHub Copilot codex models#2320Keryer wants to merge 2 commits intologancyang:masterfrom
Conversation
Route Copilot codex models away from /chat/completions to avoid 400 errors, and keep ping/model verification aligned with runtime routing.
|
Nice work! CI passes and the routing approach is sound. Two suggestions before merging: 1. Deduplicate
|
…store rationale comments Cache the result in useCopilotResponses in both createModelInstance() and tryPing() instead of calling the helper multiple times per flow. Restore Reason comments removed in c96a9d8 that document non-obvious constraints: why ChatOpenAICompletions is used over ChatOpenAI, the delta.role fallback to avoid broken tool_call_chunks, defaultRole?: any type choice, streamUsage/baseURL SDK behavior, and the typeof Request guard for Obsidian mobile runtimes.
|
@Emt-lin I deduplicated the |
|
@Keryer Thanks for your PR. Ready to merge cc @logancyang |
Summary
Fix GitHub Copilot-authenticated Codex models (for example
gpt-5.3-codex) failing with HTTP 400 because they were being sent to/chat/completions.GitHub Copilot Codex models should use the
/responsesendpoint instead. This PR adds provider-side routing so Copilot Codex modelsuse Responses API, while other Copilot chat-compatible models continue using Chat Completions.
Root Cause
The GitHub Copilot chat path was hardwired to
ChatOpenAICompletions, which always targets/chat/completions.That works for normal Copilot chat models, but fails for Codex-family models that only support
/responses.Changes
GitHubCopilotResponsesModelfor Copilot models that must call/responsesGitHubCopilotChatModelbehavior for models that still support/chat/completionsBehavior After This PR
gpt-5.3-codexwith GitHub Copilot auth no longer hits/chat/completions/responsesTesting
gpt-5.3-codex/chat/completionsNotes
This change is intentionally provider-scoped and generalizable:
it avoids hardcoding a single model at the call site and instead routes GitHub Copilot Codex-family models through the correct API.