Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: deprecate the oauth2 experiment in favor of CODER_OAUTH2_PROVIDER_ENABLE - #29257

Draft
BobbyHo wants to merge 3 commits into
plat-492-2-gatefrom
plat-492-3-deprecate-experiment
Draft

feat: deprecate the oauth2 experiment in favor of CODER_OAUTH2_PROVIDER_ENABLE#29257
BobbyHo wants to merge 3 commits into
plat-492-2-gatefrom
plat-492-3-deprecate-experiment

Conversation

@BobbyHo

@BobbyHo BobbyHo commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Third of five for PLAT-492. CODER_EXPERIMENTS=oauth2 is now a no-op. The server logs one warning naming CODER_OAUTH2_PROVIDER_ENABLE and never reports the experiment as enabled. After this merges, main is safe to cut a release from.

PR What it does
#29248 Adds the flag, a public build info field, and the test default.
#29251 Gates the OAuth2 routes and dashboard navigation on the flag.
this Makes the oauth2 experiment a no-op with a startup warning.
#29267 Logs the provider state and any registered apps at startup.
#29268 Docs.

Implementation Details
  • ReadExperiments lower-cases each value, then matches oauth2 before the default branch. It logs the warning and does not append the value, so GET /api/v2/experiments, telemetry and every Experiments.Enabled check see it as off.
  • The warning fires once per process through a sync.Once. coder server reads the experiment list several times during startup and each read would otherwise repeat the line.
  • The body of ReadExperiments moved into parseExperiments, which takes the sync.Once as a parameter. Tests pass their own guard, so they stay parallel and never touch the package-level one.
  • codersdk.ExperimentOAuth2 gains a Deprecated comment pointing at the flag. The generated swagger carries the same text.
Tests
  • TestReadExperimentsDeprecatedOAuth2 feeds oauth2 and mcp-server-http, asserts the result is exactly mcp-server-http, and asserts the deprecation line is logged once across two reads. The second read uses OAuth2 to cover the lower-casing.
  • Test_Experiments gains a subtest: a coderdtest server configured with oauth2 never lists it from GET /api/v2/experiments and Enabled(ExperimentOAuth2) is false.

@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

PLAT-492

PLAT-635

…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.
@BobbyHo
BobbyHo force-pushed the plat-492-3-deprecate-experiment branch from 88c6c3e to f4747c9 Compare September 12, 2026 00:43
@BobbyHo

BobbyHo commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Chat: Review in progress (14/14 reviewers complete) | View chat
Requested: 2026-09-12 00:43 UTC by @BobbyHo

deep-review v0.9.0 | Round 1 | 43812d8..f4747c9

Last posted: Round 1, 8 findings (3 P3, 2 Nit, 3 Note), COMMENT. Review

Finding inventory

Finding inventory - PR #29257

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Open docs/admin/integrations/oauth2-provider.md:11 Docs still instruct enabling OAuth2 via CODER_EXPERIMENTS=oauth2, now a no-op R1 Mafuuu P3, Leorio P3 Yes
CRF-2 P3 Open coderd/coderd.go:2584 Warning promises removal "in the next release" with no linked ticket R1 Mafu-san P3, Mafuuu Note, Chopper Note Yes
CRF-3 P3 Open coderd/coderd.go:2581 Const doc comment restates the message string's own text (drift risk) R1 Gon P2 Yes
CRF-4 Nit Open coderd/experiments_internal_test.go:51 Exact warn-slice assertion couples oauth2 test to mcp-server-http classification R1 Chopper Nit, Bisky Note, Mafu-san Note Yes
CRF-5 Nit Open coderd/experiments_internal_test.go:54 Comment says "returns the same slice"; each call allocates a fresh slice R1 Gon Yes
CRF-6 Note Open coderd/experiments_test.go:119 require.False(Enabled) redundant after ElementsMatch R1 Bisky Yes
CRF-7 Note Open coderd/coderd.go:2589 Package-global sync.Once shared across test binary; future log assertion would flake R1 Hisoka, Komugi, Ryosuke Yes
CRF-8 Note Open coderd/coderd.go:2606 "Never observed as enabled" invariant enforced in two disjoint branches, not structurally R1 Meruem Yes
CRF-9 Nit Open commit subject / PR title Subject 78 chars, exceeds project 72-char convention R1 Leorio No (body)
CRF-10 Note Dropped by orchestrator (panel consensus: legitimate test seam; Pariston/Hisoka/Ryosuke/Takumi verified) coderd/coderd.go:2599 parseExperiments takes *sync.Once param only for testability R1 Meruem, Ryosuke No
CRF-11 Note Dropped by orchestrator (endpoint coverage is a distinct assertion) coderd/experiments_test.go:102 Integration subtest duplicates unit-test drop assertion R1 Meruem No
CRF-12 Note Dropped by orchestrator (deliberate; constant still self-referenced, machine deprecation would flag own code) codersdk/deployment.go:5195 Deprecated: is a trailing comment, not a doc comment; tooling won't surface it R1 Leorio No

Round log

Round 1

Netero-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:

  • CRF-3: Gon (comments specialist) rated P2. Keep-argument: the doc comment duplicates the message string's content and drifts silently when the message changes. Downgraded to P3 because the comment sits directly above the string literal, so drift is visible at edit time; the consequence is cosmetic staleness, not behavior or contract. Gon P2 preserved in attribution.
About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread coderd/coderd.go Outdated
Comment thread coderd/coderd.go Outdated
Comment thread coderd/experiments_internal_test.go Outdated
Comment thread coderd/experiments_internal_test.go Outdated
Comment thread coderd/experiments_test.go
Comment thread coderd/coderd.go
Comment thread coderd/coderd.go
BobbyHo and others added 2 commits September 12, 2026 09:50
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 <[email protected]>
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 <[email protected]>
Comment thread codersdk/deployment.go
ExperimentNotifications Experiment = "notifications" // Sends notifications via SMTP and webhooks following certain events.
ExperimentWorkspaceUsage Experiment = "workspace-usage" // Enables the new workspace usage tracking.
ExperimentOAuth2 Experiment = "oauth2" // Enables OAuth2 provider functionality.
ExperimentOAuth2 Experiment = "oauth2" // Deprecated: has no effect; use CODER_OAUTH2_PROVIDER_ENABLE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just delete it?

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.

2 participants