Skip to content

refactor(coderd/x/chatd/chatprovider): drop provider options only direct clients read - #30958

Draft
ibetitsmike wants to merge 4 commits into
mike/chatd-gateway-only-provider-clientsfrom
mike/chatd-gateway-only-provider-options
Draft

ibetitsmike wants to merge 4 commits into
mike/chatd-gateway-only-provider-clientsfrom
mike/chatd-gateway-only-provider-options

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

After #30929, chatprovider still converted Google, OpenRouter, and Vercel model-config options into fantasy provider options, and applyReasoningEffort still had Azure, Bedrock, Google, OpenRouter, and Vercel arms. No client that production builds reads any of them. This PR deletes the three option converters and those five effort arms.

Why it is safe

  • fantasyConfigForAIBridge builds only the anthropic, openai, or openai-compat client, so model.Provider() never matched the deleted arms.
  • Each fantasy client reads only ProviderOptions[<its own name>] (chatd never renames the compat client), so the google, openrouter, and vercel entries were never sent. Pinned Gemini thinking still reaches Google through the compat extra_body path.
  • The deleted tests (TestProviderOptionsForCall_GoogleThinkingConfig and the Google, OpenRouter, and Vercel rows of TestApplyReasoningEffort) used those provider names, so they tested deleted code. The Gemini helpers they reached keep dedicated tests, which fail on mutants of the Gemini 3 version gate, the clamp comparison, the medium level mapping, the GoogleThinkingLevelFromChat normalization, and the compat extra_body assignment.
  • Two new cases close gaps the deleted rows left: TestProviderOptionsForCall_GoogleThinkingConfigSkipsNonCompatClients fails when the compat provider check becomes != "", and a pre-Gemini-3 medium row in TestGoogleCompatReasoningEffort fails when that arm returns high. Both mutants passed before.
  • The two Bedrock rows of ClampsNoneForClaude55Models now use the Anthropic transport with the same global.anthropic.* IDs, which the gateway sends to that transport. Changing strings.Contains to strings.HasPrefix in anthropicReasoningEffort fails them.
  • rg -n 'googleProviderOptionsFromChatConfig|openRouterProviderOptionsFromChatConfig|vercelProviderOptionsFromChatConfig' .: no matches.

Review focus

Chat debug runs record a lower provider_option_count for configs that set Google, OpenRouter, or Vercel options, because those unread entries are no longer built.

Validation

  • go test ./coderd/x/chatd/chatprovider/... ./coderd/x/chatd/chatopenai/...: pass.
  • go test ./coderd/x/chatd/ -count=1 -p 4 -parallel 4: pass.
  • Mutants through go test -overlay: all 11 fail the named tests, and garbage copies fail to build.
  • make pre-commit: pass.

Stack

This stack removes provider code that only direct, non-gateway clients used, so chatprovider builds just the three clients the AI Gateway path needs; #30979 then derives the BYOK auth header from that same client choice.

  1. refactor(coderd/x/chatd/chatprovider): drop the direct Bedrock client #30928 Drop the direct Bedrock client
  2. refactor(coderd/x/chatd): drop the remaining direct provider clients #30929 Drop the remaining direct provider clients
  3. refactor(coderd/x/chatd/chatprovider): drop provider options only direct clients read #30958 Drop provider options only direct clients read
  4. refactor(coderd/x/chatd): drop transport branches only direct clients used #30966 Drop transport branches only direct clients used
  5. test(coderd/x/chatd): cover BYOK header choice for Bedrock and OpenAI-compatible routes #30978 Cover the BYOK header choice for Bedrock and OpenAI-compatible routes
  6. refactor(coderd/x/chatd): derive the BYOK auth header from the AI Gateway client choice #30979 Derive the BYOK auth header from the client choice

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

…ect clients read

Production builds only the Anthropic, OpenAI, and OpenAI-compatible clients
through the AI Gateway, and each fantasy client reads only the provider
options stored under its own name. Delete the Google, OpenRouter, and Vercel
option converters and the Azure, Bedrock, Google, OpenRouter, and Vercel
arms of applyReasoningEffort, which no built client could read.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T17:36:34.503015Z faacda3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 1db78c68d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, requested this review for Mike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: faacda3e46

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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 branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant