Skip to content

fix: render Bedrock agents models with Bedrock identity#26038

Closed
ibetitsmike wants to merge 4 commits into
mainfrom
mike/codagt-549-bedrock-models-use-anthropic-styling-and-icons
Closed

fix: render Bedrock agents models with Bedrock identity#26038
ibetitsmike wants to merge 4 commits into
mainfrom
mike/codagt-549-bedrock-models-use-anthropic-styling-and-icons

Conversation

@ibetitsmike
Copy link
Copy Markdown
Collaborator

@ibetitsmike ibetitsmike commented Jun 3, 2026

Bedrock-backed Agents model configs were still serialized and rendered with Anthropic provider identity when the linked AI provider stored Bedrock settings.

This PR resolves effective Bedrock provider identity on the backend for API summaries, chat model configs, availability, and chatd routing while keeping Bedrock runtime calls on the Anthropic-compatible schema. It also lets Anthropic computer use requests use first-class Bedrock providers, updates the Agents model admin list to render linked provider presentation, adds graceful fallback logging for unreadable provider settings, and adds regression coverage.

Refs CODAGT-549

Mux updated this PR on behalf of Mike.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 3, 2026

CODAGT-549

@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review
Copy link
Copy Markdown
Contributor

coder-agents-review Bot commented Jun 3, 2026

Chat: Review in progress | View chat
Requested: 2026-06-04 12:53 UTC by @ibetitsmike
Spend: $144.24 / $250.00

deep-review v0.7.1 | Round 6 | 167ac7b..9b7bae6

Last posted: Round 6, 21 findings (1 P1, 4 P2, 9 P3, 7 Nit), APPROVE. Review

Finding inventory

Finding Inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P1 Author fixed (033b690) model_routing_aibridge.go:291, chatd.go:8775 Computer use breaks for Bedrock-only deployments R1 Mafuuu Yes
CRF-2 P2 Author fixed (033b690) exp_chats.go:6860 Corrupted provider settings row breaks model config list for all users R1 Hisoka P2, Mafuuu P2, Chopper P3 Yes
CRF-3 P3 Author fixed (033b690) ai_providers.go:199, db2sdk.go:83 API create path stores raw type, permanent dual representation with no compile-time enforcement R1 Meruem P2, Zoro P4, Razor P3, Knov P3 Yes
CRF-4 P3 Author fixed (033b690) exp_chats.go:7090 Update path falls back to stale provider value when linked provider is deleted R1 Meruem P3, Razor P3, Hisoka P3 Yes
CRF-5 P3 Author fixed (033b690) exp_chats_test.go:3497 No test for create/update paths with Bedrock provider identity R1 Bisky P3, Chopper P3 Yes
CRF-6 P3 Author fixed (033b690) provider_identity.go:16 effectiveAIProviderName returns type string, not a name R1 Gon P3, Leorio P2 Yes
CRF-7 P3 Author fixed (033b690) ai_providers_migrate.go:130 Seed path duplicates resolveAIProviderType logic inline R1 Robin P2, Mafu-san P3, Ryosuke P3 Yes
CRF-8 P3 Author fixed (033b690) db2sdk.go:75 No unit tests for core resolution functions R1 Bisky P3, Ryosuke P3 Yes
CRF-9 P3 Author fixed (033b690) model_routing_aibridge.go:269 resolveAIGatewayModelRouteForProviderType passes raw type as model provider hint R1 Mafuuu Yes
CRF-10 P3 Author fixed (033b690) exp_chats.go:6603 Inconsistent and vague error messages for settings parse failures R1 Leorio P3, Chopper Nit Yes
CRF-11 Nit Author fixed (033b690) db2sdk.go:93 Doc comment on AIProviderDisplayName restates function name R1 Gon P2, Leorio Nit Yes
CRF-12 Nit Author fixed (033b690) ai_providers_migrate_test.go:252 Comment restates assertion R1 Gon Yes
CRF-13 Nit Author fixed (033b690) ai_providers_migrate.go:322 Comment restates code R1 Gon Yes
CRF-14 Nit Author fixed (033b690) db2sdk.go:102 Hardcoded "AWS Bedrock" display name duplicated across files R1 Robin Yes
CRF-15 Nit Author fixed (033b690) exp_chats.go:830 providerNameByID maps to types, not names R1 Gon Yes
CRF-16 Nit Author fixed (033b690) ChatModelAdminPanel.stories.tsx:2111 Story mock data uses stale provider value R1 Kite Nit, Razor Nit Yes
CRF-17 P2 Author fixed (55c854d) exp_chats_test.go:3528 Test unrunnable past line 3528: missing dbauthz context on direct DB call R2 Bisky Yes
CRF-18 P2 Author fixed (55c854d) exp_chats.go:6600 convertAIProviderSummary crashes BYOK key listing on corrupt provider settings R2 Hisoka Yes
CRF-19 P3 Author fixed (55c854d) provider_identity.go:25 bestEffortAIProviderType swallows errors without logging R2 Hisoka P3, Meruem P3 Yes
CRF-20 P4 Dropped by orchestrator (architectural suggestion, helpers already exist) chatd.go:8776 Two-pass matching pattern could be centralized R2 Meruem P3 No
CRF-21 P2 Author fixed (899d3d0) ai_providers.go:193, chatd.go:8790 Computer use fails for type=bedrock rows created by this PR's write-time normalization R3 Mafuuu P1, Pariston P2 Yes
CRF-22 Nit Author fixed (9b7bae6) chatd_internal_test.go:202 Test name claims raw-type fallback but exercises effective-type path R4 Netero Nit, Bisky P3 Yes

Round log

Round 1

Panel. Netero clean. 1 P1, 1 P2, 8 P3, 6 Nit. Reviewed against 167ac7b..d61e76c.

Round 2

Churn guard: PROCEED. 16/16 addressed. Netero clean. Panel: 2 P2, 1 P3 new. 1 dropped. Reviewed against 167ac7b..033b690.

Round 3

Churn guard: PROCEED. 3/3 addressed. Netero clean. Panel: 1 P2 new. Reviewed against 167ac7b..55c854d.

Round 4

Churn guard: PROCEED. 1/1 addressed. Netero: 1 Nit. Panel: 0 new findings. APPROVE. Reviewed against 167ac7b..899d3d0.

Round 5

BLOCKED. CRF-22 (Nit) silent. No review. Head SHA unchanged (899d3d0).

Round 6

Churn guard: PROCEED. 1/1 addressed. All 22 findings resolved. Netero clean. Panel clean. APPROVE. Reviewed against 167ac7b..9b7bae6.

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
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.

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

The resolution approach is well-designed: resolveAIProviderType in db2sdk as the single source of truth, threaded through every serialization and routing path. The seed migration writing type=bedrock for new rows is correct and ensures progressive data normalization. Test coverage for the list endpoint, seed paths, and Storybook is proportional. The frontend displayProvider fallback is a good defensive layer.

1 P1, 1 P2, 8 P3, 6 Nit.

The P1 is a regression: computer use breaks for Bedrock-only deployments because aiProviderForProviderType now matches on effective type ("bedrock") but computer use hardcodes "anthropic" as the lookup key.

The P2 is a blast-radius concern: effectiveAIProviderTypesByID loading all providers (including deleted) and failing hard on any corrupt settings blob takes down listChatModelConfigs for every user, a path that was previously infallible.

"I tried to build a case against this approach and couldn't find a P0 or P1 issue." (Pariston, before Mafuuu found the computer use regression. The panel works.)


coderd/x/chatd/model_routing_aibridge.go:269

P3 [CRF-9] resolveAIGatewayModelRouteForProviderType passes the caller's raw type as modelProviderHint, not the resolved effective type.

The function passes chatprovider.NormalizeProvider(providerType) (the caller's input) to resolveAIGatewayRoute. The sibling resolveAIGatewayModelRouteForConfig passes effectiveAIProviderName(provider). If a caller asks for "anthropic" and the matched provider's effective type is "bedrock", the hint says "anthropic" but the provider is Bedrock-backed. Impact is limited to logging and telemetry (routing itself uses fantasyConfigForAIBridge(effectiveProviderType) separately). (Mafuuu)

🤖

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/x/chatd/model_routing_aibridge.go
Comment thread coderd/exp_chats.go
Comment thread coderd/database/db2sdk/db2sdk.go
Comment thread coderd/exp_chats.go
Comment thread coderd/exp_chats_test.go
Comment thread coderd/ai_providers_migrate_test.go Outdated
Comment thread coderd/ai_providers_migrate.go Outdated
Comment thread coderd/database/db2sdk/db2sdk.go Outdated
Comment thread coderd/exp_chats.go Outdated
@ibetitsmike ibetitsmike force-pushed the mike/codagt-549-bedrock-models-use-anthropic-styling-and-icons branch from d61e76c to 033b690 Compare June 4, 2026 00:38
@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

R1 findings addressed comprehensively. The two-pass matching pattern for CRF-1, graceful degradation for CRF-2, write-time normalization for CRF-3, and the constant extraction for CRF-14 all went beyond what was asked. Test density jumped from 23.5% to 42.7%.

2 P2, 1 P3 new this round.

CRF-17 (P2): The new LinkedBedrockProviderUsesBedrockIdentity test fails at line 3528, so the update and list verification paths never execute. One-line fix.

CRF-18 (P2): convertAIProviderSummary still hard-fails on corrupt settings, the same class of bug as CRF-2 on a sibling endpoint (BYOK key listing).

"The fix CRF-2 applied to the model config listing should be mirrored here." (Hisoka)

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/exp_chats.go Outdated
Comment thread coderd/x/chatd/provider_identity.go Outdated
@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

R2 findings addressed cleanly. convertAIProviderSummary refactored to use graceful fallback, test dbauthz context fixed, bestEffortAIProviderType now logs. All verified.

1 P2 new this round.

CRF-21 (P2): The CRF-1 fix (two-pass matching) bridges legacy type=anthropic rows for computer use. But the CRF-3 fix (write-time normalization) now stores type=bedrock in the DB for new providers. Neither pass matches when computer use looks for "anthropic" on these rows. Computer use for Bedrock-only was already broken before this PR (no API keys, ProviderAllowsAmbientCredentials("anthropic") is false), so this is an incomplete fix, not a regression. The test TestResolveDirectModelRouteForProviderTypeFallsBackToRawTypeForBedrock only covers the legacy type=anthropic case.

"The root cause is that computer use's 'anthropic' lookup string has no relationship to the 'bedrock' type the system now writes." (Mafuuu)

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/ai_providers.go
@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review set-spend-limit:250

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

All 21 findings resolved across 4 rounds. CRF-21 fix verified: aiProviderTypeCanSatisfyRequest correctly models the asymmetric relationship (bedrock satisfies anthropic, not vice versa), and the effective type is now passed to credential resolution.

1 Nit remaining (CRF-22, stale test name).

22 findings total: 1 P1, 4 P2, 9 P3, 7 Nit, 1 dropped. 21 addressed, 1 open Nit. Test density rose from 23.5% (R1) to 47.4% (R4). The centralized type resolution design is clean, the graceful degradation handles corrupt data, and the write-time normalization prevents new dual-representation rows.

"I tried to build a case against this change and couldn't. The problem is correctly understood, the solution is proportional, and the fix is at the right level." (Pariston)

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/x/chatd/chatd_internal_test.go
@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review set-spend-limit:250

@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review set-spend-limit:250

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

CRF-22 (Nit, stale test name TestResolveDirectModelRouteForProviderTypeFallsBackToRawTypeForBedrock) is unresolved with no author response. The PR was approved in R4 with this Nit open. Rename to reflect that the test now exercises the effective-type match path, not the raw-type fallback, or acknowledge it as intentional.

🤖 This review was automatically generated with Coder Agents.

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

All 22 findings resolved across 6 rounds. CRF-22 (test rename) addressed in 9b7bae6. No new findings from Netero or the panel.

22 findings total: 1 P1, 4 P2, 9 P3, 7 Nit, 1 dropped. All addressed. Test density: 47.4%. The centralized type resolution, graceful degradation on corrupt settings, write-time normalization, and asymmetric provider-type matching are all clean.

🤖 This review was automatically generated with Coder Agents.

@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

Consolidated into #26035, which now includes CODAGT-549 along with CODAGT-548. Closing this PR as superseded.

Mux consolidated this work on Mike's behalf into #26035.

@ibetitsmike ibetitsmike closed this Jun 4, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant