Skip to content

[aw-failures] [aw-fix] Copilot SDK BYOK: strip OpenAI-only stream_options for type=anthropic providers (HTTP 400 kills agent runs) #43032

Description

@github-actions

Problem statement

Strip the OpenAI-only stream_options field from Copilot SDK BYOK requests whenever the resolved provider is type=anthropic. When the copilot-sdk driver runs in BYOK mode against an Anthropic-format endpoint (claude-sonnet-4.6 via api-proxy:10002), it sends a request containing stream_options, which the Anthropic Messages API does not accept. The upstream returns HTTP 400 stream_options: Extra inputs are not permitted, and the agent dies before emitting a single turn — a hard, deterministic failure.

Affected workflows and run IDs

  • Daily Safe Output Integrator§28614701337
  • PR Triage Agent§28613537448
  • Both fail on all 4 retries with agent_output.json = {"items":[],"errors":[]} (0 turns, 0 safe outputs). Because this is on the default Copilot engine + claude-sonnet-4.6 BYOK path, it likely explains additional reds in the same window.

Probable root cause

The copilot-sdk driver / api-proxy request builder unconditionally includes stream_options (an OpenAI Chat Completions streaming concept, e.g. stream_options.include_usage) when constructing the streaming request. For providers resolved as type=anthropic (see actions/setup/js/awf_reflect.cjs BYOK resolution → api-proxy:10002), the Anthropic Messages API rejects unknown top-level fields, yielding 400 stream_options: Extra inputs are not permitted. Retry logic does not reclassify it (isHTTP400ResponseError=false, isModelNotSupportedError=false), so all attempts fail identically.

Proposed remediation

  1. In the copilot-sdk BYOK request path, only attach stream_options when the resolved provider type is an OpenAI-compatible endpoint; omit it for type=anthropic.
  2. Alternatively, have the type=anthropic translation layer in the api-proxy (:10002) drop stream_options before forwarding upstream, mapping usage capture to Anthropic's native streaming usage events.
  3. Add a retry classifier for isHTTP400ResponseError on stream_options / "Extra inputs are not permitted" so such config-shape errors surface a clear diagnostic instead of 4 silent identical retries.

Success criteria / verification

  • Daily Safe Output Integrator and PR Triage Agent complete on the claude-sonnet-4.6 BYOK path with ≥1 turn and non-empty agent_output.json.
  • No sdk-driver error: 400 ... stream_options lines in agent-stdio.log for type=anthropic providers.
  • A regression test asserts the Copilot BYOK request builder omits stream_options for type=anthropic providers.

Parent report: #43031
Analyzed runs: 28614701337, 28613537448

Generated by 🔍 [aw] Failure Investigator (6h) · 140.7 AIC · ⌖ 34.3 AIC · ⊞ 5.2K ·

  • expires on Jul 9, 2026, 11:21 AM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions