Repository navigation
feat: warn when a Bedrock InvokeModel provider ignores the chat model identifier - #30752
dannykopping wants to merge 32 commits into
Conversation
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
…InvokeModel alert and cover its states
…ure after its unset upstream models
Docs previewCheck 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
… uses a Bedrock InvokeModel provider
… for Bedrock InvokeModel
…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
…odels to configured Bedrock identifiers
…election docs section
…keModel and Mantle providers
…ly in the Bedrock InvokeModel notice
…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.
…ia-describedby in one expression
…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.
|
/coder-agents-review |
|
Chat: Review posted | View chat Review historydeep-review v0.13.0 | Round 2 | Last posted: Round 2, 14 findings (1 P0, 1 P2, 6 P3, 3 P4, 3 Nit), COMMENT. Review Finding inventoryFindings
Contested and acknowledgedCRF-3 (P3, AgentChatInput.stories.tsx:271) - New stories have no assertions for the new conditional behavior
Round logRound 1Netero-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 Round 2Churn guard PROCEED: CRF-1, CRF-2, CRF-4 author fixed; CRF-3 fixed in part with the form-alert assertion contested (FE1). About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
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
offlinedocsjob failed, but its steps pass locally at0a8d536:pnpm format:check,pnpm lint,make build/coder_docs_<version>.tgz, and./scripts/check_unstaged.shall exit 0. Rerun the job; if it fails again, its log has the cause.
🤖 This review was automatically generated with Coder Agents.
…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.
…he model form and chat notices
…ption and read-only state for Bedrock InvokeModel
|
/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.
There was a problem hiding this comment.
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 thebedrockIsAnthropicModelprefixes, so a model that fails on every turn can be saved.site/src/pages/AgentsPage/utils/modelOptions.ts:220:toEnabledModelSelectorOptionsdoes not copybedrockInvokeModel, 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-Bedrockdecode AI provider settingserror return has no test; one corrupt non-Bedrock provider row makesChatModelsfail 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 |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.{" "} |
There was a problem hiding this comment.
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}.{" "} |
There was a problem hiding this comment.
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.
🤖
| // 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"` |
There was a problem hiding this comment.
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.
🤖
| // 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"` |
There was a problem hiding this comment.
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.
🤖
| return out, nil | ||
| } | ||
|
|
||
| // bedrockUsesInvokeModel reports whether the gateway serves the provider over |
There was a problem hiding this comment.
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.
🤖
| 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 |
There was a problem hiding this comment.
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; | ||
| }; | ||
|
|
||
| /** |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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, ...".
🤖
…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.
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:
bedrock_invoke_model(boolean) toChatModelProviderDescriptor. It istrueonly 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.ComposerNoticeRowcomponent.Decision log
ChatModelProviderDescriptorrather than the/ai-providersAPI, because org-scoped model admins and Agents users cannot read deployment providers. Only a boolean is exposed.bedrock(Anthropic rows with Bedrock settings are served as plain Anthropic until the backfill promotes them), and the check reusesaibridge.BedrockConfig, so the descriptor matches how the gateway serves the provider: settings must be present andIsConfigured(), andResolvedProtocol()must beinvoke-model(the empty protocol defaults to InvokeModel). Mantle providers reportfalse.bedrock_invoke_modelfalse instead of failing the whole listing.haikusmall-fast routing; any model identifier on an InvokeModel provider is replaced, so the same banner applies.frontend-deep-reviewroles until no blocking or should-fix findings remained. The Agents notice reusesModelSelector'sgetProviderLabel(now exported, defaulting toformatProviderLabel), so it names the provider exactly as the selector does.Screenshots were committed in
afadeeaand03e8f40, each removed in the following commit, so they do not land in the squashed change.Note
Generated by Coder Agents on behalf of @dannykopping.