Skip to content

feat: warn when a Bedrock InvokeModel provider ignores the chat model identifier - #30752

Draft
dannykopping wants to merge 32 commits into
mainfrom
bedrock-invokemodel-model-warning
Draft

dannykopping wants to merge 32 commits into
mainfrom
bedrock-invokemodel-model-warning

Conversation

@dannykopping

@dannykopping dannykopping commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

AWS Bedrock providers that use the InvokeModel protocol replace the requested model with the provider's configured model. A Coder Agents model on such a provider looks configurable, but its model identifier is never sent to AWS.

This PR:

  • Adds bedrock_invoke_model (boolean) to ChatModelProviderDescriptor. It is true only for Bedrock providers that resolve to the InvokeModel protocol. Org admins cannot read deployment providers directly, so the descriptor is the only place the models page and Agents can learn this.
  • Shows one warning on the add, duplicate, and edit model forms for those providers, with a docs link.
  • Shows a notice in the Agents chat input (new chat and existing chat) when the selected model uses such a provider. The notice is part of the input's accessible description. The composer's existing warning row and the new notice now share a ComposerNoticeRow component.
  • Documents how Bedrock names models differently from Anthropic clients, how InvokeModel maps every request onto the provider's two configured models, and which model IDs Mantle expects. Cross-linked from the Agents models docs.
Agents chat input Agents chat input with a prefill warning
agents agents stacked
Add model Edit model
add edit
Decision log
  • Where the signal comes from: ChatModelProviderDescriptor rather than the /ai-providers API, because org-scoped model admins and Agents users cannot read deployment providers. Only a boolean is exposed.
  • Detection: the provider type must be bedrock (Anthropic rows with Bedrock settings are served as plain Anthropic until the backfill promotes them), and the check reuses aibridge.BedrockConfig, so the descriptor matches how the gateway serves the provider: settings must be present and IsConfigured(), and ResolvedProtocol() must be invoke-model (the empty protocol defaults to InvokeModel). Mantle providers report false.
  • Corrupt settings: Bedrock providers' settings were never decoded for the descriptor, because Bedrock always supports ambient credentials. The InvokeModel hint keeps that: undecodable Bedrock settings leave bedrock_invoke_model false instead of failing the whole listing.
  • One message for every model: the warning does not distinguish the gateway's haiku small-fast routing; any model identifier on an InvokeModel provider is replaced, so the same banner applies.
  • Agents placement: inside the chat composer, so it covers both the new-chat form and existing chats, and follows the model selector. Hidden in read-only views, where the viewer cannot send.
  • Docs links open in a new tab so unsaved form edits and chat drafts survive.
  • Review: ran the frontend-deep-review roles until no blocking or should-fix findings remained. The Agents notice reuses ModelSelector's getProviderLabel (now exported, defaulting to formatProviderLabel), so it names the provider exactly as the selector does.

Screenshots were committed in afadeea and 03e8f40, each removed in the following commit, so they do not land in the squashed change.

Note

Generated by Coder Agents on behalf of @dannykopping.

Bedrock providers using the InvokeModel protocol replace the requested
model with the provider's configured model or small fast model. Expose
those models on ChatModelProviderDescriptor so the dashboard can warn
that a chat model's identifier is not sent upstream.
…nvokeModel provider ignores the model identifier
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

…odel providers

The dashboard no longer names the upstream model, so the descriptor only
needs to say whether the provider ignores the requested model.
…InvokeModel warning for every model identifier
…k InvokeModel notices

Describe the Agents notice to assistive tech, open docs links in a new
tab so drafts survive, and move story options into a shared fixture.
…e tones from variants and cover stacked notices
ibetitsmike
ibetitsmike previously approved these changes Oct 14, 2026
…odel-warning

# Conflicts:
#	docs/ai-coder/ai-gateway/providers.md
…ay's BedrockConfig

Reuse aibridge.BedrockConfig instead of mirroring its detection, so the
chat model descriptor cannot drift from how the gateway serves the provider.
…Bedrock InvokeModel notice

Export getProviderLabel so the notice names the provider exactly as the
selector does, and drop the quotes around the provider name.
…le settings

Bedrock providers always support ambient credentials, so their settings
were never decoded when building chat model provider descriptors. Decoding
them for the InvokeModel hint made one corrupt Bedrock row fail the whole
chat models listing. Only the hint now depends on the settings, and it
stays false when they cannot be decoded.
@dannykopping

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-10-22 14:38 UTC by @dannykopping

Review history
  • R1 (2026-10-22), 1 P0, 2 P3, 1 P4, COMMENT. Review
  • R2 (2026-10-22): 14 reviewers, 3 Nit, 1 P0, 1 P2, 6 P3, 3 P4, COMMENT. Review

deep-review v0.13.0 | Round 2 | b1f5f0b..01c2be9

Last posted: Round 2, 14 findings (1 P0, 1 P2, 6 P3, 3 P4, 3 Nit), COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P0 Author fixed (af60986) AgentChatInput.tsx:810 composerDescribedBy makes React Compiler bail out; pnpm lint and CI lint fail R1 Netero Yes
CRF-2 P3 Author fixed (e789391) exp_chats.go:8429 BedrockInvokeModel not gated on provider.Type; type=anthropic with Bedrock settings reports true R1 Netero Yes
CRF-3 P3 Author contested; panel closed R2 (1/1 accept) AgentChatInput.stories.tsx:271 New stories have no play assertions for notice, aria-describedby, read-only hide, form alert R1 Netero Yes
CRF-4 P4 Author fixed (075e220) BedrockInvokeModelNotice.tsx:29 Docs anchor path duplicated in two components R1 Netero Yes
CRF-5 Note Note (body) docs/ai-coder/ai-gateway/providers.md:137 CI offlinedocs failed; local format, lint, build, check_unstaged pass at head R1 Netero No
CRF-6 P3 Open BedrockInvokeModelAlert.tsx:19 Alert says identifier is not used; a non-Anthropic-prefixed identifier makes every chat fail R2 Pariston P3, Mafuuu P3, Knov P3, Melody P3, Nami P3, Ryosuke P4 Yes
CRF-7 P2 Open BedrockInvokeModelNotice.tsx:25 Composer notice is false for correctly named models and unactionable for chat users R2 Pen Botter P2, Luffy P2, Mafuuu P3 Yes
CRF-8 P3 Open BedrockInvokeModelAlert.tsx:23 "Switch to Mantle" remedy is not available to org admins and breaks existing identifiers R2 Pen Botter P3, Leorio P3, Pariston Note Yes
CRF-9 P4 Open BedrockInvokeModelNotice.tsx:27 UI text names one configured model; haiku identifiers run the small fast model R2 Pen Botter P4, Leorio P4, Gon Nit Yes
CRF-10 P3 Open codersdk/chats.go:2827 BedrockInvokeModel boolean reads as a model noun; rename to a predicate before the API ships R2 Gon Yes
CRF-11 Nit Open codersdk/chats.go:2827 omitempty on BedrockInvokeModel differs from sibling booleans R2 Ryosuke Yes
CRF-12 P4 Open exp_chats.go:8410 Comment calls the field "the InvokeModel hint", a second name R2 Gon P2 Yes
CRF-13 P3 Open exp_chats.go:8436 bedrockUsesInvokeModel doc says "serves the provider" but the function does not check provider type R2 Gon P2 Yes
CRF-14 Nit Open BedrockInvokeModelAlert.tsx:10 JSDocs restate rendered text or identifiers (Alert, Notice, ComposerNoticeRow, aiProviders.ts) R2 Gon P2 Yes
CRF-15 Nit Open docs/ai-coder/ai-gateway/providers.md:166 Line 166 restates line 162 R2 Leorio Yes
CRF-16 Nit Note (body) PR title PR title is 80 characters; CONTRIBUTING.md sets 72 max R2 Leorio No
CRF-17 OOS Out of scope (body) codersdk/aiproviders.go:508 Chat model identifiers on InvokeModel providers are not validated against bedrockIsAnthropicModel prefixes R2 Melody, Knov No
CRF-18 OOS Out of scope (body) site/src/pages/AgentsPage/utils/modelOptions.ts:220 toEnabledModelSelectorOptions drops bedrockInvokeModel; default and subagent pickers show no notice R2 Nami No
CRF-19 OOS Out of scope (body) coderd/exp_chats.go:8414 Non-Bedrock settings decode error return has no test R2 Bisky No

Contested and acknowledged

CRF-3 (P3, AgentChatInput.stories.tsx:271) - New stories have no assertions for the new conditional behavior

  • Finding: Netero reported that the new AgentChatInput and model form stories had no play assertions, leaving untested: the notice hidden when readOnlyNotice is set, aria-describedby containing both IDs, and ModelFormFields rendering BedrockInvokeModelAlert only when bedrock_invoke_model is true. Proposed play assertions on the stories.
  • Author defense: site/AGENTS.md FE1 says a story play function must not assert behavior and presence checks belong to the Pixel screenshot. The author added a Vitest case in AgentChatInput.test.tsx for the accessible description (warning then notice) and a ReadOnlyWithBedrockInvokeModel story, and did not add form-alert assertions, citing the existing BedrockInvokeModelProvider add and edit stories (alert present) and non-Bedrock stories (alert absent) as screenshot coverage.
  • Panel closure (R2, 1/1): Netero, the agent that raised it (messaged, not respawned), accepted: FE1 in .claude/docs/FRONTEND_PATTERNS.md forbids play assertions, Pixel screenshots of the add, edit, and non-Bedrock stories catch presence regressions, the new Vitest case covers the accessible description, and ReadOnlyWithBedrockInvokeModel covers the read-only state.

Round log

Round 1

Netero-only (pre-panel gate: CRF-1 P0). 1 P0, 2 P3, 1 P4, 1 Note. Law not run (effective additions 371). Orchestrator reproduced CRF-1 with pnpm run lint:compiler (exit 1, AgentChatInput.tsx 813:3), confirmed CRF-2 against codersdk/aiproviders.go:315 and cli/aibridged.go:335, and ran the offlinedocs steps locally (format, lint, make build/coder_docs_*.tgz, check_unstaged.sh; all exit 0). Reviewed against b1f5f0b..0a8d536.

Round 2

Churn guard PROCEED: CRF-1, CRF-2, CRF-4 author fixed; CRF-3 fixed in part with the form-alert assertion contested (FE1).
First panel round (full panel; round 1 was Netero-only). Netero re-run (messaged R1 agent): no new findings, CRF-3 closed 1/1. Panel (14): ging-go, ging-ts, ging-react, nami, ryosuke, melody, pen-botter, luffy, pariston, mafuuu, bisky, gon, leorio, wildcard knov. Above the 9-12 multi-domain target because 8 specialists triggered (ging x3, nami, ryosuke, melody for the Go-to-TS descriptor field, pen-botter for docs, luffy for the new feature) plus core (2), bisky (tests changed), and the Gon and Leorio once-per-PR floor.
Cross-check: orchestrator verified CRF-6 against coderd/x/chatd/model_routing_aibridge.go:359-380 and aibridge/provider/bedrock_provider.go:136-145. CRF-7 contradiction: Pen Botter and Luffy propose removing the composer notice, Mafuuu proposes rewording without "instead of"; both posted as options. Severity changes: CRF-12 Gon P2 to P4 (keep-argument: a second name forces the reader to guess; drop reason: the referent is the field assigned two lines below). CRF-13 Gon P2 to P3 (keep-argument: an inaccurate doc on the helper is how CRF-2 happened; drop reason: the only caller has the guard and a test). CRF-14 Gon P2 to Nit, four locations combined (keep-argument: AGENTS.md requires substantive comments and no follow-up will remove them; drop reason: no behavior consequence, a project-rule violation where the code works is Nit). Gon Nit on ModelSelector.tsx:42 folded into CRF-9. Verification Notes from Nami, Melody, Pen Botter, Luffy, Leorio, Knov not recorded as findings. Reviewed against b1f5f0b..01c2be9.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds bedrock_invoke_model to ChatModelProviderDescriptor and shows InvokeModel warnings on the model forms and in the Agents chat input. Findings: 1 P0, 2 P3, 1 P4.

This is a first-pass review only. These are mechanical findings; the full review panel has not reviewed this PR yet and will review it after these findings are addressed. The P0 is the cause of the failing CI lint job.

Notes:

  • The CI offlinedocs job failed, but its steps pass locally at 0a8d536: pnpm format:check, pnpm lint, make build/coder_docs_<version>.tgz, and ./scripts/check_unstaged.sh all exit 0. Rerun the job; if it fails again, its log has the cause.

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/exp_chats.go Resolved
…scribedby with explicit pushes

The single-expression form made the React Compiler bail out on
AgentChatInput (unsupported logical terminal), failing lint:compiler and
dropping the component's automatic memoization.

This reverts commit b3ab7f9.
…del providers

Anthropic rows can carry Bedrock settings until BackfillBedrockProviderType
promotes them, but the gateway serves them as plain Anthropic providers, so
they must not show the InvokeModel warning.
…ption and read-only state for Bedrock InvokeModel
@dannykopping

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

coderd/apidoc/.gen formats swagger.json with scripts/biome_format.sh, which
runs biome from site/, but did not depend on site/node_modules/.installed.
When make reached it before any rule that installs site dependencies (the
offlinedocs build visits docs/ prerequisites in filesystem order), the
script skipped formatting because biome was missing, leaving an unformatted
swagger.json and failing the unstaged-files check.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds bedrock_invoke_model to the chat model provider descriptor and shows InvokeModel warnings on the model forms, in the Agents chat input, and in the docs. This is the first full panel review. Findings: 1 P2, 4 P3, 2 P4, 3 Nit.

All four first-pass findings are addressed: the React Compiler failure, the provider type check, the docs path constant, and the test coverage (the FE1 defense was accepted).

Most findings are about the UI text. The form alert and the chat notice say the model identifier does not matter, but chatd uses it to pick the request format, and the chat notice is false for models named after the configured model.

The PR title is 80 characters; CONTRIBUTING.md sets a 72-character maximum, and the title becomes the squash commit subject. For example: "feat: warn when Bedrock InvokeModel ignores the model identifier" (63 characters).

Out of scope (needs a ticket or explicit acceptance by a human):

  • codersdk/aiproviders.go:508: chat model identifiers on an InvokeModel Bedrock provider are not checked against the bedrockIsAnthropicModel prefixes, so a model that fails on every turn can be saved.
  • site/src/pages/AgentsPage/utils/modelOptions.ts:220: toEnabledModelSelectorOptions does not copy bedrockInvokeModel, so the default model and subagent model override pickers do not show that an InvokeModel model runs the provider's configured model.
  • coderd/exp_chats.go:8414: the non-Bedrock decode AI provider settings error return has no test; one corrupt non-Bedrock provider row makes ChatModels fail for the whole organization.

🤖 This review was automatically generated with Coder Agents.

return (
<ComposerNoticeRow id={id} tone="secondary">
<span>
The {getProviderLabel(modelOption)} provider uses the Bedrock

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 [CRF-7] The composer notice appears on every chat with an InvokeModel model, and it is false when the admin follows this PR's docs. (Pen Botter, Luffy, Mafuuu)

providers.md:167 tells admins to name the Agents model after the model it runs, for example claude-sonnet-4-5 for a configured global.anthropic.claude-sonnet-4-5-20250929-v1:0. For that model the notice says requests use the configured model "instead of Claude Sonnet 4.5" while Claude Sonnet 4.5 runs, and the chat user cannot dismiss the notice or change the provider. Either remove the composer notice and keep the admin form alert and docs, or state the fact without the "instead of" comparison, for example "The {provider} provider uses the Bedrock InvokeModel protocol, so it runs a model configured on the provider for this selection."

🤖

> = ({ providerLabel }) => {
return (
<Alert severity="warning" prominent>
<AlertTitle>The model identifier is not sent to AWS Bedrock</AlertTitle>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-6] The alert says the model identifier is not used, but on an InvokeModel provider an identifier without an Anthropic prefix makes every chat with that model fail. (Pariston, Mafuuu, Knov, Melody, Nami, Ryosuke)

fantasyConfigForAIBridge (coderd/x/chatd/model_routing_aibridge.go:372-380) sends a Bedrock model to the Messages route only when bedrockIsAnthropicModel matches (claude-, anthropic., or .anthropic.), and sends any other identifier to /v1/responses. Bedrock.CreateInterceptor (aibridge/provider/bedrock_provider.go:142-145) returns ErrUnknownRoute for that route unless the protocol is Mantle. The docs say "Keep the claude- prefix", but an admin who reads only the alert and enters sonnet or amazon.nova-pro-v1:0 saves a model that cannot run. Add the prefix rule to the alert text.

🤖

<AlertDescription>
{providerLabel} uses the Bedrock InvokeModel protocol, which replaces
the requested model with the model configured on the provider. To choose
the model per request, switch the provider to the Mantle protocol.{" "}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-8] The remedy "switch the provider to the Mantle protocol" is an action an org-scoped model admin cannot take, and it breaks the model being edited if a deployment admin takes it. (Pen Botter, Leorio, Pariston)

The PR description says org-scoped model admins cannot read deployment providers. After a switch, Mantle forwards the identifier unchanged, and providers.md:175 says Mantle needs Mantle model IDs such as anthropic.claude-sonnet-5, so claude-opus-4-5 would be rejected by AWS. Say that a deployment admin must change the provider, and that each Agents model identifier must change to a Mantle model ID at the same time.

🤖

<span>
The {getProviderLabel(modelOption)} provider uses the Bedrock
InvokeModel protocol, so requests use the model configured on the
provider instead of {modelOption.displayName}.{" "}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4 [CRF-9] The notice says "the model configured on the provider", but an identifier that contains haiku runs the provider's small fast model. (Pen Botter, Leorio, Gon)

InvocationModel returns ConfiguredSmallFastModel() when the requested model contains haiku (aibridge/intercept/messages/reqpayload.go:131). An admin who adds claude-haiku-4-5 reads the text, checks the provider's Model field, and concludes the wrong model runs. The same singular wording is in BedrockInvokeModelAlert.tsx:22, the ModelSelectorOption.bedrockInvokeModel doc (ModelSelector.tsx:42), and docs/ai-coder/agents/models.md:56; write "one of the models configured on the provider" in each.

🤖

Comment thread codersdk/chats.go
// BedrockInvokeModel reports whether the provider uses the AWS Bedrock
// InvokeModel protocol. That protocol ignores the model a client requests
// and sends the provider's configured models upstream instead.
BedrockInvokeModel bool `json:"bedrock_invoke_model,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-10] BedrockInvokeModel is a boolean with a noun name, so option.bedrockInvokeModel next to model and displayName reads as a model ID. (Gon)

The same name is used for the JSON field, ProviderInfo.bedrockInvokeModel, and ModelSelectorOption.bedrockInvokeModel, and AgentChatInput derives bedrockInvokeModelOption from it. The Go helper in this PR already uses a predicate name, bedrockUsesInvokeModel. Rename to UsesBedrockInvokeModel / uses_bedrock_invoke_model / usesBedrockInvokeModel before release; after release the JSON rename is an API break.

🤖

Comment thread codersdk/chats.go
// BedrockInvokeModel reports whether the provider uses the AWS Bedrock
// InvokeModel protocol. That protocol ignores the model a client requests
// and sends the provider's configured models upstream instead.
BedrockInvokeModel bool `json:"bedrock_invoke_model,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-11] BedrockInvokeModel uses omitempty, unlike the other booleans in ChatModelProviderDescriptor. (Ryosuke)

Enabled, HasAPIKey, HasEffectiveAPIKey, AllowUserAPIKey, and Available are always emitted, so their generated TypeScript fields are required; omitempty makes bedrock_invoke_model optional in typesGenerated.ts and in the types derived from it. Drop omitempty.

🤖

Comment thread coderd/exp_chats.go
return out, nil
}

// bedrockUsesInvokeModel reports whether the gateway serves the provider over

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-13] The bedrockUsesInvokeModel doc says it reports whether the gateway serves the provider over InvokeModel, but it returns true for type=anthropic settings, which the gateway does not serve over Bedrock. (Gon)

The provider.Type check at line 8429 is what prevents the wrong result, and the doc does not say a caller needs it. The clause about sending configured models upstream repeats codersdk/chats.go:2824-2826. Replace it with: // bedrockUsesInvokeModel reports whether the gateway resolves these settings to the Bedrock InvokeModel protocol. It does not check the provider type.

🤖

Comment thread coderd/exp_chats.go
settings, settingsErr := db2sdk.AIProviderSettings(provider.Settings)
// Some provider configurations support ambient credentials rather than a
// stored key. Actual credential availability is checked by the gateway.
// Bedrock always supports them, so its settings are only needed for the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4 [CRF-12] The added comment calls BedrockInvokeModel "the InvokeModel hint", which is a second name for the field. (Gon)

Replace the two added lines with: // Bedrock always supports them, so undecodable Bedrock settings only leave BedrockInvokeModel false.

🤖

providerLabel: string;
};

/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-14] This JSDoc repeats the alert's rendered text. (Gon)

The JSDocs on BedrockInvokeModelNotice (BedrockInvokeModelNotice.tsx:15), ComposerNoticeRow (ComposerNoticeRow.tsx:23), and bedrockInvokeModelDocsPath (site/src/utils/aiProviders.ts:30) also repeat the rendered text, the identifier, or the value. Delete all four.

🤖

For example, an Agents model with the identifier `claude-opus-4-5` on a provider whose **model** is `global.anthropic.claude-sonnet-4-5-20250929-v1:0` runs Claude Sonnet 4.5.
The dashboard warns about this when you add or edit such a model, and the Agents chat input warns when such a model is selected.

The model identifier you give an Agents model on an InvokeModel provider does not change which Bedrock model runs, beyond the `haiku` rule above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-15] Line 166 repeats line 162: both say the Agents model identifier only chooses between the configured model and small fast model. (Leorio)

Delete line 166 and start line 167 with "To avoid confusion, match the Agents model identifier to the configured model that it selects, ...".

🤖

ethanndickson added a commit that referenced this pull request Nov 6, 2026
…rs (#31745)

Closes
https://linear.app/codercom/issue/CODAGT-1525/allow-computer-use-with-claude-models-from-aws-bedrock-ai-providers

Computer use was only available on models from Anthropic and OpenAI AI
providers, as we decided support from the AI provider type alone, in
five separate places (spawn, turn setup, override validation, telemetry
and the settings UI). A Bedrock AI provider serves Claude models over
the Anthropic Messages API though, and chatd already routes those
through the Anthropic fantasy client, so there's no reason computer use
shouldn't work on them.

To fix, there's now a single rule,
`chatprovider.ComputerUseProvider(providerType, model)`, derived from
the client chatd builds for the model (`chatprovider.ClientProvider`,
previously `aibridgeClientProvider`). If the model uses the Anthropic
client, it gets the Anthropic computer use tool. The OpenAI tool is
still only offered on OpenAI AI providers, as I haven't tested it
against Bedrock Mantle, and I couldn't find anyone else doing it either.
All five places now call this function.

The UI can't re-derive Bedrock routing without duplicating the model ID
heuristic, so `ChatModel` gets a read-only `computer_use_provider` field
(`anthropic`, `openai`, or omitted when computer use isn't supported).
The computer use model override endpoint now accepts Bedrock Claude
models, and its 400 message has changed.

Whilst in here I also fixed a latent bug where the default model
credential check looked up the user's keys under the tool flavour
(`anthropic`) instead of the provider type (`bedrock`).

One caveat: on a Bedrock AI provider using InvokeModel, AI Gateway runs
the provider's configured model rather than the chat model, whilst we
pick the computer use tool version from the chat model ID. It's not
specific to computer use, and should go away with
[AIGOV-747](https://linear.app/codercom/issue/AIGOV-747/deprecate-the-bedrock-invokemodel-protocol-with-model-translation).
In the meantime, #30752 warns when an InvokeModel provider ignores the
chat model identifier.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants