Repository navigation
refactor(coderd/x/chatd/chatprovider): drop the direct Bedrock client - #30928
Draft
ibetitsmike wants to merge 2 commits into
Draft
ibetitsmike wants to merge 2 commits into
ibetitsmike wants to merge 2 commits into
Conversation
Production builds every chat model through the in-process AI Gateway, which only uses the Anthropic, OpenAI, and OpenAI-compatible clients. ModelFromConfig still built a direct fantasy Bedrock client and let Bedrock skip the API key check for ambient AWS credentials. Delete the Bedrock arm, ProviderAllowsAmbientCredentials, and the tests that drove the direct client.
ibetitsmike
added this pull request to stack #30930
October 18, 2026 15:13
Collaborator
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This was referenced Oct 18, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chatprovider.ModelFromConfigbuilds the fantasy client for every chat model call. Production reaches it only through the in-process AI Gateway, wherefantasyConfigForAIBridgeasks for the Anthropic, OpenAI, or OpenAI-compatible client, never Bedrock. This PR deletes the direct Bedrock client thatModelFromConfigcould still build,ProviderAllowsAmbientCredentialsand the API key bypass it fed, and the tests that drove that client.Why it is safe
rg -n 'chatprovider\.ModelFromConfig\(' coderd enterprise cli scaletest aibridgefinds one caller,newLanguageModelinmodel_routing_aibridge.go. It passes the hint and placeholder key fromfantasyConfigForAIBridge, which sends Bedrock providers through the Anthropic or OpenAI client by model ID. The gateway signs Bedrock requests itself (aibridge/intercept/awssig).ProviderAllowsAmbientCredentialshad one caller, the key check inModelFromConfig. The gateway path always sets the placeholder key, so the check becomesapiKey == "".TestModelFromConfig_Bedrocksubtests,...BedrockStripsAnthropicHeaders,...BedrockStreamingHeaders,...BedrockBetaExtraHeader, two helpers) each built the direct Bedrock client, so they guarded deleted code.NonBedrockStillRequiresAPIKey, move intoTestModelFromConfig_MissingAPIKey. Its newbedrockrow pins the generic error message that a deleted subtest checked. These mutants all fail it: no empty-key check, a changed generic message, a nil error from the generic arm. A garbage copy of the file fails to build, so the-overlayapplies.Review focus
Ambient credentials still decide provider availability in
ResolveUserProviderKeys. Only the client-side bypass goes away.Validation
go test ./coderd/x/chatd/chatprovider/... ./coderd/x/chatd/chatopenai/...: pass.go test ./coderd/x/chatd/ -run 'AIBridge|AIGateway|Model|Provider|Bedrock|Quickgen|Title|Subagent' -p 4 -parallel 4: pass.make pre-commit: pass.Stack
This stack removes provider code that only direct, non-gateway clients used, so
chatproviderbuilds just the three clients the AI Gateway path needs, then derives the BYOK auth header from that same client choice.