chore!: remove env-based AI provider configuration - #29053
Conversation
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
|
/coder-agents-review |
|
Chat: Review in progress (8/8 reviewers complete) | View chat deep-review v0.9.0 | Round 4 | Last posted: Round 4, 11 findings (1 P1, 4 P3, 1 P4, 3 Nit, 2 Note), APPROVE. Review Finding inventoryFinding inventory - PR #29053Findings
Contested and acknowledgedCRF-1 (P1, codersdk/deployment.go:1935) - removed YAML/flag options hard-fail startup on upgrade
Round logRound 1Netero-only first pass clean (1 Note). Panel of 16 spawned (Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Ging-go, Ryosuke, Gon, Leorio, Komugi, Knov, Kite, Chopper, Luffy, Meruem, Zoro). Core deletion verified sound by all reviewers: no dangling references to removed symbols, 1 P1 (CRF-1), 2 P3 (CRF-2, CRF-3), 2 Nit (CRF-4, CRF-5), 1 Note (CRF-6), 1 P4 (CRF-7). CRF-1 verified against serpent v0.15.0: CRF-6 downgrade (Mafu-san P2 -> Note). Keep-argument for P2: providers.md and the ESR row now describe opposite behaviors, and an operator reading the ESR guide could leave config in env vars and lose it. Downgrade reason (stronger, evidence-backed): the ESR guide is version-scoped to the 2.29-2.34 upgrade window, where seeding genuinely existed; this removal ships in v2.36.0 (verified: repo Reviewed against a89f41d..e549f71. Round 2Churn guard: PROCEED. New commit 20e0d75 ("fix: clarify AI provider configuration upgrade requirements"), head e549f71->20e0d75. 5 addressed, 2 silent (CRF-6 non-gating Note, CRF-7 out-of-scope P4), 0 contested. Author posted only /coder-agents-review re-triggers, no per-thread replies; classifications rest on the diff. Round-2 delta (e549f71..20e0d75): providers.md +18 (WARNING block naming the 6 YAML keys + startup-failure diagnostic + fresh/empty-DB note), rebranding-migration.md alias rows changed to "Yes, except provider setup", manifest.json dropped "seeds" from the Provider Configuration description, cli/server.go dropped the dead //nolint, backfill test dropped a stray import blank line. No substantive production code change since round 1. CRF-1 resolved via the documentation remedy the finding itself offered ("document a required pre-upgrade config edit"), not a hidden-stub compat shim. Whether documentation alone is adequate for a startup-outage-on-upgrade is the open question the panel evaluates this round. Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Leorio, Gon, Knov + wildcard Meruem. Reviewed against a89f41d..20e0d75. Outcome: CRF-1 re-raised at P1 (REQUEST_CHANGES). Six of nine reviewers independently re-raised it; severity spread P1 (Pariston, Mafuuu, Knov, Meruem) vs P2 (Hisoka, Leorio), tiebreaker to P1 (the P1 reviewers carry the specific blast-radius and unattended-upgrade evidence). New evidence for the re-raise gate, verified: the hidden+deprecated ignored-stub pattern is live in the same file ( CRF-8 new (Bisky P3): bedrock coverage gap in the consolidated DatabaseProviders test; coverage-verified (buildProvider bedrock branch cli/aibridged.go:291 count=0). Lost coverage, not a live bug (code unchanged). CRF-9 dropped (Mafu-san P3, empirically disproved): the claim that no env-var deprecation warning ever existed is false. CRF-6 and CRF-7 remain open/silent (Note, P4); no new evidence, round-1 dispositions stand, not re-raised. Round 3Churn guard: PROCEED. New commit f3cbd76 ("fix: cover Bedrock provider loading and upgrade prerequisites"), head 20e0d75->f3cbd76. Delta: docs/install/upgrade.md +10 (CRF-1 remedy b), cli/aibridged_internal_test.go +45 -3 (CRF-8 fix). No production code change. Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Leorio, Knov + wildcard Kite. Outcome: CRF-1 closed (panel 5/6). Author delivered remedy (b), the upgrade-guide breaking-change note the R2 re-raise named as acceptable, correctly placed at the top of docs/install/upgrade.md reaching the affected class. R2 P1 re-raisers on panel (Mafuuu, Pariston, Knov) all accept; Leorio concedes his P2; Kite accepts; Hisoka holds P2 on the inherent unattended-GitOps residual, framed as a maintainer decision. No new evidence invalidates remedy (b), so re-raise gate not met. Compat-shim remains the strictly-safer zero-outage option, maintainer's call. CRF-8 closed (author fixed f3cbd76). Bedrock coverage restored on both paths (happy path resolves to ProviderAnthropic with nil KeyPool; BedrockWithoutSettings pins the credential-guard error). Verified by 5 reviewers via coverage (bedrock branch 0% -> covered) and passing tests. New this round: CRF-10 (P3, Mafu-san; Leorio/Pariston Note) - the upgrade.md migration section is version-agnostic in a permanent guide and will misdirect every future upgrader; fix is to scope it to config ("if generated by write-config before v2.36") or move to release notes. CRF-11 (Nit, Kite) - the note says remove CLI flags + YAML keys but the linked providers.md section lists only YAML keys. CRF-6 (Note) and CRF-7 (P4) remain open/silent; round-1 dispositions unchanged. Event: COMMENT with dismiss of the prior REQUEST_CHANGES (blocking P1 resolved; only P3/Nit/Note/P4 remain). Reviewed against a89f41d..f3cbd76. Round 4Churn guard: PROCEED. New commit 648a9be ("docs: scope provider cleanup to affected configurations"), head f3cbd76->648a9be. Docs-only delta: upgrade.md +3 -2 (CRF-10), providers.md +8 (CRF-11). No production or test change. Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Leorio + wildcard Zoro. CRF-10 addressed: upgrade.md section reframed conditionally ("If your deployment configuration still contains deprecated AI provider CLI flags or YAML keys, remove them before upgrading" + "No action is needed if those options are absent"), curing the misdirect-future-upgraders concern. CRF-11 addressed: providers.md now lists the CLI flags (including the secret flags) under the linked #database-management-of-providers section. Reviewed against a89f41d..648a9be. Outcome: all 7 reviewers verified CRF-10 and CRF-11 genuinely fixed at the root; flag lists checked one-for-one against the removed options in codersdk/deployment.go (10 --ai-gateway-* flags + 10 --aibridge-* aliases + 6 YAML keys), and the secret-flag/YAML asymmetry is correct (the 4 secret options have no YAML tag). No blocking findings. One new Note: CRF-12 (Zoro Note, Leorio Note) - the 10-flag vs 6-key asymmetry is accurate but unexplained; a one-clause note would remove the apparent gap. CRF-6 (Note) and CRF-7 (P4) remain open/silent, unchanged. All gating findings across the PR are now resolved; event APPROVE (downgraded to COMMENT if needed) with dismiss of the prior REQUEST_CHANGES. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
Documentation CheckUpdates Needed
Note
Automated review via Coder Agents |
There was a problem hiding this comment.
This is a clean, well-cut deletion. The env-based AI provider config was a second control plane for data the DB already owns via UI/API, and it's removed at the root: no dangling references to the removed symbols, go build/go vet green, the encryption-at-rest test was rewritten to seed via the API instead of being deleted, the LockIDAIProvidersEnvSeed iota slot is reserved rather than deleted (so advisory-lock IDs don't shift under a rolling fleet), and the GetAIProviders lock drop plus the backfill context de-detach are both correct now that the only seeder is gone. Hisoka put it well: "It is a boring, well-cut deletion, and boring is a compliment from me."
One finding blocks: the deprecated options weren't only env vars. Six of them (openai_base_url, anthropic_base_url, bedrock_base_url, bedrock_region, bedrock_model, bedrock_small_fast_model) had YAML names and non-empty defaults, so coder server --write-config emits them for every deployment. serpent hard-fails on unknown YAML keys and unknown flags (env vars alone are silently ignored), so a deployment that pins a written config file or passes a removed flag will not start after upgrade. This needs a human decision: keep the removed options as hidden, ignored stubs for one deprecation release (the codebase already does this for inject_coder_mcp_tools and CODER_AIBRIDGE_ENABLED), or document a required pre-upgrade config edit and call it out in the release notes.
Severity count: 1 P1, 2 P3, 2 Nit, 1 Note, 1 P4. The P4 is pre-existing and out of scope, flagged only so it isn't assumed to have a follow-up.
Process note: the PR description accurately inventories the diff but omits the one operator-facing consequence a release-notes author needs. Consider adding: "Operators must remove any provider CLI flags or YAML config keys before upgrading, or the server will not start; leftover env vars are ignored."
docs/ai-coder/ai-gateway/rebranding-migration.md:24
Nit [CRF-4] The "At a glance" table still promises every CODER_AIBRIDGE_* env var survives as a working alias, which is now false for the provider vars this PR removed. (Leorio)
The row reads Environment variables | CODER_AIBRIDGE_* | CODER_AI_GATEWAY_* | Yes (deprecated alias). A reader scans it, sees "old name still works," and keeps e.g. CODER_AIBRIDGE_ANTHROPIC_KEY, which now fails startup as a flag/YAML key and is silently dropped as an env var. The NOTE above states providers are removed, but the table contradicts it three lines later and tables get read first. Qualify the "still works?" cell: "Yes, except provider options (removed, see note above)."
🤖
docs/install/releases/esr-2.29-2.34-upgrade.md:190
Note [CRF-6] The ESR upgrade row still describes env seeding and drift-based startup failure as live, and cross-links to a providers.md page this PR rewrites to say the opposite. (Mafu-san P2, Netero/Mafuuu/Kite Note)
The row states env vars "seed the database once on first startup" and "Coderd fails to start if env vars drift from the seeded database row," then links to a page now saying these vars are "no longer supported." Downgraded from P2 to Note: the ESR guide is version-scoped to the 2.29-2.34 upgrade window, where seeding genuinely existed, and this removal ships in v2.36.0 (verified against the repo .version), so the row is accurate for its scope and the row's own Action column already directs operators to remove the env vars and manage providers via the DB. The residual issue is a cross-document mechanism-description drift that the release-notes owner for the removal version should reconcile, not a defect this PR introduces.
🤖
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
Round 2. The round-1 fixes landed cleanly and I verified each: the providers.md WARNING block names the exact six YAML keys and both groups (checked against the golden config), the rebranding table now says "Yes, except provider setup," the dead //nolint is gone, and manifest.json dropped "seeds." The docs work is genuinely good; Leorio's words: "Whoever wrote this stopped guessing and opened the config." CRF-2 through CRF-5 are resolved.
One finding re-raised, and it's the P1. Six of the nine reviewers independently re-raised CRF-1 with new evidence the round-1 close didn't weigh: the documentation-only remedy does not change the parser behavior, so a config file that still carries any removed key still hard-fails startup on upgrade. The author's own WARNING confirms the blast radius is every operator who ran coder server --write-config, "even if you never configured an AI provider", not just AI Gateway users. That remedy lives on an AI-Gateway feature page an affected operator has no reason to open, and there is no v2.36 upgrade/release note carrying it, so unattended Helm/GitOps upgrades hit an outage with nothing pointing at the fix. Meanwhile the compat-shim pattern that makes the failure impossible already lives in this same file: aiGatewayProxyDomainAllowlist and inject_coder_mcp_tools are kept as Hidden: true, deprecated, parse-and-discard stubs ("Setting this value has no effect. This option will be removed in a future release."). The PR diverged from that pattern for the provider options specifically.
This is a breaking-change-policy decision that belongs to a human, not to the author or reviewer by default. Either keep the six options (and their flag/env forms) as hidden, ignored stubs for one deprecation release and delete them later, or consciously accept the upgrade outage and put a breaking-change entry in a v2.36 upgrade note so the warning reaches the people who hit it. A silent documentation-only close is not sufficient for a startup-outage-on-upgrade.
One new finding this round (P3): the consolidated test recut dropped the only end-to-end coverage of the bedrock provider-build path. Also verified and dropped: a claim that the env-var path never had a deprecation warning; warnIfAIProvidersConfiguredFromEnv existed at base and did warn, so the commit rationale is accurate. CRF-6 (ESR cross-doc, Note) and CRF-7 (vacuous subtest, P4) remain open with round-1 dispositions unchanged.
Severity count this round: 1 P1 (re-raised), 1 P3 (new).
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
Round 3. The blocker is resolved and I'm dismissing the previous REQUEST_CHANGES. Both fixes landed and I verified each.
CRF-1 (the P1) is closed. The author took remedy (b), the path this panel named as acceptable in round 2: a breaking-change note carried by the canonical upgrade guide, reaching the operators who hit the crash. It now sits at the top of docs/install/upgrade.md, applies "even if you don't use AI Gateway," names the exact unknown flag/unknown option failure, and links a providers.md section that enumerates the six YAML keys. All three round-2 P1 re-raisers on the panel accepted it, and none could produce new evidence that the delivered remedy fails, so the re-raise gate isn't met. One residual is real and worth stating plainly: a fully-unattended GitOps upgrade that reads no docs will still crash-loop on first boot until a human removes the keys. That is inherent to any documentation remedy and was known when (b) was offered; the failure is loud, self-describing, and reversible (no data loss). The hidden+deprecated ignored-stub pattern already in this file (aiGatewayProxyDomainAllowlist, inject_coder_mcp_tools) remains the strictly-safer zero-outage option if maintainers want unattended upgrades to survive untouched. That's a maintainer call, not a blocker.
CRF-8 (bedrock coverage) is fully fixed. The consolidated test now adds a keyless bedrock row asserting it resolves to aibridge.ProviderAnthropic with a nil KeyPool, plus a BedrockWithoutSettings subtest pinning the credential-guard error. Five reviewers independently confirmed the previously-dead branch is now exercised on both paths. Bisky: "Root cause of the coverage gap, not the symptom. Clean."
Two new minor docs items this round (non-blocking): the upgrade-guide section is version-agnostic in a permanent guide, and the note references CLI flags while the linked section lists only YAML keys. CRF-6 (ESR cross-doc, Note) and CRF-7 (vacuous subtest, P4) remain open with their round-1 dispositions unchanged.
Severity count this round: 1 P3 (new), 1 Nit (new). No blocking findings remain.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
Round 4. Both round-3 docs findings are fixed at the root, and there are no blocking findings left on this PR. All seven reviewers verified the fixes.
CRF-10: the upgrade-guide section is now conditional ("If your deployment configuration still contains deprecated AI provider CLI flags or YAML keys, remove them before upgrading" plus "No action is needed if those options are absent"), so it no longer misdirects future upgraders whose configs never carried the keys.
CRF-11: the linked providers.md section now enumerates the CLI flags too. I had the panel check the list one-for-one against the removed options in codersdk/deployment.go: all ten --ai-gateway-* flags plus the ten --aibridge-* aliases and the six YAML keys are covered, and the flag-vs-YAML count asymmetry is correct (the four secret options have no YAML tag, so write-config never emits them). Pariston: "Nothing that can crash startup is missing from the instructions."
One optional Note remains (CRF-12): the 10-flag vs 6-key asymmetry is accurate but unexplained, so a reader cross-checking the two lists might wonder if the YAML list is short. One clause would remove the apparent gap. Not worth blocking.
For the record, two findings stay open and non-blocking, unchanged since round 1: CRF-6 (the ESR upgrade row's cross-doc drift, a release-notes owner's call) and CRF-7 (the pre-existing vacuous NonNilDeploymentValues subtest, out of scope for this PR). And the CRF-1 residual remains a maintainer's call: a fully-unattended GitOps upgrade that reads no docs still hard-fails on a config carrying the removed keys; the hidden-stub compat pattern already in this file is the zero-outage alternative if you want that path closed. None of these block.
The core change remains a clean, well-cut deletion. Nice work iterating it to this state.
🤖 This review was automatically generated with Coder Agents.
Document required cleanup of removed provider flags and YAML keys, including defaults emitted by older write-config versions. Keep provider env vars ignored without a new warning, following the prior release deprecation warnings. Qualify the remaining alias documentation, remove stale seeding text and a dead lint directive, and fix the import formatting failure.
Exercise DB-backed Bedrock construction and missing settings while preserving the Anthropic runtime protocol and keyless Bedrock authentication. Surface the required provider-option cleanup in the general upgrade guide for all deployments, including users of older generated YAML. Keep the approved hard-removal policy rather than restoring compatibility options.
List the exact removed provider CLI flags and make the upgrade action conditional on those flags or YAML keys still being present.
a528c60 to
c45b590
Compare
Removes deprecated AI provider configuration through environment variables, CLI flags, and YAML.
Deletion includes indexed providers and legacy OpenAI, Anthropic, and Bedrock options under both AI Gateway and AI Bridge branding, eg.
CODER_AI_GATEWAY_PROVIDER_<N>_*orCODER_AI_GATEWAY_ANTHROPIC_KEY.Removes the associated startup-seeding code.
Updates tests and documentation.
Breaking change: Remove obsolete AI provider CLI flags and YAML keys before upgrading, otherwise Coder will fail to start with an
unknown flagorunknown optionerror. Provider environment variables are ignored and no longer seed the database. Existing database-stored provider configuration is preserved.