fix(api-proxy): gpt-5.4-mini routed to /chat/completions instead of /responses#3212
Conversation
|
@copilot address review feedback |
Found one area to clean up: the test
|
Smoke Test Results
Summary: 2/3 PASS — Playwright navigation and file I/O working; GitHub API blocked by expected credential isolation.
|
Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Overall: PARTIAL — BYOK inference confirmed ✅; pre-step template variables were not expanded into the prompt.
|
🔬 Smoke Test Results — Copilot Engine
Overall: PASS
|
|
✅ GitHub PR review: Refactor api-proxy SIGTERM/SIGINT shutdown flow into a shared handler; Cap Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Chroot Version Comparison Results
Result: Some versions differ between host and chroot. Go matches, but Python and Node.js are on different versions.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes Copilot BYOK + strict AWF-mode failures for GPT‑5-family models by ensuring the sidecar uses the correct wire API (/responses) and by adjusting Copilot credential selection so a real BYOK API key is used for inference when both BYOK and GitHub OAuth tokens are present.
Changes:
- Expanded BYOK-mode wire-API test coverage to include
gpt-5.4-miniforCOPILOT_PROVIDER_WIRE_API=responses. - Updated Copilot provider auth-token resolution to prefer
COPILOT_API_KEYoverCOPILOT_GITHUB_TOKEN(while still treating the AWF placeholder key as absent). - Updated/added unit tests to reflect and validate the new auth-token precedence.
Show a summary per file
| File | Description |
|---|---|
src/services/api-proxy-service.test.ts |
Adds gpt-5.4-mini to the BYOK responses-wire-API parameterized test to close a coverage gap. |
containers/api-proxy/server.auth.test.js |
Updates tests for the new auth-token precedence and adds coverage for BYOK+token inference header selection. |
containers/api-proxy/providers/copilot.js |
Changes token resolution order so a real BYOK key is preferred over a GitHub OAuth token. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
| * The Copilot /models endpoint only accepts COPILOT_GITHUB_TOKEN (GitHub OAuth). | ||
| * All other requests use the resolved auth token (COPILOT_GITHUB_TOKEN or COPILOT_API_KEY). | ||
| * All other requests use the resolved auth token (COPILOT_API_KEY when real, otherwise COPILOT_GITHUB_TOKEN). | ||
| * |
Smoke Test Results
Overall: FAIL — service containers appear unreachable from this runner environment.
|
Smoke Test Results (Gemini)
Overall Status: FAIL Merged PRs found:
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
Bug Fix
What was the bug?
GPT-5-family models (e.g.
gpt-5.4-mini) require the/responseswire API but were routed to/chat/completionsin strict AWF mode, producing400 model "gpt-5.4-mini" is not accessible via the /chat/completions endpoint. Two interacting root causes:COPILOT_PROVIDER_WIRE_API=responseswas only set inside thecopilotApiKeybranch inapi-proxy-service.ts— bypassed when auth flows throughCOPILOT_GITHUB_TOKEN.resolveCopilotAuthToken()incopilot.jsunconditionally preferredCOPILOT_GITHUB_TOKENoverCOPILOT_API_KEY, so even when a real BYOK key was configured alongside a GitHub token, the sidecar sent the GitHub OAuth token to the third-party provider.How did you fix it?
api-proxy-service.ts(already applied in base): MovedCOPILOT_PROVIDER_WIRE_API=responsesout of thecopilotApiKey-only branch into thecopilotGithubToken || copilotApiKeyblock, keyed solely onrequiresResponsesWireApi(copilotModel).containers/api-proxy/providers/copilot.js: Reversed token-resolution priority inresolveCopilotAuthToken— realCOPILOT_API_KEYnow wins overCOPILOT_GITHUB_TOKEN. The AWF placeholder is still filtered byresolveApiKey, so the standard GitHub Copilot path (dummy key + real GitHub token) is unchanged.Testing
resolveCopilotAuthTokenunit tests inserver.auth.test.jsto reflect the new priority order.COPILOT_API_KEYis used for inference in BYOK+token mode (non-/modelspath).gpt-5.4-minito the BYOK-modeCOPILOT_PROVIDER_WIRE_API=responsesparameterized test inapi-proxy-service.test.ts, closing a coverage gap vs. the equivalent GitHub-token-mode test.