Files
coder/coderd/x
Ethan ff40ec6900 fix: pick the Anthropic computer use tool version from the model on every platform (#31657)
#31521 made computer use send `computer_toolset_20260801` to Claude 4.8
and later, but swapped it back to `computer_20251124` on Claude Platform
on AWS and Bedrock, since Anthropic's docs say neither offers the
toolset. That's wrong for Claude Platform on AWS, so computer use on
dogfood's Opus 5.5 fails with `'claude-opus-5-5' does not support tool
types: computer_20251124`.

I probed the AI gateway, and Claude Platform on AWS accepts exactly the
versions the Claude API does, e.g. the toolset for Opus 4.8 and 5.5, and
`computer_20251124` for Opus 4.6. The harnesses that get this right
(Anthropic's computer-use demo and SDK toolset helpers, the Vercel AI
SDK, LiteLLM) pick the version from the model ID alone and leave the
wire format to the platform client, so we'll do the same and drop the
override. fantasy's doc comment repeated the docs, which
coder/fantasy#83 fixed, so this bumps fantasy too.

Bedrock follows the same model table. AWS's Opus 4.8 model card only
lists `computer_20251124`, but it's just behind: Anthropic's Bedrock
docs list Opus 4.8 as taking the toolset with no beta header, and
`anthropic.claude-opus-4-8` on Bedrock (via Mantle in us-east-1)
returned a `screenshot` tool call for the toolset with no beta.
Dogfood's InvokeModel route, which runs Opus 5.5, does the same.

Bedrock was also broken on `main`, since aibridge's Bedrock beta
allowlist drops `computer-use-2025-11-24`, so `computer_20251124` never
got through validation. I've added it. On InvokeModel, Opus 4.7 returned
a `computer` tool call for `computer_20251124` once the flag reached
Bedrock, but a 400 when the flag went through dogfood's gateway, which
runs `main` and drops it. Unlike the effort and context management
flags, the flag doesn't need gating per model, as Bedrock accepts it on
models that don't support `computer_20251124`. On Bedrock InvokeModel in
us-east-2, Haiku 4.5 returned a 200 with the flag on its own and with
`computer-use-2025-01-24` and a `computer_20250124` tool, whilst a
made-up flag got a 400. Bedrock only rejects the tool type itself, and
the model table never sends `computer_20251124` to Haiku 4.5 anyway.

InvokeModel does still run the provider's `settings.model` rather than
the model the chat config names, so the version can disagree with what
actually runs if the two differ. That's the known model swap in #29511,
and it's no worse here, as `main` picked the version from the model
config too. The documented setup is one provider per model, so the two
match, and the native `bedrock-runtime` protocol will remove the swap.

I verified Claude Platform on AWS end to end, running Coder Agents from
this branch against dogfood's AWS gateway route. Computer use on Opus
5.5 and Sonnet 5.5 sent the toolset and got a 200 on every request,
across multi-step turns, an interrupted turn, a page reload, and a chat
that switched to Opus 4.6 (which sent `computer_20251124`) and back. The
same setup on `main` reproduced the 400.

I also ran the same scenarios against dogfood's Bedrock InvokeModel
route. Opus 5.5 and Haiku 5.5 got a 200 on every computer use request,
with up to 22 screenshots in the history, including a chat that switched
to Opus 4.6 on Claude Platform on AWS and back. That went through
dogfood's gateway, so it covers what Bedrock accepts from Coder Agents,
but not a Bedrock provider configured in Coder itself, which I still
haven't run end to end.
2026-11-03 16:52:56 +11:00
..