refactor(copilot): extract buildCopilotModelsRequest to deduplicate /models auth headers#5518
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Copilot API proxy provider to avoid duplicated construction of the Copilot /models request, reducing the risk of header/auth drift between validation and startup model-fetch behavior.
Changes:
- Extracted
buildCopilotModelsRequest(extra = {})insidecreateCopilotAdapterto build the standard/modelsGET request object. - Updated
getValidationProbeand the standard-target branch ofgetModelsFetchConfigto use the shared helper. - Left the BYOK/custom provider branch intentionally separate.
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/providers/copilot.js | Deduplicates /models request construction by extracting a helper used by both validation probing and startup model-fetch config. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
❌ Smoke Gemini reports failed. Facets need polishing... |
|
🔌 Smoke Services — Service connectivity failed |
|
❌ Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed... |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
🔑 Smoke Copilot PAT reports failed. PAT auth path may have issues... |
|
❌ Contribution Check failed. Please review the logs for details. |
|
Chroot tests failed Smoke Chroot failed - See logs for details. |
|
Build Test Failed Build Test Suite - See logs for details |
|
📡 Smoke OTel Tracing reports failed. OTel tracing regression detected. |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
❌ Smoke Copilot BYOK reports failed. BYOK mode investigation needed... |
|
❌ Smoke Claude failed |
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed... |
|
❌ Security Guard failed. Please review the logs for details. |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
❌ Security Guard failed. Please review the logs for details. |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
✅ Smoke Claude passed |
🔥 Smoke Test Results
PR: refactor(copilot): extract buildCopilotModelsRequest to deduplicate /models auth headers Overall: PARTIAL PASS — MCP verified ✅; pre-step outputs unavailable (pipeline variable expansion issue).
|
🔬 Smoke Test: Copilot PAT Auth — PR #5518
Overall: PASS (2/2 verifiable tests passed; file test skipped due to unexpanded workflow variables) PR: refactor(copilot): extract buildCopilotModelsRequest to deduplicate /models auth headers
|
Smoke Test: Claude Engine Validation
Overall Result: PASS
|
|
Smoke Test: Copilot BYOK Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar. Status: PASS
|
|
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
Merged PRs:
✅ GitHub PR list Overall status: PASS 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.
|
Smoke Test Results — FAIL
Overall: FAIL
|
🔬 Smoke Test: API Proxy OpenTelemetry Tracing
All 5 scenarios pass. ✅
|
|
Smoke test PASS for:
|
Chroot Version Comparison Results
Overall: ❌ FAILED — Python and Node.js versions differ between host and chroot environments.
|
Smoke Test Results: Gemini\n- PR #5523: refactor(api-proxy): extract sliding-window data structure into rate-limiter-window.js ✅\n- PR #5522: refactor: split agent-volumes-mounts.test.ts by feature area ✅\n- GitHub.com Connectivity: 200 ✅\n- File Writing & Bash Tooling: Verified ✅\n\nOverall status: PASSWarning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
getValidationProbeandgetModelsFetchConfigincopilot.jseach independently constructed the same/modelsGET request object — identical URL,Authorization, andCopilot-Integration-Idheaders — with no shared source of truth. Any drift (token prefix change, new header, auth mode change) would require matching edits in both places.Changes
buildCopilotModelsRequest(extra = {})— a closure-scoped helper insidecreateCopilotAdapterthat builds the standard/modelsGET request usinggithubTokenandintegrationId.getValidationProbecalls it with no args;getModelsFetchConfigpasses{ cacheKey: 'copilot' }as the extra spread.getModelsFetchConfig(usesapiKey, custommodelsPath) is left intentionally separate — it is a distinct auth mode, not a duplicate.