Skip to content

repro: BYOK sub-agent with sonnet model fails with Responses API 400#42215

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/standalone-repro-byok
Closed

repro: BYOK sub-agent with sonnet model fails with Responses API 400#42215
Copilot wants to merge 1 commit into
mainfrom
copilot/standalone-repro-byok

Conversation

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

All 5 pr-processor sub-agents in PR Sous Chef run 28359605525 returned sub_agent_error because claude-sonnet-4.6 does not support the OpenAI Responses API wire format that AWF injects into every agent container.

Failure chain

  • AWF docker-compose sets COPILOT_PROVIDER_WIRE_API=responses unconditionally → all Copilot CLI requests use Responses API format
  • PR Sous Chef's main agent (gpt-5-mini) overrides the sub-agent model via the task tool's optional model parameter, passing "sonnet" despite the pr-processor agent definition specifying claude-haiku-4.5
  • AWF API proxy resolves sonnetclaude-sonnet-4.6 (Anthropic)
  • Anthropic rejects: 400 unsupported_api_for_model: model claude-sonnet-4.6 does not support Responses API

Repro workflow (repro-byok-sonnet-subagent.md)

  • workflow_dispatch, bare Copilot engine with explicit BYOK config:
    engine:
      id: copilot
      model: gpt-5-mini
      env:
        COPILOT_PROVIDER_BASE_URL: https://api.githubcopilot.com
        COPILOT_PROVIDER_BEARER_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
        COPILOT_PROVIDER_WIRE_API: responses
  • Main agent calls dummy-sonnet-sub (defined with model: claude-sonnet-4.6) via task with model: "sonnet" override
  • Expected result: 400 model claude-sonnet-4.6 does not support Responses API

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Repro: BYOK sub-agent with Sonnet model fails with Responses API 400 repro: BYOK sub-agent with sonnet model fails with Responses API 400 Jun 29, 2026
Copilot AI requested a review from pelikhan June 29, 2026 10:22
@pelikhan pelikhan added the awf label Jun 29, 2026
@pelikhan

Copy link
Copy Markdown
Collaborator

/scout suggest a resolution

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

🔭 Recon complete! Scout has charted the territory. Map ready! 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Scout Research Report

Triggered by @github-actions[bot]

Executive Summary

The 400 model claude-sonnet-4.6 does not support Responses API failure is not a Claude bug — it is a known wire-format mismatch when a Responses-API-only client (COPILOT_PROVIDER_WIRE_API=responses) is pointed at a non-OpenAI model. Anthropic models are served only via /v1/messages and an OpenAI chat/completions compat surface, never the OpenAI Responses API. The ecosystem fix is to route wire-API per model: OpenAI family → responses, everything else → chat/completions. This repro is correct.

Click to expand detailed findings

Research Findings

Anthropic does not implement the Responses API

Claude's only OpenAI-compatible surface is /v1/chat/completions; the canonical native endpoint is /v1/messages. There is no Responses-API support, so any responses-wire request for claude-* returns 400 unsupported_api_for_model. Caveats also noted (no prompt caching, JSON via Structured Outputs) ([Claude OpenAI SDK compat docs]((platform.claude.com/redacted)

Identical bug confirmed in LiteLLM — and fixed

unable to call Claude models via Responses API on GitHub Copilot was filed as BerriAI/litellm#20103. Fix in PR #19650: non-OpenAI Copilot models automatically fall back to chat/completions. Workaround until merged: hit /v1/chat/completions directly for Claude. This validates that wire-API is model-dependent, not global.

Copilot routes wire-API per model

gpt-5.1-codex-max etc. require responses; the toolchain tracks a per-model route table (opencode#5866). Forcing one global responses for all models is the defect being reproduced.

Recommendations

  • The repro is sound; expect 400 unsupported_api_for_model. Keep it as a regression guard.
  • Real fix: make the AWF proxy / wire-API selection per-modelresponses only for OpenAI family, chat/completions for claude-*. Mirrors litellm PR [daily regulatory] Regulatory Report - 2026-03-04 #19650.
  • Stop-gap: when a sub-agent override resolves to an Anthropic model, unset/override COPILOT_PROVIDER_WIRE_API to chat-completions, or restrict task-tool model overrides to Responses-capable models.

Key Sources

Suggested Next Steps

  1. File the per-model wire-API routing fix in the API proxy.
  2. Add a guard rejecting responses wire for claude-* before dispatch.

🔭 Intelligence gathered by Scout · 56.6 AIC · ⌖ 4.34 AIC · ⊞ 5.8K ·
Comment /scout to run again

@github-actions github-actions Bot added the scout label Jun 29, 2026
@pelikhan

Copy link
Copy Markdown
Collaborator

/scout generate a bug report for copilot cli

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

🔭 Recon complete! Scout has charted the territory. Map ready! 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Scout Research Report

Triggered by @github-actions[bot]

Executive Summary

Research confirms the PR's root cause. Anthropic/Claude models do not support OpenAI's Responses API wire format — they use the Anthropic Messages API (with optional OpenAI Chat Completions compatibility). Forcing COPILOT_PROVIDER_WIRE_API=responses against a model that resolves to claude-sonnet-4.6 will legitimately yield 400 unsupported_api_for_model. The repro is valid; the deeper fix is wire-format/provider-type selection per model rather than an unconditional responses injection.

Click to expand detailed findings

Research Findings

Anthropic does not natively support the Responses API

  • OpenAI exposes two formats: Chat Completions (legacy, broad) and Responses (OpenAI-specific). Anthropic offers Messages API + an OpenAI Chat Completions compatibility shim — but not Responses. ([Claude Platform — OpenAI SDK compatibility]((platform.claude.com/redacted)
  • The ecosystem treats Responses→Anthropic as needing an explicit adapter, not native support (e.g. open LiteLLM request to add Responses support to the Anthropic adapter). So a 400 unsupported_api_for_model for claude-sonnet-4.6 under responses is expected, not a flaky error. (LiteLLM #16215)

Copilot CLI BYOK uses provider type, not a uniform wire API

  • Official GitHub docs: Copilot CLI BYOK supports three provider types — openai (Chat Completions), azure, and anthropic — each with its own native protocol. Claude should run under COPILOT_PROVIDER_TYPE=anthropic, which speaks Messages, not Responses. (GitHub Docs — BYOK, [Changelog 2026-04-07]((github.blog/redacted)
  • This matches the failure chain: AWF sets COPILOT_PROVIDER_WIRE_API=responses unconditionally, the task model override swaps haiku→sonnet, and the proxy routes a Claude model down the OpenAI Responses path → 400.

Recommendations

  • Keep the repro — it isolates a real bug: a single global responses wire setting cannot serve sub-agents that resolve to Anthropic models.
  • Fix should make wire API / provider type follow the resolved model: Claude → Messages, gpt-5-mini → Responses. Don't inject responses unconditionally.
  • Guard the task model override so an override that crosses providers (sonnet) also flips the wire format, or reject incompatible combos early with a clear error instead of a raw 400.

Key Sources

Suggested Next Steps

  1. Confirm the failing run reproduces with the dispatch workflow.
  2. Make AWF select wire-api per resolved model rather than globally.
  3. Add a precondition error for incompatible model+wire combinations.

🔭 Intelligence gathered by Scout · 62.6 AIC · ⌖ 4.29 AIC · ⊞ 6.5K ·
Comment /scout to run again

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage — §28376613466

Field Value
Category chore (investigation/repro)
Risk 🟡 Medium
Priority 🟢 Low
Score 28 / 100
Action ⏸️ defer
Age 3.4h

Score breakdown: Impact 15 + Urgency 8 + Quality 5

Rationale: Standalone reproduction workflow for the BYOK + sonnet sub-agent 400 unsupported_api_for_model failure. Large addition (1660+/0−, 2 files) but repro/test artifacts only. Draft with no CI. Valuable investigation context but not a fix — defer until the root cause is addressed and a fix PR is opened. This PR documents the failure chain clearly.

Generated by 🔧 PR Triage Agent · 93.2 AIC · ⌖ 14.6 AIC · ⊞ 5.4K ·

@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Triage — §28395315609

Field Value
Category chore
Risk medium
Score 23 / 100
Action defer
Batch

Score breakdown: impact 10 + urgency 5 + quality 8

Carried over (8.5h). Repro workflow for BYOK+claude-sonnet-4.6 Responses API 400 failure. Investigation/documentation artifact — not a fix. Labels correct. Deferred until root cause addressed in a separate fix PR.

Generated by 🔧 PR Triage Agent · 99.1 AIC · ⌖ 11.6 AIC · ⊞ 5.4K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants