Files
coder/coderd/x
J. Scott Miller 8e323e435c fix(coderd/x/chatd): accept ambient-credential providers in model overrides (#30205)
Model overrides (title generation, advisor, compaction, subagents) run a
credential pre-check through `userCanUseProviderKeys`. That check,
together with `setResolvedProviderAPIKey`, treated only the `bedrock`
provider name as keyless. An anthropic-type provider with Claude
Platform on AWS settings is marked available by
`ResolveUserProviderKeys` through `SupportsAmbientCredentials`, but it
got no `ByProvider` entry. The override then failed with `model override
credentials are unavailable for provider "anthropic"`. Title generation
and advisor treat this as a hard error, so titles were skipped on
dogfood. Compaction and subagent overrides were silently ignored. Chat
turns were unaffected because they route through the AI Gateway without
the pre-check.

The empty-key `ByProvider` entry is now recorded whenever a provider
resolves as available, and `userCanUseProviderKeys` accepts `APIKey !=
"" || HasProvider(name)`. Bedrock behaviour is unchanged, and ambient
providers whose policy requires a user key stay unavailable. If the AWS
environment is misconfigured, such an override now fails at request time
instead of at the pre-check, which matches bedrock today.

Tests: a regression test for the title override on a Claude Platform on
AWS provider (it fails on main with the dogfood error), new
`ResolveUserProviderKeys` cases for ambient anthropic with and without a
required user key, and extra `userCanUseProviderKeys` cases.

> This PR was generated by Coder Agents on behalf of @jscottmiller.
2026-09-30 15:36:17 -05:00
..