Repository navigation
Honor wire API overrides in Copilot SDK provider resolution - #64969
Conversation
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Automatically inferred Copilot settings can override another provider’s catalog and select an unsupported API.
Review effort: Balanced
Findings: 1
What changed in this PR
Updates gh-aw’s Copilot SDK provider resolution to honor explicit wire API settings, addressing #64965.
Changes:
- Forwards wire API settings and applies valid overrides to the primary non-Anthropic provider.
- Adds regression coverage for catalogs, provider selection, overrides, and fallback models.
- Refreshes generated workflow dependencies and action pins.
| File | Description |
|---|---|
| actions/setup/js/copilot_harness.cjs | Forwards the wire API setting into SDK resolution. |
| actions/setup/js/awf_reflect.test.cjs | Adds wire API override regression cases. |
| actions/setup/js/awf_reflect.cjs | Applies primary-provider overrides. |
| .github/workflows/visual-regression-checker.lock.yml | Updates container pins and network allowlist. |
| .github/workflows/spec-enforcer.lock.yml | Updates the coverage upload action. |
| .github/workflows/purelock.lock.yml | Updates the coverage upload action. |
| .github/aw/actions-lock.json | Downgrades stale-repos and super-linter pins. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| const modelsJson = loadModelsJson(); | ||
|
|
||
| const multiProvider = resolveMultiProviderFromReflect({ model: configuredModel, reflectData: awfReflectData, modelsJson, logger: log }); | ||
| const multiProvider = resolveMultiProviderFromReflect({ model: configuredModel, wireApi: process.env.COPILOT_PROVIDER_WIRE_API, reflectData: awfReflectData, modelsJson, logger: log }); |
There was a problem hiding this comment.
Guarded applyCopilotWireAPI() with !copilotSDKMode so SDK provider resolution retains each provider’s inferred API while still receiving explicit overrides and task-routing selections. Committed as 9f39855.
There was a problem hiding this comment.
SDK mode now skips applyCopilotWireAPI; provider wire APIs remain catalog-inferred unless an explicit override or task-routing selection is supplied. Added GPT-5+ Responses defaults and regression coverage in 9906620.
|
@copilot Quick triage nudge: branch refresh was attempted by sous-chef. Please review the current state of this PR and run the
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. No ADR enforcement needed: PR does not have the 'implementation' label and has <=100 new lines of code in business logic directories.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
|
✅ Ponytail Reviewer completed successfully! Warning Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs for details.
|
Co-authored-by: gh-aw-bot <[email protected]>
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
Request changes
The new wire-API precedence still conflates an explicit override with the auto-configured COPILOT_PROVIDER_WIRE_API, so SDK mode can silently rewrite the fallback provider to the wrong protocol.
Why this blocks merge
applyCopilotWireAPI() runs before resolveMultiProviderFromReflect() and eagerly populates process.env.COPILOT_PROVIDER_WIRE_API from the catalog or the GPT fallback. This patch then unconditionally forwards that env var as options.wireApi, so any time the configured model is missing from reflect data and resolution falls back to the first available model/provider, the fallback provider inherits the configured model’s wire API instead of its own inferred protocol. A concrete failure mode is COPILOT_MODEL=gpt-6-luna with no explicit override, reflect only exposing a completions-only fallback model, and the fallback endpoint being forced onto responses.
The override needs to be limited to values that actually came from an explicit user/workflow setting, or the fallback path needs to recompute against the resolved primary model instead of trusting the pre-populated env var.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 30.6 AIC · ⌖ 7.39 AIC · ⊞ 20.2K
Comment /review to run again
|
@copilot update the models.json with wire information for got 6 models. See #64969 (comment) |
There was a problem hiding this comment.
Applied harden + audit Impeccable modes (bug-fix change type) to this error-routing/edge-case patch.
Blocking: The wire-API override forwards the auto-populated COPILOT_PROVIDER_WIRE_API env var (set by applyCopilotWireAPI() for the originally-configured model) without distinguishing it from an explicit user/workflow setting. When model resolution falls back to a different primary model/provider, this stale override is still applied, silently routing the fallback provider through the wrong wire API. Reproduced locally — see inline comment.
Non-blocking: .github/aw/actions-lock.json downgrades two pinned actions (stale-repos v9.0.19→v9.0.18, super-linter v9.0.0→v8.7.0), unrelated to the stated fix; likely a regeneration artifact worth double-checking.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 59.7 AIC · ⌖ 13.3 AIC · ⊞ 8.1K
| const primaryProviderName = models.find(m => m.id === primaryModel)?.provider; | ||
| const primaryProvider = providers.find(p => p.name === primaryProviderName); | ||
| const wireApi = options?.wireApi; | ||
| if (primaryProvider && primaryProvider.type !== "anthropic" && (wireApi === "responses" || wireApi === "completions")) { |
There was a problem hiding this comment.
options.wireApi is forwarded straight from process.env.COPILOT_PROVIDER_WIRE_API, which by this point may have been auto-populated by applyCopilotWireAPI() for the originally-configured model (catalog lookup or the GPT-prefix heuristic), not necessarily an explicit user/workflow override.
When resolveMultiProviderFromReflect falls back to a different primary model (e.g. the configured model isn't present in reflect data), this auto-inferred wire API — computed for a model that is no longer the one actually selected — gets applied to the fallback provider anyway, silently overriding its correctly-inferred wire API.
Repro: COPILOT_MODEL=gpt-6-luna (not in reflect data) → applyCopilotWireAPI() sets COPILOT_PROVIDER_WIRE_API=responses via the GPT heuristic → resolveMultiProviderFromReflect falls back to a completions-only model from reflect data → that model's provider incorrectly gets wireApi: "responses".
$ node repro.cjs
{
"model": "some-completions-only-model",
"providers": [{ "name": "copilot", "type": "openai", "baseUrl": "...", "wireApi": "responses" }]
}
Expected wireApi: "completions" (as correctly inferred from the catalog), but the auto-populated override wins.
Suggest either: (1) only apply the override when primaryModel === configuredModel (i.e., the override's intended model was actually selected), or (2) have the caller pass a flag distinguishing an explicit user override from an auto-populated default, and only forward the explicit case.
@copilot please address this.
There was a problem hiding this comment.
applyCopilotWireAPI() is now skipped in SDK mode, so the reflection resolver only receives a caller-provided override and otherwise keeps its per-provider catalog inference. This is covered by commit 9f39855.
There was a problem hiding this comment.
Automatic wire API inference is now excluded from SDK-mode overrides; SDK providers infer from their selected models, including fallback models. Explicit environment overrides and task routing remain honored. Fixed in 9906620.
| "sha": "c42a2821e3ef0cee1b1bc20b7eecbb2bfa7a83b4" | ||
| }, | ||
| "haskell-actions/[email protected]": { | ||
| "repo": "haskell-actions/setup", |
There was a problem hiding this comment.
This downgrades pinned actions: github/stale-repos v9.0.19 → v9.0.18 and super-linter/super-linter v9.0.0 → v8.7.0. These version/SHA changes appear unrelated to the wire-API fix in this PR and look like an unintended side effect of a regeneration step picking up a stale lock source. If intentional (e.g. reverting a problematic upgrade), please note the reason in the PR description; otherwise this should be reverted to avoid silently rolling back security/feature updates to these actions.
@copilot please address this.
There was a problem hiding this comment.
Restored the v9.0.19 and v9.0.0 action-pin entries and their mirrored catalogs to the PR-base state in 2c45607; the downgrade is no longer part of the PR diff.
There was a problem hiding this comment.
Restored the newer action pins and synchronized the generated pin data/lock files in 2c45607 and 9906620.
|
@copilot Recent OpenAI models have switched to responses so this should be the default for know oai models.
|
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs — the regression test suite for resolveMultiProviderFromReflect is thorough (missing/stale catalog, multi-provider isolation, Anthropic exclusion, invalid values), but the integration between applyCopilotWireAPI() and the new wireApi forwarding has a real correctness gap: requesting changes.
📋 Key Themes & Highlights
Key Themes
- Ordering bug:
copilot_harness.cjsreadsprocess.env.COPILOT_PROVIDER_WIRE_APIfor the newwireApioption afterapplyCopilotWireAPI()may have auto-set it from catalog/GPT-prefix inference. That conflates "user override" with "auto-inferred default", undermining the PR's own stated goal of honoring explicit overrides over catalog inference — the fallback inference can now win via a different code path. No existing test (in eitherawf_reflect.test.cjsorcopilot_harness.test.cjs) exercises this interaction end-to-end, so it isn't caught today. - Case sensitivity: the new override check in
resolveMultiProviderFromReflect(wireApi === "responses" || wireApi === "completions") is strict-equality on a raw env string, unlikeinferWireApiForModel's normalized lowercase/trim comparison. A value likeResponsessilently falls back to catalog inference instead of applying (or rejecting) the override.
Positive Highlights
- ✅ Good regression coverage for the primary scenario (stale/missing catalog + Responses override) and multi-provider isolation (override applies only to the selected provider, not siblings).
- ✅ Correctly excludes Anthropic providers from the override, matching the existing "Anthropic has no OpenAI wire API" invariant.
- ✅ JSDoc update clearly documents the new
wireApisemantics.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 111.5 AIC · ⌖ 14.7 AIC · ⊞ 10K
Comment /matt to run again
| const primaryProviderName = models.find(m => m.id === primaryModel)?.provider; | ||
| const primaryProvider = providers.find(p => p.name === primaryProviderName); | ||
| const wireApi = options?.wireApi; | ||
| if (primaryProvider && primaryProvider.type !== "anthropic" && (wireApi === "responses" || wireApi === "completions")) { |
There was a problem hiding this comment.
[/diagnosing-bugs] The override check wireApi === "responses" || wireApi === "completions" is case-/whitespace-sensitive, but wireApi flows straight from process.env.COPILOT_PROVIDER_WIRE_API (a user-authored YAML string in engine.env). A value like Responses or " responses " silently falls through to catalog inference instead of applying the explicit override or erroring — exactly the kind of footgun this PR is fixing for the model-name case, just reintroduced for the wireApi value itself.
💡 Suggested fix + missing test
Normalize the same way inferWireApiForModel already does for catalog entries:
const wireApi = String(options?.wireApi || "").toLowerCase().trim();
if (primaryProvider && primaryProvider.type !== "anthropic" && (wireApi === "responses" || wireApi === "completions")) {
primaryProvider.wireApi = wireApi;
...
}The new test suite (it.each(["", "grpc", undefined])) covers invalid/absent values but doesn't exercise mixed-case or padded input, so this regression wouldn't be caught today. Add a case like wireApi: "Responses" asserting the override still applies.
@copilot please address this.
There was a problem hiding this comment.
Normalized configured wire API values with lowercase/trim and added mixed-case and whitespace regression cases in 2c45607.
| const modelsJson = loadModelsJson(); | ||
|
|
||
| const multiProvider = resolveMultiProviderFromReflect({ model: configuredModel, reflectData: awfReflectData, modelsJson, logger: log }); | ||
| const multiProvider = resolveMultiProviderFromReflect({ model: configuredModel, wireApi: process.env.COPILOT_PROVIDER_WIRE_API, reflectData: awfReflectData, modelsJson, logger: log }); |
There was a problem hiding this comment.
[/diagnosing-bugs] process.env.COPILOT_PROVIDER_WIRE_API is read here after applyCopilotWireAPI() ran at line 1261 and may have auto-set it (e.g. defaulting any unrecognized GPT-prefixed model to responses). That means resolveMultiProviderFromReflect can receive an auto-inferred default disguised as an explicit override, overriding its own per-provider catalog inference and silently flipping the wrong model's wire API.
💡 Suggested fix
Snapshot the env value before applyCopilotWireAPI() runs, so only a genuine user-set engine.env.COPILOT_PROVIDER_WIRE_API is forwarded as an override:
const explicitWireApi = process.env.COPILOT_PROVIDER_WIRE_API; // capture before applyCopilotWireAPI may auto-set it
// ...
applyCopilotWireAPI({ modelsJson: loadModelsJson(), logger: log });
// ...
const multiProvider = resolveMultiProviderFromReflect({ model: configuredModel, wireApi: explicitWireApi, reflectData: awfReflectData, modelsJson, logger: log });No existing test in copilot_harness.test.cjs exercises resolveMultiProviderFromReflect's wireApi forwarding together with applyCopilotWireAPI's auto-default, so this gap isn't currently caught.
@copilot please address this.
There was a problem hiding this comment.
applyCopilotWireAPI() is skipped in SDK mode in 9f39855, so inferred defaults are not forwarded as user overrides; task-level routing still takes precedence.
Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Reviewed the PR, applied the model-catalog and review fixes, and completed local validation in
Added catalog Responses metadata for known GPT-5+ models and a GPT-5+ fallback heuristic, while preserving GPT-4 completions inference and explicit overrides. Implemented in
Added Responses metadata for known GPT-5+ models in both synchronized catalogs and the GPT-5+ fallback heuristic; GPT-6 works without an environment override. See |
|
@copilot Please review this PR and run the
|
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
Restored the newer action pins and pushed |
|
🎉 This pull request is included in a new release. Release: |

Copilot SDK multi-provider resolution ignored
COPILOT_PROVIDER_WIRE_API, routinggpt-6-lunathrough/chat/completionswhen catalog inference fell back to completions despite an explicit Responses API setting.The following setting now propagates to both SDK provider configuration and the sidecar environment:
gpt-6-lunafails with Copilot SDK because it is routed through/chat/completions#64965