🤖 fix: align GitHub Copilot model routing#3104
Conversation
Add an optional gateway accessibility callback to route resolution helpers and cover the new fallback behavior in routing tests.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f61c5df1c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 553a7ba923
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36537b7ed2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review Pushed a follow-up fix so direct |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6ce621ba2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c6ce621 to
dfbb329
Compare
|
@codex review Follow-up push: I stabilized the |
dfbb329 to
719288e
Compare
|
@codex review Follow-up push: explicit compaction suggestions now apply the same authoritative Copilot catalog check as model selection, so stale |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfbb329aac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
719288e to
56a866a
Compare
|
@codex review Follow-up push: explicit gateway route resolution now applies the same catalog accessibility check on both explicit-gateway and direct-gateway paths, so stale |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56a866ac03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
56a866a to
3e263d7
Compare
Keep the Copilot Responses language model tests behavior the same while addressing file-specific ESLint failures.
|
@codex review Major additions:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea5c726ce0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Fix: stabilized the new Anthropic Copilot useRouting test to avoid the same async config fetch race condition as the previous test. |
|
@codex review Stabilized the Anthropic Copilot useRouting test: it now waits for both provider config and routing priority to load before asserting |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review Fixed both issues:
|
|
@codex review Applied both fixes from the previous Codex review:
|
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review Simplified the flaky Anthropic Copilot useRouting test to only assert |
|
@codex review Simplified the flaky Anthropic useRouting test to only assert |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 923bc2c6f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Removed the persistently flaky Anthropic useRouting hook test. The dot-vs-dash normalization is already covered deterministically in |
Delete the CI-flaky Anthropic Copilot hook test from useRouting.test.ts. The remaining coverage stays in deterministic routing and gateway catalog tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fce3d338f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Fixed: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fce3d338f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Limit Claude minor-version rewriting to 1-2 digit segments so date-stamped model IDs stay unchanged unless they include a real short minor version.
|
@codex review Fixed: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c8c83a0ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { createOpenAI } = await PROVIDER_REGISTRY.openai(); | ||
| const provider = createOpenAI({ | ||
| name: "github-copilot", | ||
| baseURL, | ||
| apiKey: "copilot", // placeholder — actual auth via custom fetch | ||
| apiKey: "copilot", // placeholder, actual auth via custom fetch | ||
| fetch: providerFetch, | ||
| }); | ||
| return Ok(provider.chatModel(modelId)); | ||
| return Ok(provider.chat(outboundCopilotModelId)); |
There was a problem hiding this comment.
Keep Copilot chat provider-options namespace compatible
Switching non-Codex Copilot routing to createOpenAI().chat(...) means routed OpenAI models no longer read the "github-copilot" provider-options namespace that buildProviderOptions emits for OpenAI-through-Copilot requests (src/common/utils/ai/providerOptions.ts, origin === "openai" && formatProvider !== origin). In practice, when openai:gpt-* is routed via GitHub Copilot, settings like reasoningEffort are silently ignored because OpenAI chat parsing looks at providerOptions.openai, so thinking-level behavior regresses for those Copilot chat requests.
Useful? React with 👍 / 👎.
Summary
This PR aligns GitHub Copilot model routing with the account's model catalog. All non-Codex models use chat completions. Codex models use a custom Responses language model that handles Copilot's SSE stream format. Copilot can now route Anthropic and Google models (with dot-vs-dash ID normalization). Catalog entries are hidden from the selector.
Background
Copilot auth persisted the signed-in user's model list, but routing ignored it and only routed OpenAI models. Non-OpenAI Copilot models (Claude, Gemini) were unreachable. Codex models were stuck:
/chat/completionsrejects them, and the standard AI SDK Responses parser can't handle Copilot's SSE stream format. Additionally, Copilot's catalog uses dot-form Claude IDs (claude-opus-4.6) while Mux's built-in models use dashes (claude-opus-4-6).Implementation
CopilotResponsesLanguageModelthat handles Copilot's Responses API SSE stream directly, bypassing the AI SDK's broken parser (following opencode's approach)anthropicandgoogle4.6matches4-6) so Copilot catalog entries match built-in modelsgithub-copilot:*entries from the model selector while keeping the catalog for route gatingValidation
make static-checkbun test src/common/utils/copilot/modelRouting.test.ts src/node/services/providerModelFactory.test.ts src/node/services/copilot/copilotResponsesLanguageModel.test.ts src/browser/hooks/useRouting.test.ts src/browser/hooks/useModelsFromSettings.test.ts src/common/routing/resolve.test.ts src/browser/utils/compaction/suggestion.test.ts src/common/utils/providers/gatewayModelCatalog.test.tsRisks
Medium. The custom
CopilotResponsesLanguageModelis a new language model implementation that directly parses Copilot's SSE stream. It's scoped to Codex-family models only to minimize blast radius. Tool call streaming is not yet covered (text-only). Adding Anthropic/Google to Copilot routes means users with both Copilot and direct API keys will route through Copilot when it's prioritized (the priority system is user-controlled and defaults to["direct"]).Generated with
mux• Model:openai:gpt-5.4• Thinking:xhigh• Cost:$23.81