Repository navigation
test(coderd/x/chatd): cover BYOK header choice for Bedrock and OpenAI-compatible routes - #30978
ibetitsmike wants to merge 3 commits into
Conversation
…-compatible routes
|
@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. Breezy! 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". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. You're on a roll. 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". |
TestResolveModelRouteForConfigAIGatewayProviderAuthgains one subtest that pins which header carries a user's own provider key on two more routes:X-Api-Keyfor an Anthropic model on a Bedrock provider, andAuthorization: Bearerfor an OpenAI-compatible provider. The next layer rewrites how chatd picks that header, and until now no test failed when the call site dropped the model ID. This test-only layer is the characterization test for that rewrite, so it adds lines instead of removing them.Why it is needed
resolveAIGatewayRoutepasses the model ID toaiGatewayRequestFormatForProviderType, and only the Bedrock arm reads it. A mutant that passes""instead passed all ofgo test ./coderd/x/chatd/: no chatd test resolved a BYOK route for a Bedrock provider, andTestAIGatewayRequestFormatForProviderTypecalls the classifier directly.X-Api-Keyexpected,Authorizationsent). A mutant that maps the classifier's default arm to the Anthropic format fails on the OpenAI-compatible row. A garbage copy ofmodel_routing_aibridge.gofails to build, so the-overlayapplies.Review focus
Today the OpenAI-compatible row takes the same default arm as the OpenAI
UserKeysubtest. The next layer keys the header on the client family (anthropic,openai,openai-compat), and this row fails if that switch matches onlyopenai.Validation
go test ./coderd/x/chatd/ -run '^TestResolveModelRouteForConfigAIGatewayProviderAuth$' -count=1: pass.go test -overlay: fail the new subtest.go test ./coderd/x/chatd/ -count=1 -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; #30979 then derives the BYOK auth header from that same client choice.