Repository navigation
refactor(coderd/x/chatd): drop the remaining direct provider clients - #30929
Draft
ibetitsmike wants to merge 2 commits into
Draft
ibetitsmike wants to merge 2 commits into
ibetitsmike wants to merge 2 commits into
Conversation
ModelFromConfig still built direct Azure, Google, OpenRouter, and Vercel clients, although the AI Gateway path only asks for the Anthropic, OpenAI, and OpenAI-compatible clients. Delete those arms and their missing-key error cases, the per-provider region plumbing that only the direct Bedrock client read, and ProviderAPIKeys.Empty, which has no callers left.
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.
After #30928,
chatprovider.ModelFromConfigstill built direct Azure, Google, OpenRouter, and Vercel clients. The AI Gateway path never asks for them, becausefantasyConfigForAIBridgesends those provider types through the OpenAI-compatible client. This PR deletes those four arms and their missing-key error cases, the per-provider region plumbing that only the deleted Bedrock client read, andProviderAPIKeys.Empty, which has no callers left.Why it is safe
ModelFromConfigpasses a hint fromfantasyConfigForAIBridge(see refactor(coderd/x/chatd/chatprovider): drop the direct Bedrock client #30928), and no test builds these four clients.ConfiguredProvider.RegionthroughResolveUserProviderKeysintoProviderAPIKeys.RegionByProvider, and only the Bedrock arm read it. The gateway reads Bedrock and Claude Platform regions from the provider settings itself (aibridgedserver.go).chatd.gostill marks Claude Platform on AWS as supporting ambient credentials.TestResolveQuickgenModel_TitleGenerationOverrideAmbientCredentialsfails when that flag is forced to false.Emptylost its last production caller when direct chat routing was removed (refactor: deprecate AIGatewayRoutingEnabled, remove direct chat routing #26862). Its only test checked the region term.TestProviderAPIKeysEmpty_RegionCountsAsConfigured,TestResolveUserProviderKeys_PreservesProviderRegions, theDisabledProviderRegionsRemovedprune row) checked region andEmptycode that is gone. One also checked that a keyless Bedrock provider is available;TestResolveUserProviderKeysstill fails when the Bedrock ambient case or the empty-key rule insetResolvedProviderAPIKeyis mutated.rg -n 'RegionByProvider|setRegion|keys\.Region\(|\.Empty\(\)' coderd/x/chatdfinds nothing.Review focus
The
aiProviderConfigFromKeyshunk inchatd.go, the only change outsidechatprovider: it drops the region reads and keeps the ambient credential flag.Validation
go test ./coderd/x/chatd/chatprovider/... ./coderd/x/chatd/chatopenai/...: pass.go test ./coderd/x/chatd/ -count=1 -p 4 -parallel 4: pass.go build ./...andgo veton every package that importschatprovider: 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.