Repository navigation
feat: remove the oauth2 experiment in favor of CODER_OAUTH2_PROVIDER_ENABLE - #29257
Conversation
Add an opt-in deployment flag for Coder's OAuth 2.1 authorization server. The flag is off by default and nothing reads it yet; a follow-up moves the OAuth2 routes and dashboard navigation off the oauth2 experiment and onto this flag. - Add oauth2.provider.enable (--oauth2-provider-enable, CODER_OAUTH2_PROVIDER_ENABLE) under a new Provider group beneath OAuth2, and reword the OAuth2 group so it covers more than GitHub login. - Add oauth2_provider to the build info response so the dashboard can read the provider state without an admin-only config request. - Turn the flag on by default in coderdtest so existing OAuth2 tests keep working once the routes are gated on it. - Regenerate API docs, TypeScript types, the CLI reference, and golden files. Part of PLAT-492.
Read the build info flag value through api.DeploymentValues like the neighbouring fields, and distinguish OAuth2ProviderConfig from OAuth2ProviderSettings in its doc comment.
Move every OAuth2 provider gate off the oauth2 experiment and onto the deployment flag added in the previous commit. The flag is off by default, so a deployment that relied on CODER_EXPERIMENTS=oauth2 must set it or its OAuth2 clients receive 404 responses after upgrading. - Add httpmw.RequireOAuth2Provider, which answers 404 while the provider is disabled. A disabled provider looks like a deployment that never had one. There is no bypass for development builds. - Use it on both discovery documents, the /oauth2 tree, the admin apps API, and the MCP HTTP endpoint, which keeps its mcp-server-http experiment check. The AI Gateway's deprecated MCP injection reads the flag too. - Keep /api/v2/oauth2-provider/settings reachable while disabled so an admin can configure dynamic client registration before enabling the provider. - Gate both OAuth2 navigation items on the new build info field instead of the experiment, and drop the development-build escape hatch. The oauth2 experiment is still parsed and reported; a follow-up makes it a no-op with a specific warning. Part of PLAT-492.
RequireOAuth2Provider takes a bool: the flag is read once at startup in three places, so the closure promised a runtime toggle that would ship half-working. The settings comment moves onto the route it describes, and both enabled sidebar stories set the flag explicitly instead of relying on the fixture default.
c66852f to
88c6c3e
Compare
The MCP HTTP endpoint no longer has a development-build bypass for the mcp-server-http experiment, so tests that reach it must opt in.
…ER_ENABLE The oauth2 experiment no longer does anything. ReadExperiments drops it from the result and logs one warning per process naming the flag, so an admin whose OAuth2 clients start getting 404s after upgrading sees why. The constant stays known for one release so the warning can be specific; the next release removes it.
88c6c3e to
f4747c9
Compare
|
/coder-agents-review |
|
Chat: Review in progress (14/14 reviewers complete) | View chat deep-review v0.9.0 | Round 1 | Last posted: Round 1, 8 findings (3 P3, 2 Nit, 3 Note), COMMENT. Review Finding inventoryFinding inventory - PR #29257Findings
Round logRound 1Netero-only first pass: no findings, mechanical floor clean. Panel of 13 (Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Komugi, Gon, Leorio, Ging-go, Ryosuke, Takumi, Chopper, + Meruem wildcard). No P0-P2 confirmed. 3 P3, 2 Nit, 3 Note posted; 1 process nit in body; 3 design-preference notes dropped. Reviewed against 43812d8..f4747c9. Event: COMMENT. Downgrade notes:
About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
First full-panel pass (Netero first-pass came back clean, then 13 reviewers). This is a tight, well-scoped deprecation: 27 production lines, 75.9% test density, no drive-by refactor. The panel confirmed the important invariants hold. The value is dropped at the parse chokepoint so GET /api/v2/experiments, telemetry, and every Enabled() check see it off; lower-casing is hoisted above the switch, which quietly closes a real case-sensitivity hole where CODER_EXPERIMENTS=OAuth2 used to enable the provider; ExperimentsSafe is empty, so CODER_EXPERIMENTS=* cannot resurrect oauth2 through the wildcard; and the once-per-process warning is justified (coder server reads the experiment list four times at startup). The injectable sync.Once seam keeps the once-only test deterministic without leaking test state into production.
As Hisoka put it: "I came to fight this code. It fought back clean."
No P0-P2 confirmed. Findings: 3 P3, 2 Nit, 3 Note. The two P3s worth attention before this opens a release window: the published OAuth2 docs still tell operators to enable the provider with CODER_EXPERIMENTS=oauth2, which this PR turns into a warned no-op, and the warning text hard-commits removal "in the next release" with no linked ticket in the stated plan.
Process note: the commit subject and PR title run 78 characters, over the project's 72-char convention. Consider tightening (e.g. "feat(coderd): make the oauth2 experiment a no-op") and letting the body carry the flag name, which it already does well. Neither the orchestrator nor the author-agent can accept the two P3 gaps as permanent; each needs a human decision (fix here, or link a tracking ticket and confirm the docs correction lands before any release is cut from main).
docs/admin/integrations/oauth2-provider.md:11
P3 [CRF-1] The published OAuth2 provider docs still instruct operators to enable the provider with the oauth2 experiment, which this PR turns into a warned no-op. (Mafuuu P3, Leorio P3)
Same stale instruction at oauth2-provider.md:11, 20, 25, 28, 34, 401 and docs/ai-coder/mcp-server.md:108, 114, 186, 238 (coder server --experiments oauth2, "Requires the oauth2 experiment flag"). After this merges, the provider is gated on CODER_OAUTH2_PROVIDER_ENABLE, so an operator who follows these docs sets a deprecated value, sees a startup warning, and OAuth2 still does not turn on.
The PR description says "After this merges, main is safe to cut a release from," and lists docs as a later PR in the stack. So the release window opens with this merge, not the docs merge, and anyone reading a shipped doc in that window is instructed toward a dead flag. The runtime warning mitigates it (it names the real flag), which is why this is P3 and not higher. Either move the one-line doc correction into this PR, or make the ordering explicit: confirm the docs PR precedes any release cut from main and link its ticket.
🤖
🤖 This review was automatically generated with Coder Agents.
The deprecation warning promised removal in the next release, which no ticket backed. Removal is now tracked in PLAT-635, so the message says a future release and the code comment names the ticket. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Trim the doc comment on the message constant to its purpose so it cannot drift from the literal. Assert the deprecation warning by count instead of an exact warn slice, which coupled the test to the safety classification of an unrelated experiment, and check explicitly that no unknown-experiment warning leaks. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Experiments carry no compatibility guarantee and previously graduated experiments were deleted outright, so the oauth2 experiment goes the same way. The constant, its display name, the known-list entry and the recognized no-op branch in ReadExperiments are gone, along with the once-per-process deprecation warning and its tests. A leftover CODER_EXPERIMENTS=oauth2 value is now handled like any other unknown experiment: the server logs "ignoring unknown experiment" and nothing gates on it. The startup provider-state lines and the release note carry the migration message pointing at CODER_OAUTH2_PROVIDER_ENABLE.
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. |
TL;DR
Third of five for PLAT-492. The
oauth2experiment is removed.CODER_EXPERIMENTS=oauth2is now an unknown value: the server logsignoring unknown experimentand nothing gates on it. After this merges,mainis safe to cut a release from.oauth2experiment.CODER_OAUTH2_PROVIDER_ENABLE.Implementation Details
codersdk.ExperimentOAuth2, itsDisplayNamecase and itsExperimentsKnownentry are deleted."oauth2"leaves the swagger enum,typesGenerated.tsand the API reference.ReadExperimentsis unchanged frommain. A leftoveroauth2value takes the unknown-experiment path, which warns and passes the value through like any other unknown string. Nothing readsEnabled("oauth2")after feat: gate the OAuth2 provider on CODER_OAUTH2_PROVIDER_ENABLE #29251.Tests
Test_Experimentsalready covers the unknown-value path.