Files
magpie/docs
yetone 556c01c803 gateway: a provider that refuses auto mode's safeguards is asked again without them and not sent them again, so Copilot's claude-opus-5.5 answers Claude Code (#1756)
Pylogmon's Claude Code on Copilot's claude-opus-5.5 got 400
invalid_request_error "Copilot: safeguards: Extra inputs are not
permitted" on every turn, which magpie labels "request format not
accepted". Their Sonnet worked. Claude Code's auto mode adds a
top-level `safeguards` field for the API's review of its actions.
magpie passes it on to any Claude model (automode.go), and Copilot's
Messages API checks its fields strictly and turns the field away.

The fix uses the existing class for Claude Code's newer fields that a
relay refuses (anthropic_shapes.go: thinking.display, a turn's
output_config). On a 400 naming `safeguards` with "Extra inputs are
not permitted", forward asks again at once without the field and
remembers that the provider refuses it (shapeSafeguards), so later
requests leave it out the first time. Claude Code, finding no
safeguard_results, reviews its actions locally, as it does for every
non-Claude model. The fix sits in forward/forwardOnce, so it reaches
every route to an Anthropic endpoint: relayed and translated
(buildAnthropic), any provider, not only Copilot.

What was run:
- TestSafeguardsRefusedLeftOut (refusal text as the reporter quoted
  it): on the old anthropic_shapes.go the agent gets the same
  "Cop: safeguards: Extra inputs are not permitted" 400; now it gets
  200, asked twice the first time and once after that.
- TestSafeguardsKeptWhereTaken: a provider that takes the field
  still gets it.
- The shapes, system-message and auto mode tests pass.

Not verified: no Copilot account with claude-opus-5.5 was available,
so Copilot's raw error body is assumed. The match is on the words the
reporter quoted, which magpie shows after "Copilot: ".
2026-10-12 22:42:47 +08:00
..