Repository navigation
refactor: delete the ChatProviderAPIKeys test seam - #30927
ibetitsmike wants to merge 3 commits into
Conversation
coderd.Options.ChatProviderAPIKeys and its coderdtest copy were set only by tests. newChatTestOptions and the MCP and toolsdk fixtures used them to start a fake OpenAI-compatible server whose fallback keys no model call read: chat model configs always carry an AI provider ID, and model calls route through AI Gateway with placeholder keys.
|
@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. Can't wait for the next one! 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. 🎉 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 PR deletes
coderd.Options.ChatProviderAPIKeys, itscoderdtest.Optionscopy, and thecoderdtest.OpenAICompatProviderAPIKeysandcoderdtest.FakeOpenAICompatProviderAPIKeyshelpers. Only tests set the option.newChatTestOptionsand 27 other chat, MCP, and toolsdk fixtures used it to start a fake OpenAI-compatible server whose fallback keys no model call reads.Why it is safe
newModelbuilds the client fromfantasyConfigForAIBridge, which returns AI Gateway placeholder keys (coderd/x/chatd/model_routing_aibridge.go).resolveUserProviderAPIKeysForProviderinchatd.go), and so does the HTTP availability check incoderd/exp_chats.go. Active model configs always have anai_provider_id(thechat_model_configs_ai_provider_required_when_activecheck constraint).chatd.Config.ProviderAPIKeysis the provider-type lookup for the computer-use subagent. It asks only foranthropicoropenai, and the test keys were stored only underopenai-compat.CreateOpenAICompatChatModelcreates.git grep -n 'ChatProviderAPIKeys\|OpenAICompatProviderAPIKeys'matches nothing after the change.Review focus
coderd.gono longer passesProviderAPIKeystochatd.Config. Production never setChatProviderAPIKeys, so chatd gets the zero value it always got in production.chatd.Config.ProviderAPIKeysstays for now, because chatd internal tests still set it directly.Validation
Each suite ran before the change (on
e289c6fe011) and after it, with the same results:go test ./coderd/ -run '(?i)chat|mcp' -count=1 -p 4 -parallel 4 -v: pass, 163 top-level tests, 899 PASS lines, 0 failures, same test set both times.go test ./codersdk/toolsdk/ -count=1 -parallel 4 -v: pass, 234 PASS lines, 0 failures.go test ./coderd/coderdtest/... -count=1 -v: pass, 350 PASS lines, 0 failures.go build ./...,go veton the touched packages and./enterprise/coderd/..., andgolangci-lint run --fix=false ./coderd/ ./coderd/coderdtest/... ./codersdk/toolsdk/...: clean.make pre-commit: passed.